New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Always using +over and +wktext in spherical mercator proj4 string #330
Comments
carto updated in mapbox/carto@75ffde9 |
tilelive updated in mapbox/tilelive@7133202 |
map styles now have a new ticket: https://github.com/developmentseed/tilemill-maps/issues/5, so closing this one. |
fuuuuuuuuuuuuuu. looks like we also need +wktext. |
without +wktext when projections go through gdal's osr module (which is what node-srs uses) critical things like +@nadgrids=null and +over get dropped: http://trac.osgeo.org/proj/wiki/FAQ#ChangingEllipsoidWhycantIconvertfromWGS84toGoogleEarthVirtualGlobeMercator So, I need to do another pass over all these mercator strings to add +wktext and I need to fix node-srs to detect mercator in all its variety of forms (e.g. missing +@nadgrids=null, +over, and +wktext). |
okay, +wktext has been added to all proj4 string everywhere in tilemill, tilelive, and carto that I can find. And node-srs has been updated (and tagged at 0.2.0) to autodetect the major variations that spherical mercator can take - this will ensure than new layers that are added that are in spherical mercator are assigned the exact projection and rendering will be fast. |
+over is a special modifier to a proj4 projection definition that prevents proj4 from doing completely insane things (wrapping) near the edges of valid projection extents. This has long been used for all mapnik stylesheets targeting google mercator for the map projection, and when it is missed unpredictable things happen with lost data near map edges. Here is a correct definition: https://github.com/mapnik/node-mapnik/blob/master/lib/sphericalmercator.js#L3.
It is also extra important to always include +over so that map and layer srs strings match perfectly, otherwise reprojection can occur when it should not (because internally mapnik and most other applications just match on strings to decide whether to dish off to proj_transform or not). So, if proj4's proj_transform is called with one srs that is exactly the same except for the +over, geometries will still be "reprojected" (uselessly) and data can be lost while needlessly being pushed through proj4's grinder.
More details on this parameter here: http://trac.osgeo.org/proj/wiki/GenParms#lon_wrapover-LongitudeWrapping and why you should always use it here: http://fwarmerdam.blogspot.com/2010/02/world-mapping.html
The issue at hand is that this bogus mercator proj4 string (missing the +over) has propagated throughout tilelive,js, carto, and tilemill, so it will need to be fixed in many places. And changes upstream in mapnik (https://lists.berlios.de/pipermail/mapnik-devel/2011-April/001372.html) will make the impact of missing +over more volatile. Lastly, fixing it may cause existing saved maps to render slower because their srs strings will no longer match the map srs.
The text was updated successfully, but these errors were encountered: