java - Are there OpenStreetMap/MapQuest-hosted map tile attributes I am unaware of? -


i in process of changing how map images google maps api mapquest-hosted map tiles uses openstreetmap data. switching google maps because hit daily request limit wasn't expecting , not using openstreet api because although data free, tiles have limit , need image. therefore, here using mapquest-hosted map tiles.

i think understand it, there things able cannot find documentation on it. example, have image size of 500x300 if possible, or @ least 512*512 (double 256*256 tiles come out be). able display marker. possible?

i used code found here convert latitude , longitude data x , y coordinates:

 public class slippy {  public static void main(string[] args) {  int zoom = 9;  double lat = 42.8549;  double lon = -78.863;  system.out.println("http://otile1.mqcdn.com/tiles/1.0.0/map/" + gettilenumber(lat, lon, zoom) + ".png");  }  public static string gettilenumber(final double lat, final double lon, final int zoom)    {  int xtile = (int)math.floor( (lon + 180) / 360 * (1<<zoom) ) ;  int ytile = (int)math.floor( (1 - math.log(math.tan(math.toradians(lat)) + 1 / math.cos(math.toradians(lat))) / math.pi) / 2 * (1<<zoom) ) ; return("" + zoom + "/" + xtile + "/" + ytile); } } 

i used code generate 2 links map of buffalo; 1 zoom of 9, here, , 1 10 ,here, , center seems differ. result of using open source data or there attribute use?

of course center differs. 1 zoom level next, 1 tile "split" 4 other tiles. consequently center of single tile located @ corners of 4 tiles. using mentioned formula tile contains coordinates. due nature of tiles won't @ center of tile. each specific coordinate there one tile @ given zoom level containing it. hence coordinate can anywhere on tile , not @ center.

still i'm not quite sure want achieve. displaying tiles (and markers) need using leaflet or openlayers (or library supporting tiles concept).

and keep in mind mapquest has terms of use.

edit:

an alternative use wms service instead of tms resizing , concatenation of tiles you. wms have define bounding box around center , image size. resulting image centered around coordinates. osm wiki has list of osm wms servers.

don't forget informed usage policy of wms service choose.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

c++ - End of file on pipe magic during open -