Understanding Google’s Projection… slightly, anyway
So, as a result of Custom Projection 6: Google Projection, I got pinged by SharpGIS on IRC, and told that the projection I had there was wrong.
He helped me understand what he was using, and I let him know it still wasn’t helping me. So I set up a Virtual Earth + TileCache demo, and he helped me find the missing piece, in the proj4 FAQ:
In this case, and many other cases using spherical projections, the desired approach is to actually treat the lat/long locations on the sphere as if they were on WGS84 without any adjustments when using them for converting to other coordinate systems. The solution is to “trick” PROJ.4 into applying no change to the lat/long values when going to (and through) WGS84. This can be accomplished by asking PROJ to use a null grid shift file for switching from your spherical lat/long coordinates to WGS84.
+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs
The key here was the +nadgrids=@null, which I’d never seen anywhere before.
The end result?
- Fixing my OSM Tiles
- WMS and TMS overlaid in OpenLayers, as described in an email
- A slightly better understanding of what I didn’t understand for so long.
So. Nice. To not feel lost anymore.
Three cheers for sharpgis! Hooray hooray hooray!
July 24th, 2007 at 9:58 am
Boy, I sure wouldn’t want to put my nads on a grid. But to each his own.
July 25th, 2007 at 8:52 am
This is very cool, and I can’t wait to try it out, but unfortunately the link to the source code zip on the map leads to a page not found error…
Good work though, it looks really nice!
July 25th, 2007 at 9:26 am
archaeogeek:
The URL provided there was accidental, just existed because I copied an existing example of sharpmap’s, not one of my own.
The setup information for using TileCache + OL is in my post to ol-dev, if that’s what you’re looking for.
August 6th, 2007 at 10:43 pm
Hi,
currently i am trying to use tileCache with google map and geoserver
as the wms server. i am facing some difficulties in getting the map
image at certain zoom level. currently the first zoom level (map initial load)
i set it to 10. and the map image load perfectly. how ever when i try to zoom in i cant see the map image anymore. there is no problem with the zoom out. any idea of this?
the map coordinate system is WGS84(LL84) and the SRS is EPSG:4326
thank you
Regards,
Kencana
August 7th, 2007 at 3:51 pm
[…] in lots of Google Earth output improvements, added GeoRSS, improved the Google Maps demo with a better projection, and added paletted images for faster and lighter image generation. And of course […]
August 14th, 2007 at 11:12 am
[…] with support for the map projection used by Virtual Earth and Google Maps, thanks to SharpGIS and Chris Schmidt. So now if you use 900913 as the EPSG code for your WMS requests our output will be perfectly […]