specify / specify7

Specify 7
https://www.specifysoftware.org/products/specify-7/
GNU General Public License v2.0
66 stars 36 forks source link

GEOLocate error with Max Uncertainty field and polygons #3957

Open bronwyncombs opened 1 year ago

bronwyncombs commented 1 year ago

Describe the bug Currently unable to add a polygon to a locality record because the Max Uncertainty Est field in the Geo Coord Details sub-form gets triggered upon save. The map's imagery will go away if you open it again after this without saving first. Putting a value in the Max Uncertainty field before using the plugin, saving, and then going to the plugin has no effect (shown at end of recording).

To Reproduce Steps to reproduce the behavior:

  1. Go to Locality form and fill out Geography field
  2. Click on GEOLocate and draw a polygon
  3. Click "Save To Your Application"
  4. See error

Screenshots If applicable, add screenshots to help explain your problem.

https://github.com/specify/specify7/assets/135047322/6fd0a035-7e89-4101-9abd-79e66b18bd9d

Screenshot 2023-08-30 at 11 44 59 AM

Desktop:

Database Name: sdnhmpaleo_3_31_23

grantfitzsimmons commented 1 year ago

Might be a duplicate of https://github.com/specify/specify7/issues/1907

emenslin commented 3 months ago

From #3880

image

For instance, when you select a polygon and a point, you see the following in the preview within GEOLocate:

37.7749   -122.4194   Unavailable 37.77805,-122.488751,37.746294,-122.488751,37.768009,-122.455106,37.77805,-122.488751

You can see that the latitude, longitude, and uncertainty are separated by ` characters. The polygon is separated by,` characters.

This doesn't cause a problem when you have a set of coordinates and an uncertainty radius, but when you only have a polygon, it causes errors to occur.

For example, if you have only this in your preview:

37.77805,-122.488751,37.746294,-122.488751,37.768009,-122.455106,37.77805,-122.488751

https://github.com/specify/specify7/assets/37256050/6d6b8135-b37d-4500-93db-8840bd4f5565

image

console-export-2023-8-1_9-27-22.txt

@melton-jason was able to see this in action

My theory is that the comma separated polygon is trying to be interpreted as longitude, latitude, uncertainty, and then the polygon. Specify likely does not expect only a polygon, resulting in an error.

emenslin commented 3 months ago

From #3242

After creating a polygon in GEOLocate, I save it to the form. When I use GEOLocate again, it is not mapped.

https://user-images.githubusercontent.com/37256050/227006388-5986e02f-c1e4-4195-b2dc-5efe78b2212e.mp4

emenslin commented 3 months ago

From #1907

When leaflets plots a locality, it retrives the error radius from the Locality.latLongAccuracy field. Locality.geoCoordDetails.maxUncertaintyEst should be used instead, as that's the field that is used by GeoLocale.