WikiWatershed / rapid-watershed-delineation

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

Return GeoJSON Features, Not Feature Collections #79

Closed arottersman closed 6 years ago

arottersman commented 6 years ago

watershed and input_pt feature collections always contain a single feature. Return just this feature for better compatibility with the MMW API.

Connects https://github.com/WikiWatershed/model-my-watershed/issues/2449

Demo

{
  "input_pt": {
    "geometry": {
      "coordinates": [
        -75.276806,
        39.892917
      ],
      "type": "Point"
    },
    "properties": {
      "Dist_moved": 3,
      "ID": 1,
      "Lat": 39.892986,
      "Lon": -75.276639
    },
    "type": "Feature"
  },
  "watershed": {
    "geometry": {
      "coordinates": [
        [
          [
            -75.277778,
            39.896296
          ],
          [
            -75.277593,
            39.896296
          ],
...
        ]
      ],
      "type": "Polygon"
    },
    "properties": {
      "Area": 0.064926565,
      "AvgOLF": 0.379189616299114,
      "Avgslp": 0.052553854882717,
      "BR": 14.96755599975586,
      "BasinLen": 0.505920379638672,
      "DrnDen": 1.318601508342961,
      "GRIDCODE": 1,
      "RR": 0.029584804549813,
      "StrLen": 0.085612266540527,
      "Strord": 1.0
    },
    "type": "Feature"
  }

Notes

I tried using the ogr2ogr geojson open option FLATTEN_NESTED_ATTRIBUTES, but it didn't have an effect on the output.

Testing Instructions

Confirm the output assumes the expected shape.

arottersman commented 6 years ago

~Hold up, just realized these are still Polygons, but should be conformed to be MultiPolygons.~ We're going to make a change on the MMW side to accept Polygons