mapbox / node-wmshp

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

Clip features prior to reproject #4

Closed rclark closed 9 years ago

rclark commented 9 years ago

If features are at / cross the poles ogr can fail to reproject them. We should clip the features to ±85.05113° before reprojecting them. This might be somewhat complicated by the fact that we don't know the incoming coordinate system. Not sure how to do this yet via node-gdal.

cc @BergWerkGIS

wilhelmberg commented 9 years ago

This might be somewhat complicated by the fact that we don't know the incoming coordinate system

Shapefiles should have a prj attached. If they don't we should throw an error. A quick look at node-gdal api didn't show any property that exposes SRS. (Maybe I've missed it).

Not sure how to do this yet via node-gdal.

A starting point might be executeSQL with a spatial_filter set or passing ST_Intersection with dialect=sqlite directly with the statementparameter to http://naturalatlas.github.io/node-gdal/classes/gdal.Dataset.html?#method-executeSQL

wilhelmberg commented 9 years ago

This might be somewhat complicated by the fact that we don't know the incoming coordinate system

Overlooked, srs is a property of gdal.Layer