views:

419

answers:

1

Are tiles from Openstreetmap (OSM) compatible with tiles of Google Maps (satellite view)? By compatible I mean - is it possible to use the code/logic that is written to read Openstreetmaps tiles to load tiles from Google maps ?

Can someone point to good resources that can explain more on this topic.

Thanks.

+2  A: 

If by compatible, you mean "is there an equivelent tile covering the exact same area, for a specific zoom level", then yes, the OpenStreetMap tiles are compatible with Google Maps, and even Bing Maps.

If you want to add OSM map tiles as a layer using the Google Maps API, then you can use code like:

var copyOSM = new GCopyrightCollection("<a href=\"http://www.openstreetmap.org/\"&gt;OpenStreetMap&lt;/a&gt;");
copyOSM.addCopyright(new GCopyright(1, new GLatLngBounds(new GLatLng(-90,-180), new GLatLng(90,180)), 0, " "));

var tilesMapnik     = new GTileLayer(copyOSM, 1, 17, {tileUrlTemplate: 'http://tile.openstreetmap.org/{Z}/{X}/{Y}.png'});
var mapMapnik     = new GMapType([tilesMapnik],     G_NORMAL_MAP.getProjection(), "Mapnik");

map = new GMap2(document.getElementById("map_canvas"), { mapTypes: [mapMapnik, G_SATELLITE_MAP] });
map.setCenter(new GLatLng(32.08, 34.82), 12);

map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
Rowland Shaw
@Rowland - thanks for your response. Currently, I've some code (Java) that uses OSM APIs to download map tiles of a certain area to disk. It is possible to use the same code to get tiles from Google maps ?
Soumya Simanta
Rowland Shaw
can a similar process be used to load the tiles on the iPhone?
Aaron Saunders
@Aaron To do something like that, you'd need to intercept the cache for the browser, which would be the more challenging step. Alternately, I'd suggest using a native tile renderer, for which there are a few around, rather than a web app.
Rowland Shaw
thats is what I am asking about... I do not want to use the web browser
Aaron Saunders