geobtaa / geoblacklight_admin

MIT License
4 stars 2 forks source link

Update derive_polygon function to create ENVELOPE() for BBoxes with -180 and 180 #36

Closed karenmajewicz closed 9 months ago

karenmajewicz commented 1 year ago

https://github.com/geobtaa/geomg/blob/361a868b14d1aeab8ee9ccdad9849e5877c37780/app/models/document.rb#L264C3-L273C10

Currently, this code catches BBoxes with this value: -180,-90,180,90 and creates an Envelope. However, it misses BBoxes with any other value for n like -180,n,180,n. This is creating erronous Polygons for the Geometry field.

Can we update this code to check for anything matching -180,n,180,n and create an Envelope for those as well? See issue geobtaa/geomg#274 for details.

karenmajewicz commented 1 year ago

Example records to use:

Arctic (-180,50,180,90): p16022coll230:787 Antarctic (-180,-90,180,-20) : p16022coll230:3857 Western Hemisphere (-180,-90,0,90) had to change to (-179.9,-89,0,89) : 7e0062d1-6643-4c90-aaa0-97bac5389481

ewlarson commented 1 year ago

Okay... I see how this change would work for your Arctic and Antarctic examples (-180,n,180,n), but your Western Hemisphere example is (-180,n,0,n). Should the logic just check for a -180 W value and if true, make an envelope of the WSEN values? or require the E value to be 0 or positive?

karenmajewicz commented 1 year ago

I need to do more investigation - I am not sure why the Western Hemisphere one (-180,-90,0,90) causes an error.

karenmajewicz commented 9 months ago

When I did some testing, it seems like the records will error if any of the values were at the extremes of -180,180,-90, or 90.

Our new metadata validation & cleaning script will catch these kind of errors. So, the cleaning script will subtract a fraction of the coordinate so that the extent is not on an edge.

I am not confident that this is a good solution in the long run. I foresee some major headaches for the GBL community if they are not able to use bounding boxes with these coordinates.