tilemill-project / tilemill

TileMill is a modern map design studio
https://tilemill-project.github.io/tilemill/
BSD 3-Clause "New" or "Revised" License
3.12k stars 527 forks source link

open-streets-dc shapefile projections are resolved incorrectly #1759

Closed springmeyer closed 12 years ago

springmeyer commented 12 years ago

@ajashton - the new shapefiles should be in spherical mercator, right? node-srs is failing to detect them as "true" spherical mercator. Instead their proj4 strings are being detected by ogr as ESRI variant and dumped out as:

+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +a=6378137 +b=6378137 +units=m +no_defs

This is bad because it means all these shapefiles will then trigger mercator to mercator transformations, which will be very slow. So, I need to fix node-srs, but before doing so it would be great to know more about how theses files might have ended up with such new and interesting WKT .prj definitions.

Where did these come from (direct from @migurski's http://metro.teczno.com/? ) or did they see some post-processing with GDAL? If GDAL, which version?

ajashton commented 12 years ago

Although I modified the shapefiles with OGR (to clip them), I didn't reproject them at all and I've just confirmed that the .prj files I committed here are identical to those that came directly from the teczno site.

Could this be fixed just by setting the SRS for all the layers rather than autodetecting?

migurski commented 12 years ago

I’ve seen disagreements between the various OGR/GDAL tools on the definition of 900913. Is there something I should be doing differently on the metro extracts to make these detect as true?

migurski commented 12 years ago

…what I’m doing now is passing everything through osm2pgsql and then pgsql2shp: https://github.com/migurski/Extractotron/blob/master/osm2pgsql.sh#L12

springmeyer commented 12 years ago

hey guys, thanks, this makes sense now. I was surprised that there was yet another variant of spherical mercator being produced. But when I built up my testcases (https://github.com/springmeyer/node-srs/blob/master/test/shapefile.3857.test.js#L26-249) I never did test pgsql2shp. So, this simply must be that it produces yet another variant. node-srs has now been fixed to detect this specific WKT and to report it to TileMill as the canonical spherical mercator (to avoid the extremely expensive mercator 2 mercator reprojection).

@migurski - no need to change anything on your end. If I had the energy I would try to figure out why pgsql2shp is producing different WKT that ogr and qgis, but life is short.

migurski commented 12 years ago

There are more variants of the 900913 PROJ4 string than stars in the sky, or grains of sand.

springmeyer commented 12 years ago

@migurski - so true :) Looking forward to seeing you in PDX soon!