[test] update test cases
Browse files
events/payload_point_colico.json
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
{
|
2 |
-
"
|
3 |
-
|
|
|
|
|
4 |
"prompt": [{
|
5 |
"type": "point",
|
6 |
"data": [500, 600],
|
@@ -8,4 +10,4 @@
|
|
8 |
}],
|
9 |
"zoom": 14,
|
10 |
"source_type": "Satellite"
|
11 |
-
}
|
|
|
1 |
{
|
2 |
+
"bbox": {
|
3 |
+
"ne": {"lat": 46.1618799417681, "lng": 9.43905830383301},
|
4 |
+
"sw": {"lat": 46.12584245997462, "lng": 9.344301223754885}
|
5 |
+
},
|
6 |
"prompt": [{
|
7 |
"type": "point",
|
8 |
"data": [500, 600],
|
|
|
10 |
}],
|
11 |
"zoom": 14,
|
12 |
"source_type": "Satellite"
|
13 |
+
}
|
events/payload_point_eolie.json
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bbox": {
|
3 |
+
"ne": {
|
4 |
+
"lat": 39.036252959636606,
|
5 |
+
"lng": 15.040283203125002
|
6 |
+
},
|
7 |
+
"sw": {
|
8 |
+
"lat": 38.302869955150044,
|
9 |
+
"lng": 13.634033203125002
|
10 |
+
}
|
11 |
+
},
|
12 |
+
"prompt": [
|
13 |
+
{
|
14 |
+
"type": "point",
|
15 |
+
"data": {
|
16 |
+
"lat": 38.48542007717153,
|
17 |
+
"lng": 14.921846904165468
|
18 |
+
},
|
19 |
+
"label": 0
|
20 |
+
}
|
21 |
+
],
|
22 |
+
"zoom": 10,
|
23 |
+
"source_type": "Satellite"
|
24 |
+
}
|
events/payload_rectangle.json
CHANGED
@@ -1,10 +1,12 @@
|
|
1 |
{
|
2 |
-
"
|
3 |
-
|
|
|
|
|
4 |
"prompt": [{
|
5 |
"type": "rectangle",
|
6 |
"data": [400, 460, 524, 628]
|
7 |
}],
|
8 |
"zoom": 6,
|
9 |
"source_type": "Satellite"
|
10 |
-
}
|
|
|
1 |
{
|
2 |
+
"bbox": {
|
3 |
+
"ne": {"lat": 45.699, "lng": 127.1},
|
4 |
+
"sw": {"lat": 30.1, "lng": 148.492}
|
5 |
+
},
|
6 |
"prompt": [{
|
7 |
"type": "rectangle",
|
8 |
"data": [400, 460, 524, 628]
|
9 |
}],
|
10 |
"zoom": 6,
|
11 |
"source_type": "Satellite"
|
12 |
+
}
|
tests/events/lambda_handler.json
CHANGED
@@ -60,7 +60,7 @@
|
|
60 |
"header": {
|
61 |
"Content-Type": "application/json"
|
62 |
},
|
63 |
-
"body": "{\"n_predictions\": 1, \"geojson\": \"{\\\"type\\\": \\\"FeatureCollection\\\", \\\"features\\\": [{\\\"id\\\": \\\"0\\\", \\\"type\\\": \\\"Feature\\\", \\\"properties\\\": {\\\"raster_val\\\": 255.0}, \\\"geometry\\\": {\\\"type\\\": \\\"Polygon\\\", \\\"coordinates\\\": [[[14.920806884765623, 38.52023522875919], [14.931793212890625, 38.52023522875919], [14.931793212890625, 38.51916077398036], [14.948272705078123, 38.51916077398036], [14.948272705078123, 38.52023522875919], [14.951019287109371, 38.52023522875919], [14.951019287109371, 38.51916077398036], [14.952392578124998, 38.51916077398036], [14.952392578124998, 38.51271370850396], [14.953765869140623, 38.51271370850396], [14.953765869140623, 38.50734071290346], [14.952392578124998, 38.50734071290346], [14.952392578124998, 38.50626606567192], [14.953765869140623, 38.50626606567192], [14.953765869140623, 38.49659351894757], [14.95513916015625, 38.49659351894757], [14.95513916015625, 38.49551871135403], [14.956512451171873, 38.49551871135403], [14.956512451171873, 38.49659351894757], [14.957885742187498, 38.49659351894757], [14.957885742187498, 38.500892588964604], [14.959259033203125, 38.500892588964604], [14.959259033203125, 38.5030420277569], [14.96063232421875, 38.5030420277569], [14.96063232421875, 38.49766831050554], [14.962005615234373, 38.49766831050554], [14.962005615234373, 38.490144432857555], [14.96337890625, 38.490144432857555], [14.96337890625, 38.485844721434205], [14.964752197265625, 38.485844721434205], [14.964752197265625, 38.48369476951686], [14.972991943359375, 38.48369476951686], [14.972991943359375, 38.48261976950727], [14.975738525390623, 38.48261976950727], [14.975738525390623, 38.4815447534639], [14.97711181640625, 38.4815447534639], [14.97711181640625, 38.48046972138692], [14.978485107421875, 38.48046972138692], [14.978485107421875, 38.479394673276445], [14.97711181640625, 38.479394673276445], [14.97711181640625, 38.47616943274548], [14.972991943359375, 38.47616943274548], [14.972991943359375, 38.47509432050244], [14.971618652343748, 38.47509432050244], [14.971618652343748, 38.47401919222662], [14.9688720703125, 38.47401919222662], [14.9688720703125, 38.47186888757716], [14.967498779296873, 38.47186888757716], [14.967498779296873, 38.4707937112038], [14.966125488281248, 38.4707937112038], [14.966125488281248, 38.46971851879821], [14.964752197265625, 38.46971851879821], [14.964752197265625, 38.46864331036053], [14.96337890625, 38.46864331036053], [14.96337890625, 38.465417588856305], [14.962005615234373, 38.465417588856305], [14.962005615234373, 38.46219172306828], [14.96063232421875, 38.46219172306828], [14.96063232421875, 38.46111640240985], [14.959259033203125, 38.46111640240985], [14.959259033203125, 38.46004106572045], [14.957885742187498, 38.46004106572045], [14.957885742187498, 38.458965713000204], [14.959259033203125, 38.458965713000204], [14.959259033203125, 38.456814959467785], [14.96063232421875, 38.456814959467785], [14.96063232421875, 38.45251326003907], [14.957885742187498, 38.45251326003907], [14.957885742187498, 38.4514377951069], [14.953765869140623, 38.4514377951069], [14.953765869140623, 38.450362314145], [14.952392578124998, 38.450362314145], [14.952392578124998, 38.447135775082444], [14.953765869140623, 38.447135775082444], [14.953765869140623, 38.444984668894726], [14.95513916015625, 38.444984668894726], [14.95513916015625, 38.4428334985915], [14.956512451171873, 38.4428334985915], [14.956512451171873, 38.44175788939692], [14.95513916015625, 38.44175788939692], [14.95513916015625, 38.44068226417388], [14.953765869140623, 38.44068226417388], [14.953765869140623, 38.43960662292253], [14.951019287109371, 38.43960662292253], [14.951019287109371, 38.438530965643004], [14.948272705078123, 38.438530965643004], [14.948272705078123, 38.43960662292253], [14.9468994140625, 38.43960662292253], [14.9468994140625, 38.44068226417388], [14.945526123046875, 38.44068226417388], [14.945526123046875, 38.44175788939692], [14.944152832031248, 38.44175788939692], [14.944152832031248, 38.447135775082444], [14.942779541015623, 38.447135775082444], [14.942779541015623, 38.450362314145], [14.940032958984375, 38.450362314145], [14.940032958984375, 38.4514377951069], [14.937286376953121, 38.4514377951069], [14.937286376953121, 38.45251326003907], [14.9359130859375, 38.45251326003907], [14.9359130859375, 38.453588708941375], [14.934539794921873, 38.453588708941375], [14.934539794921873, 38.4546641418137], [14.93316650390625, 38.4546641418137], [14.93316650390625, 38.456814959467785], [14.931793212890625, 38.456814959467785], [14.931793212890625, 38.45789034424927], [14.930419921874998, 38.45789034424927], [14.930419921874998, 38.458965713000204], [14.92767333984375, 38.458965713000204], [14.92767333984375, 38.46004106572045], [14.923553466796873, 38.46004106572045], [14.923553466796873, 38.46111640240985], [14.920806884765623, 38.46111640240985], [14.920806884765623, 38.46219172306828], [14.91668701171875, 38.46219172306828], [14.91668701171875, 38.463267027695586], [14.913940429687496, 38.463267027695586], [14.913940429687496, 38.46434231629164], [14.912567138671875, 38.46434231629164], [14.912567138671875, 38.465417588856305], [14.911193847656252, 38.465417588856305], [14.911193847656252, 38.466492845389425], [14.909820556640625, 38.466492845389425], [14.909820556640625, 38.46756808589088], [14.908447265625, 38.46756808589088], [14.908447265625, 38.46864331036053], [14.907073974609373, 38.46864331036053], [14.907073974609373, 38.46971851879821], [14.905700683593748, 38.46971851879821], [14.905700683593748, 38.47186888757716], [14.904327392578125, 38.47186888757716], [14.904327392578125, 38.47401919222662], [14.9029541015625, 38.47401919222662], [14.9029541015625, 38.47509432050244], [14.901580810546873, 38.47509432050244], [14.901580810546873, 38.47724452895559], [14.900207519531248, 38.47724452895559], [14.900207519531248, 38.490144432857555], [14.901580810546873, 38.490144432857555], [14.901580810546873, 38.49229419236133], [14.9029541015625, 38.49229419236133], [14.9029541015625, 38.498743086027794], [14.904327392578125, 38.498743086027794], [14.904327392578125, 38.50841534409805], [14.905700683593748, 38.50841534409805], [14.905700683593748, 38.511639141458616], [14.907073974609373, 38.511639141458616], [14.907073974609373, 38.51271370850396], [14.908447265625, 38.51271370850396], [14.908447265625, 38.51378825951165], [14.909820556640625, 38.51378825951165], [14.909820556640625, 38.51486279448153], [14.911193847656252, 38.51486279448153], [14.911193847656252, 38.51593731341349], [14.912567138671875, 38.51593731341349], [14.912567138671875, 38.51701181630737], [14.915313720703123, 38.51701181630737], [14.915313720703123, 38.51916077398036], [14.920806884765623, 38.51916077398036], [14.920806884765623, 38.52023522875919]]]}}, {\\\"id\\\": \\\"1\\\", \\\"type\\\": \\\"Feature\\\", \\\"properties\\\": {\\\"raster_val\\\": 0.0}, \\\"geometry\\\": {\\\"type\\\": \\\"Polygon\\\", \\\"coordinates\\\": [[[13.634033203125002, 39.03625295963659], [13.634033203125002, 38.30286995515004], [15.040283203124998, 38.30286995515004], [15.040283203124998, 39.03625295963659], [13.634033203125002, 39.03625295963659]], [[14.920806884765623, 38.52023522875919], [14.920806884765623, 38.51916077398036], [14.915313720703123, 38.51916077398036], [14.915313720703123, 38.51701181630737], [14.912567138671875, 38.51701181630737], [14.912567138671875, 38.51593731341349], [14.911193847656252, 38.51593731341349], [14.911193847656252, 38.51486279448153], [14.909820556640625, 38.51486279448153], [14.909820556640625, 38.51378825951165], [14.908447265625, 38.51378825951165], [14.908447265625, 38.51271370850396], [14.907073974609373, 38.51271370850396], [14.907073974609373, 38.511639141458616], [14.905700683593748, 38.511639141458616], [14.905700683593748, 38.50841534409805], [14.904327392578125, 38.50841534409805], [14.904327392578125, 38.498743086027794], [14.9029541015625, 38.498743086027794], [14.9029541015625, 38.49229419236133], [14.901580810546873, 38.49229419236133], [14.901580810546873, 38.490144432857555], [14.900207519531248, 38.490144432857555], [14.900207519531248, 38.47724452895559], [14.901580810546873, 38.47724452895559], [14.901580810546873, 38.47509432050244], [14.9029541015625, 38.47509432050244], [14.9029541015625, 38.47401919222662], [14.904327392578125, 38.47401919222662], [14.904327392578125, 38.47186888757716], [14.905700683593748, 38.47186888757716], [14.905700683593748, 38.46971851879821], [14.907073974609373, 38.46971851879821], [14.907073974609373, 38.46864331036053], [14.908447265625, 38.46864331036053], [14.908447265625, 38.46756808589088], [14.909820556640625, 38.46756808589088], [14.909820556640625, 38.466492845389425], [14.911193847656252, 38.466492845389425], [14.911193847656252, 38.465417588856305], [14.912567138671875, 38.465417588856305], [14.912567138671875, 38.46434231629164], [14.913940429687496, 38.46434231629164], [14.913940429687496, 38.463267027695586], [14.91668701171875, 38.463267027695586], [14.91668701171875, 38.46219172306828], [14.920806884765623, 38.46219172306828], [14.920806884765623, 38.46111640240985], [14.923553466796873, 38.46111640240985], [14.923553466796873, 38.46004106572045], [14.92767333984375, 38.46004106572045], [14.92767333984375, 38.458965713000204], [14.930419921874998, 38.458965713000204], [14.930419921874998, 38.45789034424927], [14.931793212890625, 38.45789034424927], [14.931793212890625, 38.456814959467785], [14.93316650390625, 38.456814959467785], [14.93316650390625, 38.4546641418137], [14.934539794921873, 38.4546641418137], [14.934539794921873, 38.453588708941375], [14.9359130859375, 38.453588708941375], [14.9359130859375, 38.45251326003907], [14.937286376953121, 38.45251326003907], [14.937286376953121, 38.4514377951069], [14.940032958984375, 38.4514377951069], [14.940032958984375, 38.450362314145], [14.942779541015623, 38.450362314145], [14.942779541015623, 38.447135775082444], [14.944152832031248, 38.447135775082444], [14.944152832031248, 38.44175788939692], [14.945526123046875, 38.44175788939692], [14.945526123046875, 38.44068226417388], [14.9468994140625, 38.44068226417388], [14.9468994140625, 38.43960662292253], [14.948272705078123, 38.43960662292253], [14.948272705078123, 38.438530965643004], [14.951019287109371, 38.438530965643004], [14.951019287109371, 38.43960662292253], [14.953765869140623, 38.43960662292253], [14.953765869140623, 38.44068226417388], [14.95513916015625, 38.44068226417388], [14.95513916015625, 38.44175788939692], [14.956512451171873, 38.44175788939692], [14.956512451171873, 38.4428334985915], [14.95513916015625, 38.4428334985915], [14.95513916015625, 38.444984668894726], [14.953765869140623, 38.444984668894726], [14.953765869140623, 38.447135775082444], [14.952392578124998, 38.447135775082444], [14.952392578124998, 38.450362314145], [14.953765869140623, 38.450362314145], [14.953765869140623, 38.4514377951069], [14.957885742187498, 38.4514377951069], [14.957885742187498, 38.45251326003907], [14.96063232421875, 38.45251326003907], [14.96063232421875, 38.456814959467785], [14.959259033203125, 38.456814959467785], [14.959259033203125, 38.458965713000204], [14.957885742187498, 38.458965713000204], [14.957885742187498, 38.46004106572045], [14.959259033203125, 38.46004106572045], [14.959259033203125, 38.46111640240985], [14.96063232421875, 38.46111640240985], [14.96063232421875, 38.46219172306828], [14.962005615234373, 38.46219172306828], [14.962005615234373, 38.465417588856305], [14.96337890625, 38.465417588856305], [14.96337890625, 38.46864331036053], [14.964752197265625, 38.46864331036053], [14.964752197265625, 38.46971851879821], [14.966125488281248, 38.46971851879821], [14.966125488281248, 38.4707937112038], [14.967498779296873, 38.4707937112038], [14.967498779296873, 38.47186888757716], [14.9688720703125, 38.47186888757716], [14.9688720703125, 38.47401919222662], [14.971618652343748, 38.47401919222662], [14.971618652343748, 38.47509432050244], [14.972991943359375, 38.47509432050244], [14.972991943359375, 38.47616943274548], [14.97711181640625, 38.47616943274548], [14.97711181640625, 38.479394673276445], [14.978485107421875, 38.479394673276445], [14.978485107421875, 38.48046972138692], [14.97711181640625, 38.48046972138692], [14.97711181640625, 38.4815447534639], [14.975738525390623, 38.4815447534639], [14.975738525390623, 38.48261976950727], [14.972991943359375, 38.48261976950727], [14.972991943359375, 38.48369476951686], [14.964752197265625, 38.48369476951686], [14.964752197265625, 38.485844721434205], [14.96337890625, 38.485844721434205], [14.96337890625, 38.490144432857555], [14.962005615234373, 38.490144432857555], [14.962005615234373, 38.49766831050554], [14.96063232421875, 38.49766831050554], [14.96063232421875, 38.5030420277569], [14.959259033203125, 38.5030420277569], [14.959259033203125, 38.500892588964604], [14.957885742187498, 38.500892588964604], [14.957885742187498, 38.49659351894757], [14.956512451171873, 38.49659351894757], [14.956512451171873, 38.49551871135403], [14.95513916015625, 38.49551871135403], [14.95513916015625, 38.49659351894757], [14.953765869140623, 38.49659351894757], [14.953765869140623, 38.50626606567192], [14.952392578124998, 38.50626606567192], [14.952392578124998, 38.50734071290346], [14.953765869140623, 38.50734071290346], [14.953765869140623, 38.51271370850396], [14.952392578124998, 38.51271370850396], [14.952392578124998, 38.51916077398036], [14.951019287109371, 38.51916077398036], [14.951019287109371, 38.52023522875919], [14.948272705078123, 38.52023522875919], [14.948272705078123, 38.51916077398036], [14.931793212890625, 38.51916077398036], [14.931793212890625, 38.52023522875919], [14.920806884765623, 38.52023522875919]]]}}]}\", \"n_shapes_geojson\": 2, \"duration_run\": 7.334042072296143, \"message\": \"ok\", \"request_id\": \"test_invoke_id\"}",
|
64 |
"isBase64Encoded": false
|
65 |
}
|
66 |
}
|
|
|
60 |
"header": {
|
61 |
"Content-Type": "application/json"
|
62 |
},
|
63 |
+
"body": "{\"n_predictions\": 1, \"geojson\": \"{\\\"type\\\": \\\"FeatureCollection\\\", \\\"features\\\": [{\\\"id\\\": \\\"0\\\", \\\"type\\\": \\\"Feature\\\", \\\"properties\\\": {\\\"raster_val\\\": 255.0}, \\\"geometry\\\": {\\\"type\\\": \\\"Polygon\\\", \\\"coordinates\\\": [[[14.91874694824219, 38.52077245013413], [14.932479858398436, 38.52077245013413], [14.932479858398436, 38.5196980033746], [14.947586059570312, 38.5196980033746], [14.947586059570312, 38.52077245013413], [14.955825805664064, 38.52077245013413], [14.955825805664064, 38.5196980033746], [14.957199096679688, 38.5196980033746], [14.957199096679688, 38.518623540576506], [14.958572387695312, 38.518623540576506], [14.958572387695312, 38.515400055952256], [14.959945678710936, 38.515400055952256], [14.959945678710936, 38.51110185192187], [14.961318969726562, 38.51110185192187], [14.961318969726562, 38.49713091673101], [14.962692260742188, 38.49713091673101], [14.962692260742188, 38.491756758498475], [14.964065551757814, 38.491756758498475], [14.964065551757814, 38.48960698295985], [14.965438842773436, 38.48960698295985], [14.965438842773436, 38.48638219939222], [14.966812133789062, 38.48638219939222], [14.966812133789062, 38.48423226350896], [14.975051879882812, 38.48423226350896], [14.975051879882812, 38.483157271516305], [14.976425170898438, 38.483157271516305], [14.976425170898438, 38.4820822634898], [14.977798461914064, 38.4820822634898], [14.977798461914064, 38.48100723942961], [14.97917175292969, 38.48100723942961], [14.97917175292969, 38.479932199335856], [14.977798461914064, 38.479932199335856], [14.977798461914064, 38.47778207104824], [14.976425170898438, 38.47778207104824], [14.976425170898438, 38.47670698285466], [14.975051879882812, 38.47670698285466], [14.975051879882812, 38.47563187862807], [14.972305297851562, 38.47563187862807], [14.972305297851562, 38.474556758368635], [14.970932006835938, 38.474556758368635], [14.970932006835938, 38.47240646975171], [14.969558715820314, 38.47240646975171], [14.969558715820314, 38.46810570012969], [14.96818542480469, 38.46810570012969], [14.96818542480469, 38.46703046764413], [14.965438842773436, 38.46703046764413], [14.965438842773436, 38.465955219126826], [14.964065551757814, 38.465955219126826], [14.964065551757814, 38.46487995457791], [14.962692260742188, 38.46487995457791], [14.962692260742188, 38.46380467399753], [14.961318969726562, 38.46380467399753], [14.961318969726562, 38.46272937738583], [14.959945678710936, 38.46272937738583], [14.959945678710936, 38.461654064742945], [14.958572387695312, 38.461654064742945], [14.958572387695312, 38.458428030628575], [14.959945678710936, 38.458428030628575], [14.959945678710936, 38.45627726106563], [14.961318969726562, 38.45627726106563], [14.961318969726562, 38.45305098649397], [14.959945678710936, 38.45305098649397], [14.959945678710936, 38.4519755295767], [14.958572387695312, 38.4519755295767], [14.958572387695312, 38.45090005662966], [14.957199096679688, 38.45090005662966], [14.957199096679688, 38.44122007878895], [14.955825805664064, 38.44122007878895], [14.955825805664064, 38.440144445551745], [14.947586059570312, 38.440144445551745], [14.947586059570312, 38.44122007878895], [14.944839477539064, 38.44122007878895], [14.944839477539064, 38.4444468823297], [14.943466186523438, 38.4444468823297], [14.943466186523438, 38.447673541611195], [14.942092895507814, 38.447673541611195], [14.942092895507814, 38.44982456765297], [14.939346313476562, 38.44982456765297], [14.939346313476562, 38.45090005662966], [14.937973022460938, 38.45090005662966], [14.937973022460938, 38.4519755295767], [14.936599731445314, 38.4519755295767], [14.936599731445314, 38.45305098649397], [14.935226440429688, 38.45305098649397], [14.935226440429688, 38.454126427381304], [14.933853149414062, 38.454126427381304], [14.933853149414062, 38.45627726106563], [14.932479858398436, 38.45627726106563], [14.932479858398436, 38.45735265386235], [14.931106567382814, 38.45735265386235], [14.931106567382814, 38.458428030628575], [14.929733276367188, 38.458428030628575], [14.929733276367188, 38.45950339136418], [14.92698669433594, 38.45950339136418], [14.92698669433594, 38.46057873606902], [14.924240112304688, 38.46057873606902], [14.924240112304688, 38.461654064742945], [14.920120239257812, 38.461654064742945], [14.920120239257812, 38.46272937738583], [14.917373657226564, 38.46272937738583], [14.917373657226564, 38.46380467399753], [14.914627075195312, 38.46380467399753], [14.914627075195312, 38.46487995457791], [14.911880493164062, 38.46487995457791], [14.911880493164062, 38.465955219126826], [14.910507202148438, 38.465955219126826], [14.910507202148438, 38.46703046764413], [14.90913391113281, 38.46703046764413], [14.90913391113281, 38.46810570012969], [14.90776062011719, 38.46810570012969], [14.90776062011719, 38.469180916583376], [14.906387329101562, 38.469180916583376], [14.906387329101562, 38.471331301394514], [14.90501403808594, 38.471331301394514], [14.90501403808594, 38.47240646975171], [14.903640747070314, 38.47240646975171], [14.903640747070314, 38.474556758368635], [14.902267456054688, 38.474556758368635], [14.902267456054688, 38.47563187862807], [14.900894165039062, 38.47563187862807], [14.900894165039062, 38.47778207104824], [14.89952087402344, 38.47778207104824], [14.89952087402344, 38.491756758498475], [14.900894165039062, 38.491756758498475], [14.900894165039062, 38.49390646989732], [14.902267456054688, 38.49390646989732], [14.902267456054688, 38.498205700271136], [14.903640747070314, 38.498205700271136], [14.903640747070314, 38.50787803050539], [14.90501403808594, 38.50787803050539], [14.90501403808594, 38.51110185192187], [14.906387329101562, 38.51110185192187], [14.906387329101562, 38.51325098601252], [14.90776062011719, 38.51325098601252], [14.90776062011719, 38.515400055952256], [14.90913391113281, 38.515400055952256], [14.90913391113281, 38.5164745668652], [14.910507202148438, 38.5164745668652], [14.910507202148438, 38.51754906173999], [14.911880493164062, 38.51754906173999], [14.911880493164062, 38.518623540576506], [14.914627075195312, 38.518623540576506], [14.914627075195312, 38.5196980033746], [14.91874694824219, 38.5196980033746], [14.91874694824219, 38.52077245013413]]]}}, {\\\"id\\\": \\\"1\\\", \\\"type\\\": \\\"Feature\\\", \\\"properties\\\": {\\\"raster_val\\\": 255.0}, \\\"geometry\\\": {\\\"type\\\": \\\"Polygon\\\", \\\"coordinates\\\": [[[14.950332641601564, 38.42078030658811], [14.950332641601564, 38.41970436883825], [14.951705932617188, 38.41970436883825], [14.951705932617188, 38.42078030658811], [14.950332641601564, 38.42078030658811]]]}}, {\\\"id\\\": \\\"2\\\", \\\"type\\\": \\\"Feature\\\", \\\"properties\\\": {\\\"raster_val\\\": 0.0}, \\\"geometry\\\": {\\\"type\\\": \\\"Polygon\\\", \\\"coordinates\\\": [[[13.633346557617188, 39.03678630788351], [13.633346557617188, 38.30233111129678], [15.040969848632812, 38.30233111129678], [15.040969848632812, 39.03678630788351], [13.633346557617188, 39.03678630788351]], [[14.91874694824219, 38.52077245013413], [14.91874694824219, 38.5196980033746], [14.914627075195312, 38.5196980033746], [14.914627075195312, 38.518623540576506], [14.911880493164062, 38.518623540576506], [14.911880493164062, 38.51754906173999], [14.910507202148438, 38.51754906173999], [14.910507202148438, 38.5164745668652], [14.90913391113281, 38.5164745668652], [14.90913391113281, 38.515400055952256], [14.90776062011719, 38.515400055952256], [14.90776062011719, 38.51325098601252], [14.906387329101562, 38.51325098601252], [14.906387329101562, 38.51110185192187], [14.90501403808594, 38.51110185192187], [14.90501403808594, 38.50787803050539], [14.903640747070314, 38.50787803050539], [14.903640747070314, 38.498205700271136], [14.902267456054688, 38.498205700271136], [14.902267456054688, 38.49390646989732], [14.900894165039062, 38.49390646989732], [14.900894165039062, 38.491756758498475], [14.89952087402344, 38.491756758498475], [14.89952087402344, 38.47778207104824], [14.900894165039062, 38.47778207104824], [14.900894165039062, 38.47563187862807], [14.902267456054688, 38.47563187862807], [14.902267456054688, 38.474556758368635], [14.903640747070314, 38.474556758368635], [14.903640747070314, 38.47240646975171], [14.90501403808594, 38.47240646975171], [14.90501403808594, 38.471331301394514], [14.906387329101562, 38.471331301394514], [14.906387329101562, 38.469180916583376], [14.90776062011719, 38.469180916583376], [14.90776062011719, 38.46810570012969], [14.90913391113281, 38.46810570012969], [14.90913391113281, 38.46703046764413], [14.910507202148438, 38.46703046764413], [14.910507202148438, 38.465955219126826], [14.911880493164062, 38.465955219126826], [14.911880493164062, 38.46487995457791], [14.914627075195312, 38.46487995457791], [14.914627075195312, 38.46380467399753], [14.917373657226564, 38.46380467399753], [14.917373657226564, 38.46272937738583], [14.920120239257812, 38.46272937738583], [14.920120239257812, 38.461654064742945], [14.924240112304688, 38.461654064742945], [14.924240112304688, 38.46057873606902], [14.92698669433594, 38.46057873606902], [14.92698669433594, 38.45950339136418], [14.929733276367188, 38.45950339136418], [14.929733276367188, 38.458428030628575], [14.931106567382814, 38.458428030628575], [14.931106567382814, 38.45735265386235], [14.932479858398436, 38.45735265386235], [14.932479858398436, 38.45627726106563], [14.933853149414062, 38.45627726106563], [14.933853149414062, 38.454126427381304], [14.935226440429688, 38.454126427381304], [14.935226440429688, 38.45305098649397], [14.936599731445314, 38.45305098649397], [14.936599731445314, 38.4519755295767], [14.937973022460938, 38.4519755295767], [14.937973022460938, 38.45090005662966], [14.939346313476562, 38.45090005662966], [14.939346313476562, 38.44982456765297], [14.942092895507814, 38.44982456765297], [14.942092895507814, 38.447673541611195], [14.943466186523438, 38.447673541611195], [14.943466186523438, 38.4444468823297], [14.944839477539064, 38.4444468823297], [14.944839477539064, 38.44122007878895], [14.947586059570312, 38.44122007878895], [14.947586059570312, 38.440144445551745], [14.955825805664064, 38.440144445551745], [14.955825805664064, 38.44122007878895], [14.957199096679688, 38.44122007878895], [14.957199096679688, 38.45090005662966], [14.958572387695312, 38.45090005662966], [14.958572387695312, 38.4519755295767], [14.959945678710936, 38.4519755295767], [14.959945678710936, 38.45305098649397], [14.961318969726562, 38.45305098649397], [14.961318969726562, 38.45627726106563], [14.959945678710936, 38.45627726106563], [14.959945678710936, 38.458428030628575], [14.958572387695312, 38.458428030628575], [14.958572387695312, 38.461654064742945], [14.959945678710936, 38.461654064742945], [14.959945678710936, 38.46272937738583], [14.961318969726562, 38.46272937738583], [14.961318969726562, 38.46380467399753], [14.962692260742188, 38.46380467399753], [14.962692260742188, 38.46487995457791], [14.964065551757814, 38.46487995457791], [14.964065551757814, 38.465955219126826], [14.965438842773436, 38.465955219126826], [14.965438842773436, 38.46703046764413], [14.96818542480469, 38.46703046764413], [14.96818542480469, 38.46810570012969], [14.969558715820314, 38.46810570012969], [14.969558715820314, 38.47240646975171], [14.970932006835938, 38.47240646975171], [14.970932006835938, 38.474556758368635], [14.972305297851562, 38.474556758368635], [14.972305297851562, 38.47563187862807], [14.975051879882812, 38.47563187862807], [14.975051879882812, 38.47670698285466], [14.976425170898438, 38.47670698285466], [14.976425170898438, 38.47778207104824], [14.977798461914064, 38.47778207104824], [14.977798461914064, 38.479932199335856], [14.97917175292969, 38.479932199335856], [14.97917175292969, 38.48100723942961], [14.977798461914064, 38.48100723942961], [14.977798461914064, 38.4820822634898], [14.976425170898438, 38.4820822634898], [14.976425170898438, 38.483157271516305], [14.975051879882812, 38.483157271516305], [14.975051879882812, 38.48423226350896], [14.966812133789062, 38.48423226350896], [14.966812133789062, 38.48638219939222], [14.965438842773436, 38.48638219939222], [14.965438842773436, 38.48960698295985], [14.964065551757814, 38.48960698295985], [14.964065551757814, 38.491756758498475], [14.962692260742188, 38.491756758498475], [14.962692260742188, 38.49713091673101], [14.961318969726562, 38.49713091673101], [14.961318969726562, 38.51110185192187], [14.959945678710936, 38.51110185192187], [14.959945678710936, 38.515400055952256], [14.958572387695312, 38.515400055952256], [14.958572387695312, 38.518623540576506], [14.957199096679688, 38.518623540576506], [14.957199096679688, 38.5196980033746], [14.955825805664064, 38.5196980033746], [14.955825805664064, 38.52077245013413], [14.947586059570312, 38.52077245013413], [14.947586059570312, 38.5196980033746], [14.932479858398436, 38.5196980033746], [14.932479858398436, 38.52077245013413], [14.91874694824219, 38.52077245013413]], [[14.950332641601564, 38.42078030658811], [14.950332641601564, 38.41970436883825], [14.951705932617188, 38.41970436883825], [14.951705932617188, 38.42078030658811], [14.950332641601564, 38.42078030658811]]]}}]}\", \"n_shapes_geojson\": 3, \"duration_run\": 13.540923118591309, \"message\": \"ok\", \"request_id\": \"test_invoke_id\"}",
|
64 |
"isBase64Encoded": false
|
65 |
}
|
66 |
}
|
tests/io/test_geo_helpers.py
CHANGED
@@ -63,6 +63,7 @@ class TestGeoHelpers(unittest.TestCase):
|
|
63 |
raise e
|
64 |
|
65 |
def test_get_vectorized_raster_as_geojson_ok(self):
|
|
|
66 |
from src.io.geo_helpers import get_vectorized_raster_as_geojson
|
67 |
|
68 |
name_fn = "samexporter_predict"
|
@@ -73,7 +74,8 @@ class TestGeoHelpers(unittest.TestCase):
|
|
73 |
print(f"k:{k}.")
|
74 |
mask = np.load(TEST_EVENTS_FOLDER / name_fn / k / "mask.npy")
|
75 |
|
76 |
-
|
|
|
77 |
assert output["n_shapes_geojson"] == input_output["output"]["n_shapes_geojson"]
|
78 |
output_geojson = shapely.from_geojson(output["geojson"])
|
79 |
expected_output_geojson = shapely.from_geojson(input_output["output"]["geojson"])
|
@@ -92,12 +94,11 @@ class TestGeoHelpers(unittest.TestCase):
|
|
92 |
|
93 |
# Could be also another generic Exception, here we intercept TypeError caused by wrong matrix input on
|
94 |
# rasterio.Affine.from_gdal() wrapped by get_affine_transform_from_gdal()
|
95 |
-
with self.assertRaises(
|
96 |
try:
|
97 |
wrong_matrix = 1.0,
|
98 |
-
get_vectorized_raster_as_geojson(mask=mask,
|
99 |
-
except
|
100 |
print(f"te:{te}.")
|
101 |
-
|
102 |
-
self.assertEqual(str(te), msg)
|
103 |
raise te
|
|
|
63 |
raise e
|
64 |
|
65 |
def test_get_vectorized_raster_as_geojson_ok(self):
|
66 |
+
from rasterio.transform import Affine
|
67 |
from src.io.geo_helpers import get_vectorized_raster_as_geojson
|
68 |
|
69 |
name_fn = "samexporter_predict"
|
|
|
74 |
print(f"k:{k}.")
|
75 |
mask = np.load(TEST_EVENTS_FOLDER / name_fn / k / "mask.npy")
|
76 |
|
77 |
+
transform = Affine.from_gdal(*input_output["input"]["matrix"])
|
78 |
+
output = get_vectorized_raster_as_geojson(mask=mask, transform=transform)
|
79 |
assert output["n_shapes_geojson"] == input_output["output"]["n_shapes_geojson"]
|
80 |
output_geojson = shapely.from_geojson(output["geojson"])
|
81 |
expected_output_geojson = shapely.from_geojson(input_output["output"]["geojson"])
|
|
|
94 |
|
95 |
# Could be also another generic Exception, here we intercept TypeError caused by wrong matrix input on
|
96 |
# rasterio.Affine.from_gdal() wrapped by get_affine_transform_from_gdal()
|
97 |
+
with self.assertRaises(IndexError):
|
98 |
try:
|
99 |
wrong_matrix = 1.0,
|
100 |
+
get_vectorized_raster_as_geojson(mask=mask, transform=wrong_matrix)
|
101 |
+
except IndexError as te:
|
102 |
print(f"te:{te}.")
|
103 |
+
self.assertEqual(str(te), 'tuple index out of range')
|
|
|
104 |
raise te
|
tests/io/test_tms2geotiff.py
CHANGED
@@ -7,12 +7,12 @@ from src.io.tms2geotiff import download_extent
|
|
7 |
from src.utilities.utilities import hash_calculate
|
8 |
from tests import LOCAL_URL_TILE, TEST_EVENTS_FOLDER
|
9 |
|
10 |
-
|
11 |
input_bbox = [[39.036252959636606, 15.040283203125002], [38.302869955150044, 13.634033203125002]]
|
12 |
|
13 |
|
14 |
class TestTms2geotiff(unittest.TestCase):
|
15 |
def test_download_extent(self):
|
|
|
16 |
from tests.local_tiles_http_server import LocalTilesHttpServer
|
17 |
|
18 |
listen_port = 8000
|
@@ -20,25 +20,35 @@ class TestTms2geotiff(unittest.TestCase):
|
|
20 |
with LocalTilesHttpServer.http_server("localhost", listen_port, directory=TEST_EVENTS_FOLDER):
|
21 |
pt0, pt1 = input_bbox
|
22 |
zoom = 10
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
|
|
28 |
output_hash = hash_calculate(np_img)
|
29 |
-
assert output_hash == b'
|
30 |
-
assert matrix == (
|
|
|
31 |
|
32 |
def test_download_extent_io_error1(self):
|
33 |
|
34 |
-
with self.assertRaises(
|
35 |
try:
|
36 |
pt0, pt1 = input_bbox
|
37 |
zoom = 10
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
42 |
app_logger.error(f"ioe1:{ioe1}.")
|
43 |
msg0 = "HTTPConnectionPool(host='localhost', port=8000): Max retries exceeded with url: /lambda_handler"
|
44 |
msg1 = "Caused by NewConnectionError"
|
@@ -49,6 +59,7 @@ class TestTms2geotiff(unittest.TestCase):
|
|
49 |
raise ioe1
|
50 |
|
51 |
def test_download_extent_io_error2(self):
|
|
|
52 |
from tests.local_tiles_http_server import LocalTilesHttpServer
|
53 |
|
54 |
listen_port = 8000
|
@@ -56,13 +67,16 @@ class TestTms2geotiff(unittest.TestCase):
|
|
56 |
pt0, pt1 = input_bbox
|
57 |
zoom = 10
|
58 |
|
59 |
-
with self.assertRaises(
|
60 |
try:
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
|
7 |
from src.utilities.utilities import hash_calculate
|
8 |
from tests import LOCAL_URL_TILE, TEST_EVENTS_FOLDER
|
9 |
|
|
|
10 |
input_bbox = [[39.036252959636606, 15.040283203125002], [38.302869955150044, 13.634033203125002]]
|
11 |
|
12 |
|
13 |
class TestTms2geotiff(unittest.TestCase):
|
14 |
def test_download_extent(self):
|
15 |
+
from rasterio import Affine
|
16 |
from tests.local_tiles_http_server import LocalTilesHttpServer
|
17 |
|
18 |
listen_port = 8000
|
|
|
20 |
with LocalTilesHttpServer.http_server("localhost", listen_port, directory=TEST_EVENTS_FOLDER):
|
21 |
pt0, pt1 = input_bbox
|
22 |
zoom = 10
|
23 |
+
|
24 |
+
n_lat = pt0[0]
|
25 |
+
e_lng = pt0[1]
|
26 |
+
s_lat = pt1[0]
|
27 |
+
w_lng = pt1[1]
|
28 |
+
|
29 |
+
img, matrix = download_extent(w=w_lng, s=s_lat, e=e_lng, n=n_lat, zoom=zoom, source=LOCAL_URL_TILE)
|
30 |
+
app_logger.info(f"# DOWNLOAD ENDED, shape: {img.shape} #")
|
31 |
+
np_img = np.ascontiguousarray(img)
|
32 |
output_hash = hash_calculate(np_img)
|
33 |
+
assert output_hash == b'UmbkwbPJpRT1XXcLnLUapUDP320w7YhS/AmT3H7u+b4='
|
34 |
+
assert Affine.to_gdal(matrix) == (
|
35 |
+
1517657.1966021745, 152.8740565703525, 0.0, 4726942.266183584, 0.0, -152.87405657034955)
|
36 |
|
37 |
def test_download_extent_io_error1(self):
|
38 |
|
39 |
+
with self.assertRaises(Exception):
|
40 |
try:
|
41 |
pt0, pt1 = input_bbox
|
42 |
zoom = 10
|
43 |
+
|
44 |
+
n_lat = pt0[0]
|
45 |
+
e_lng = pt0[1]
|
46 |
+
s_lat = pt1[0]
|
47 |
+
w_lng = pt1[1]
|
48 |
+
|
49 |
+
download_extent(w=w_lng, s=s_lat, e=e_lng, n=n_lat, zoom=zoom, source=f"http://{LOCAL_URL_TILE}")
|
50 |
+
print("exception not raised")
|
51 |
+
except ConnectionError as ioe1:
|
52 |
app_logger.error(f"ioe1:{ioe1}.")
|
53 |
msg0 = "HTTPConnectionPool(host='localhost', port=8000): Max retries exceeded with url: /lambda_handler"
|
54 |
msg1 = "Caused by NewConnectionError"
|
|
|
59 |
raise ioe1
|
60 |
|
61 |
def test_download_extent_io_error2(self):
|
62 |
+
from requests import HTTPError
|
63 |
from tests.local_tiles_http_server import LocalTilesHttpServer
|
64 |
|
65 |
listen_port = 8000
|
|
|
67 |
pt0, pt1 = input_bbox
|
68 |
zoom = 10
|
69 |
|
70 |
+
with self.assertRaises(HTTPError):
|
71 |
try:
|
72 |
+
n_lat = pt0[0]
|
73 |
+
e_lng = pt0[1]
|
74 |
+
s_lat = pt1[0]
|
75 |
+
w_lng = pt1[1]
|
76 |
+
|
77 |
+
download_extent(w=w_lng, s=s_lat, e=e_lng, n=n_lat, zoom=zoom,
|
78 |
+
source=LOCAL_URL_TILE + "_not_found_raster!")
|
79 |
+
except HTTPError as http_e:
|
80 |
+
app_logger.error(f"ae:{http_e}.")
|
81 |
+
assert "Tile URL resulted in a 404 error. Double-check your tile url:" in str(http_e)
|
82 |
+
raise http_e
|
tests/prediction_api/test_predictors.py
CHANGED
@@ -2,7 +2,6 @@ import json
|
|
2 |
from unittest.mock import patch
|
3 |
|
4 |
import numpy as np
|
5 |
-
import rasterio
|
6 |
|
7 |
from src.prediction_api import predictors
|
8 |
from src.prediction_api.predictors import get_raster_inference, samexporter_predict
|
@@ -43,9 +42,7 @@ def test_get_raster_inference(segment_anything_onnx_mocked):
|
|
43 |
@patch.object(predictors, "SegmentAnythingONNX")
|
44 |
@patch.object(predictors, "download_extent")
|
45 |
@patch.object(predictors, "get_vectorized_raster_as_geojson")
|
46 |
-
@patch.object(predictors, "get_affine_transform_from_gdal")
|
47 |
def test_samexporter_predict(
|
48 |
-
get_affine_transform_from_gdal_mocked,
|
49 |
get_vectorized_raster_as_geojson_mocked,
|
50 |
download_extent_mocked,
|
51 |
segment_anything_onnx_mocked,
|
@@ -61,7 +58,6 @@ def test_samexporter_predict(
|
|
61 |
aff = 1, 2, 3, 4, 5, 6
|
62 |
segment_anything_onnx_mocked.return_value = "SegmentAnythingONNX_instance"
|
63 |
download_extent_mocked.return_value = np.zeros((10, 10)), aff
|
64 |
-
get_affine_transform_from_gdal_mocked.return_value = rasterio.Affine.from_gdal(*aff)
|
65 |
get_raster_inference_mocked.return_value = np.ones((10, 10)), 1
|
66 |
get_vectorized_raster_as_geojson_mocked.return_value = {"geojson": "{}", "n_shapes_geojson": 2}
|
67 |
output = samexporter_predict(bbox=[[1, 2], [3, 4]], prompt=[{}], zoom=10, model_name="fastsam")
|
|
|
2 |
from unittest.mock import patch
|
3 |
|
4 |
import numpy as np
|
|
|
5 |
|
6 |
from src.prediction_api import predictors
|
7 |
from src.prediction_api.predictors import get_raster_inference, samexporter_predict
|
|
|
42 |
@patch.object(predictors, "SegmentAnythingONNX")
|
43 |
@patch.object(predictors, "download_extent")
|
44 |
@patch.object(predictors, "get_vectorized_raster_as_geojson")
|
|
|
45 |
def test_samexporter_predict(
|
|
|
46 |
get_vectorized_raster_as_geojson_mocked,
|
47 |
download_extent_mocked,
|
48 |
segment_anything_onnx_mocked,
|
|
|
58 |
aff = 1, 2, 3, 4, 5, 6
|
59 |
segment_anything_onnx_mocked.return_value = "SegmentAnythingONNX_instance"
|
60 |
download_extent_mocked.return_value = np.zeros((10, 10)), aff
|
|
|
61 |
get_raster_inference_mocked.return_value = np.ones((10, 10)), 1
|
62 |
get_vectorized_raster_as_geojson_mocked.return_value = {"geojson": "{}", "n_shapes_geojson": 2}
|
63 |
output = samexporter_predict(bbox=[[1, 2], [3, 4]], prompt=[{}], zoom=10, model_name="fastsam")
|