WikiWatershed / rapid-watershed-delineation

Rapid Watershed Delineation Code for MMW2
Apache License 2.0
12 stars 6 forks source link

Expose unsimplified result #71

Closed arottersman closed 7 years ago

arottersman commented 7 years ago

Provide a way for users to get the unsimplified geojson results. The MMW Geoprocessing API would like to expose them.

kellyi commented 7 years ago

Both the DRB and NHD endpoints take a simplify param which specifies desired simplify tolerance -- and which I think we may be able to specify as ?simplify=0 to get the unsimplified results.

For DRB, if the simplify param is not supplied the code defaults to using 0.0001 as the tolerance, which I think mostly represents an unsimplified result? This is the OGR command generated when a request doesn't include simplify:

ogr2ogr /tmp/tmpg7_Nis/ba93f85489014479a6b3afafeea9cac8.json /tmp/tmpg7_Nis/New_Point_Watershed.shp -f GeoJSON -simplify 0.0001

and here's when it supplies 0:

ogr2ogr /tmp/tmpg7_Nis/ba93f85489014479a6b3afafeea9cac8.json /tmp/tmpg7_Nis/New_Point_Watershed.shp -f GeoJSON -simplify 0

For NHD, if the simplify param is not supplied the code determines the tolerance based on the shape's area here: https://github.com/WikiWatershed/rapid-watershed-delineation/blob/develop/src/api/main.py#L195

For http://localhost:5000/rwd-nhd/39.892986/-75.276639 the OGR command generated is:

ogr2ogr /tmp/tmpkTIU_I/5813e10ca3884f259ec27a9427eb6c89.json /tmp/tmpkTIU_I/New_Point_Watershed.shp -f GeoJSON -simplify 1.0 -t_srs EPSG: 5070 -a_srs EPSG: 4326

... and for http://localhost:5000/rwd-nhd/39.892986/-75.276639?simplify=0 it's:

ogr2ogr /tmp/tmp60sYqV/b61ea649a83f43f5ba8df70290e40440.json /tmp/tmp60sYqV/New_Point_Watershed.shp -f GeoJSON -simplify 0 -t_srs EPSG: 5070 -a_srs EPSG: 4326

I think I'm going to update both endpoints to check whether simplify is "0" and if so not include -simplify in the OGR command at all. I'll also update the README to document using ?simplify=.