AtlasOfLivingAustralia / spatial-hub

New spatial portal front end using AngularJS
https://spatial.ala.org.au/
7 stars 16 forks source link

Error when creating area with WKT #426

Closed timhicks-ala closed 1 year ago

timhicks-ala commented 2 years ago

Issue raised in https://support.ehelp.edu.au/a/tickets/118264

  1. Take this sample WKT: POLYGON((141.447222 -38.353333, 141.921389 -38.373611, 142.011111 -38.487778, 141.883333 -38.570556, 141.659444 -38.491667))

  2. This creates a valid search area in Biocache spatial search, so is definitely valid: https://biocache.ala.org.au/occurrences/search?q=*%3A*&qc=&wkt=MULTIPOLYGON%28%28%28141.447222+-38.353333%2C141.921389+-38.373611%2C142.011111+-38.487778%2C141.883333+-38.570556%2C141.659444+-38.491667%2C141.447222+-38.353333%29%29%29#tab_mapView

  3. Adding the same WKT as an area within SP fails with this non-specific error message: image

  4. Testing the same feature with nonsense data shows SP can tell that a given WKT is valid or invalid: image

So there is an issue with Spatial correctly validating a WKT string, but not being able to create an area from it. There is no issue with loading a shapefile (I successfully tested this with an unrelated shapefile) so the issue lies in creating an area from a WKT.

qifeng-bai commented 2 years ago

Because the WKT of this polygon is not enclosed

Replacing the last coordinates with the first one will work POLYGON((141.447222 -38.353333, 141.921389 -38.373611, 142.011111 -38.487778, 141.883333 -38.570556, 141.659444 -38.491667, 141.447222 -38.353333))

qifeng-bai commented 2 years ago

HOW to test:

Go to "Add to map" -> Area Choose -> "Enter area coordinates (WKT)" Paste the WKT content above

You should see a dialog: Invalid WKT:Points of LinearRing do not form a closed linestring