azavea / usace-program-analysis-geoprocessing

Companion geoprocessing repository of https://github.com/azavea/usace-program-analysis
Apache License 2.0
1 stars 1 forks source link

Process Multiple MultiPolygons #4

Closed rajadain closed 8 years ago

rajadain commented 8 years ago

In some cases, the client service needs to send a number of multipolygons at once and perform the same operation on them. Modify the geoprocessing service so that instead of taking a single multipolygon, it takes a list of multipolygons and returns a list of results corresponding to each one.

The current input and output are this:

CURRENT INPUT

{
    "multiPolygon": "{\"type\":\"MultiPolygon\",\"coordinates\":[[[[-75.1626205444336,39.95580659996906],[-75.25531768798828,39.94514735903112],[-75.22785186767578,39.89446035777916],[-75.1461410522461,39.88761144548104],[-75.09309768676758,39.91078961774283],[-75.09464263916016,39.93817189499188],[-75.12039184570312,39.94435771955196],[-75.1626205444336,39.95580659996906]]]]}",
    "rasters": [
        "nlcd-2011-30m-epsg5070-0.10.0"
    ],
    "zoom": 0
}

CURRENT OUTPUT

{
    "11": 7569,
    "21": 5569,
    "22": 6442,
    "23": 24881,
    "24": 39047,
    "31": 24,
    "41": 702,
    "43": 22,
    "52": 23,
    "71": 129,
    "81": 292,
    "82": 44,
    "90": 607,
    "95": 345
}

The expected input and output are:

EXPECTED INPUT

{
    "multiPolygon": "[{\"type\":\"MultiPolygon\",\"coordinates\":[[[[-75.1626205444336,39.95580659996906],[-75.25531768798828,39.94514735903112],[-75.22785186767578,39.89446035777916],[-75.1461410522461,39.88761144548104],[-75.09309768676758,39.91078961774283],[-75.09464263916016,39.93817189499188],[-75.12039184570312,39.94435771955196],[-75.1626205444336,39.95580659996906]]]]}]",
    "rasters": [
        "nlcd-2011-30m-epsg5070-0.10.0"
    ],
    "zoom": 0
}

EXPECTED OUTPUT

[{
    "11": 7569,
    "21": 5569,
    "22": 6442,
    "23": 24881,
    "24": 39047,
    "31": 24,
    "41": 702,
    "43": 22,
    "52": 23,
    "71": 129,
    "81": 292,
    "82": 44,
    "90": 607,
    "95": 345
}]