mapbox / node-wmshp

Reproject shapefiles to EPSG:3857 using node-gdal
ISC License
9 stars 5 forks source link

Cropping is causing errors for all shapefiles #6

Closed GretaCB closed 9 years ago

GretaCB commented 9 years ago

Remove for now, until we can fine-tune cropping files with extents beyond/close to the dateline.

cc @rclark @BergWerkGIS

wilhelmberg commented 9 years ago

@GretaCB Maybe this approach was a bit too brute force :smirk:

Neither the docs for OGRGeometry::Intersection nor the docs geos::geom::Geometry::intersection mention this explicitly, but it is good practice to execute spatial operations only when the coordinate systems of the involved features are the same. Otherwise strange things might or might not happen.

That's also what I meant with: Probably an extent and valid projection check for all coordinate systems will have to be implemented. Not just WGS84 before.

My suggested route for a next iteration would be:

Afterwards, extend on the fly as errors pop up and implement the same routine for other world wide coordinate systems.

GretaCB commented 9 years ago

Thanks for your input @BergWerkGIS . For now, until we can discuss and test further, I'm going to remove the cropping and include a try/catch around the transform function and consider any files it catches to be invalid.