openskope / skope-interface

The new SKOPE web portal interface.
https://www.openskope.org
4 stars 2 forks source link

Polygons that resembles straight lines cause issues #204

Open Zodiase opened 6 years ago

Zodiase commented 6 years ago

From @kintigh:

In graph view, you get a data a Error when requesting the data: error if you select what amounts to a horizontal or vertical line.

The same happens to spatial filtering in Discover tab.

Perhaps for polygons points can't be on the same line or same points?

Example:

{
  focusGeometry: {
    type: 'Polygon',
    coordinates: [
      [
        [
          -109.6650114215935,
          37.77750373436488
        ],
        [
          -108.51433717593282,
          37.77750373436488
        ],
        [
          -108.51433717593282,
          37.77750373436488
        ],
        [
          -109.6650114215935,
          37.77750373436488
        ],
        [
          -109.6650114215935,
          37.77750373436488
        ]
      ]
    ]
  }
}

Error message from time-series service:

failed [400] {"timestamp":1527269593998,"status":400,"error":"Bad Request","exception":"org.openskope.timeseries.controller.InvalidArgumentException","message":"Traceback (most recent call last):\n  File \"/usr/local/bin/zonalinfo.py\", line 149, in <module>\n    main()\n  File \"/usr/local/bin/zonalinfo.py\", line 118, in main\n    masked, transform, window = raster_geometry_mask(src, geoms, crop=True, all_touched=True)\n  File \"/usr/local/lib/python2.7/dist-packages/rasterio/mask.py\", line 105, in raster...

Error message from ES:

{"error":{"root_cause":[{"type":"query_shard_exception","reason":"failed to create query: {\n  \"bool\" : {\n    \"filter\" : [\n      {\n        \"geo_shape\" : {\n          \"region.geometry\" : {\n            \"shape\" : {\n              \"type\" : \"polygon\",\n              \"orientation\" : \"right\",\n              \"coordinates\" : [\n                [\n                  [\n                    -105.78666687011719,\n                    39.64210510253906\n                  ],\n                  [\n                    -97.46246337890625,\n                    39.64210510253906\n                  ],\n                  [\n                    -97.46246337890625,\n                    39.64210510253906\n                  ],\n                  [\n                    -105.78666687011719,\n                    39.64210510253906\n                  ],\n                  [\n                    -105.78666687011719,\n                    39.64210510253906\n                  ]\n                ]\n              ]\n            },\n            \"relation\" : \"intersects\"\n          },\n          \"ignore_unmapped\" : false,\n          \"boost\" : 1.0\n        }\n      }\n    ],\n    \"adjust_pure_negative\" : true,\n    \"boost\" : 1.0\n  }\n}","index_uuid":"vXJCfc6ETnythiMgoPRmCA","index":"datasets"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"datasets","node":"0xA8ufirQ6SMJc7LgnbcJw","reason":{"type":"query_shard_exception","reason":"failed to create query: {\n  \"bool\" : {\n    \"filter\" : [\n      {\n        \"geo_shape\" : {\n          \"region.geometry\" : {\n            \"shape\" : {\n              \"type\" : \"polygon\",\n              \"orientation\" : \"right\",\n              \"coordinates\" : [\n                [\n                  [\n                    -105.78666687011719,\n                    39.64210510253906\n                  ],\n                  [\n                    -97.46246337890625,\n                    39.64210510253906\n                  ],\n                  [\n                    -97.46246337890625,\n                    39.64210510253906\n                  ],\n                  [\n                    -105.78666687011719,\n                    39.64210510253906\n                  ],\n                  [\n                    -105.78666687011719,\n                    39.64210510253906\n                  ]\n                ]\n              ]\n            },\n            \"relation\" : \"intersects\"\n          },\n          \"ignore_unmapped\" : false,\n          \"boost\" : 1.0\n        }\n      }\n    ],\n    \"adjust_pure_negative\" : true,\n    \"boost\" : 1.0\n  }\n}","index_uuid":"vXJCfc6ETnythiMgoPRmCA","index":"datasets","caused_by":{"type":"invalid_shape_exception","reason":"Provided shape has duplicate consecutive coordinates at: (-97.46246337890625, 39.64210510253906, NaN)"}}}]},"status":400}

image

kintigh commented 6 years ago

As you suggest, we could have a box drawing constraint that the diagonal corners can't have the same east or north coordinates. Or, if you just want to trap zero areas and give a better message that is fine.