BiologicalRecordsCentre / iRecord

Repository to store and track enhancements, issues and tasks regarding the iRecord website.
http://irecord.org.uk
2 stars 1 forks source link

Spatial indexing of points doesn't take into account accuracy #1616

Open Sam-Amy opened 7 months ago

Sam-Amy commented 7 months ago

A forum post queries why some records straddling VC boundaries are only assigned to one https://irecord.org.uk/forum/feedback-and-suggestions/wrong-vice-county-where-straddles-boundary

@burkmarr had a look at the spatial index builder code and found that if a record (or rather the sample to which it belongs) is entered as a grid reference, its public_geom attribute will be a polygon corresponding to the associated grid square. This is overlapped with the VC geometries and if it intersects more than one VC then multiple VCs will be recorded against the record (their ids entered into the location_ids attribute on the cache table).

If a record is entered as a point (grid ref is a lat/lon) - then its public_geom attribute is a point. When this is overlapped with the VC geometries, it will only intersect one VC.

A couple of things about the way the record details are displayed make this confusing. Firstly it is displayed not as a point but as a circle with a radius of the location accuracy. This clearly overlaps two VCs. Secondly the Gridref_calculated is a 1 km square which clearly overlaps two VCs. (And if the record had been entered with this grid ref, both VCs would have been associated with it).

Should/could the spatial indexing treat the record geometry not as a point but as a circle based on the point and location accuracy?

Sam-Amy commented 7 months ago

I'm not sure if this is the same issue affecting record 30394627 where the plotted point is not where the recorder expected (shifted slightly north-east; see this forum post)

Plotted point on iRecord: image

Actual location of grid reference given: image