WikiWatershed / mmw-geoprocessing

A Spark Job Server job for Model My Watershed geoprocessing.
Apache License 2.0
6 stars 6 forks source link

Add new operation supporting many input polygons #101

Closed rajadain closed 2 years ago

rajadain commented 2 years ago

Overview

This is necessary for TR-55 which sends AoI and modification shapes in a single request, and needs separate histograms for each shape, rather than a unified one.

Related to WikiWatershed/model-my-watershed#3527

Demo

http --verbose :8090/run < examples/TR55_RasterGroupedCountMany.json
POST /run HTTP/1.1
Accept: application/json, */*;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 1857
Content-Type: application/json
Host: localhost:8090
User-Agent: HTTPie/3.1.0

{
    "input": {
        "operationType": "RasterGroupedCountMany",
        "polygon": [
            "{\"type\": \"MultiPolygon\", \"coordinates\": [[[[-76.214368343, 40.054777467], [-76.215591431, 40.054350433], [-76.215430498, 40.053668816], [-76.218445301, 40.052946129], [-76.217275858, 40.050465943], [-76.215344667, 40.050999765], [-76.215612888, 40.051640347], [-76.213306189, 40.052133098], [-76.214368343, 40.054777467]]]]}",
            "{\"type\": \"Polygon\", \"coordinates\": [[[-76.21552399034168, 40.054064794260896], [-76.21392306562677, 40.05366889170663], [-76.21355687864876, 40.05275722212493], [-76.21412648827955, 40.05195786781596], [-76.21483089569675, 40.05180739414808], [-76.21524692156184, 40.052762738523796], [-76.21475458145142, 40.05289687621089], [-76.21548538666218, 40.05331033979461], [-76.21562154952683, 40.05362301849523], [-76.215430498, 40.053668816], [-76.21552399034168, 40.054064794260896]]]}",
            "{\"type\": \"Polygon\", \"coordinates\": [[[-76.21690034866333, 40.05299542487784], [-76.21572017669678, 40.052223456506226], [-76.21702909469604, 40.05191138170397], [-76.21690034866333, 40.05299542487784]]]}",
            "{\"type\": \"Polygon\", \"coordinates\": [[[-76.21524692156184, 40.052762738523796], [-76.21548538666218, 40.05331033979461], [-76.21475458145142, 40.05289687621089], [-76.21524692156184, 40.052762738523796]]]}",
            "{\"type\": \"Polygon\", \"coordinates\": [[[-76.2159140998055, 40.05355289043604], [-76.21548538666218, 40.05331033979461], [-76.21524692156184, 40.052762738523796], [-76.21602058410645, 40.052551954754364], [-76.21619019297006, 40.05348670735846], [-76.2159140998055, 40.05355289043604]]]}"
        ],
        "polygonCRS": "LatLng",
        "rasterCRS": "ConusAlbers",
        "rasters": [
            "nlcd-2011-30m-epsg5070-512-int8",
            "ssurgo-hydro-groups-30m-epsg5070-512-int8"
        ],
        "zoom": 0
    }
}

HTTP/1.1 200 OK
Content-Length: 349
Content-Type: application/json
Date: Thu, 21 Apr 2022 15:56:47 GMT
Server: akka-http/10.0.9

{
    "result": [
        {
            "List(21, 2)": 3,
            "List(21, 3)": 3,
            "List(22, 2)": 16,
            "List(22, 3)": 4,
            "List(23, 2)": 26,
            "List(24, 2)": 4,
            "List(81, 2)": 16,
            "List(81, 3)": 13,
            "List(82, 2)": 29,
            "List(82, 3)": 4
        },
        {
            "List(21, 2)": 2,
            "List(22, 2)": 12,
            "List(23, 2)": 12,
            "List(24, 2)": 1,
            "List(82, 2)": 1
        },
        {
            "List(23, 2)": 1,
            "List(82, 2)": 6
        },
        {
            "List(23, 2)": 2
        },
        {
            "List(23, 2)": 2,
            "List(82, 2)": 4
        }
    ]
}

Testing Instructions

rajadain commented 2 years ago

Thank you for reviewing!