Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new operation supporting many input polygons #101

Merged
merged 2 commits into from
Apr 25, 2022

Conversation

rajadain
Copy link
Member

@rajadain rajadain commented Apr 21, 2022

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

  • Check out this branch
  • Run ./scripts/update
  • Run ./scripts/server
  • In another terminal window, query the run endpoint with the new example
    http --verbose :8090/run < examples/TR55_RasterGroupedCountMany.json
    • Ensure the output has multiple histograms, corresponding to the number and order of input polygons

rajadain and others added 2 commits April 21, 2022 17:21
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
Copy link

@emilyhu0106 emilyhu0106 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix for this complicated problem! The detailed log in the issue comment is very helpful to understand the investigation process.

@rajadain
Copy link
Member Author

Thank you for reviewing!

@rajadain rajadain merged commit 7fe02b2 into develop Apr 25, 2022
@rajadain rajadain deleted the tt/add-operation-for-multiple-polygon-inputs branch April 25, 2022 20:11
@rajadain rajadain assigned rajadain and unassigned emilyhu0106 Apr 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants