AtlasOfLivingAustralia / spatial-hub

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

Adding species layer to complex area brings in every occurrence record #341

Closed timhicks-ala closed 3 years ago

timhicks-ala commented 4 years ago

When adding a particularly complex area to SP, and then adding a species layer, instead of adding a single species to only the specified area as expected, it instead loads every occurrence record in every location (ignoring the species selection as well as the area). This affects uploaded shapefiles as well as areas already defined in spatial layers.

Issue raised in helpdesk ticket 91645, where a user is combining multiple areas from a layer and attempting to download records from the combined area (https://spatial.ala.org.au/?ss=1598923626401), and received records that fell outside of the defined areas as well. Also related to helpdesk ticket 82236, for which #308 was raised to fix.

As an easy example, this also affects the bushfire extents layer:

SP complex area all occurrence records

Tasilee commented 4 years ago

Thanks @timhicks-ala. I'd hoped that this was fixed. There is a work-around: Use the defined area for Tools | Area report - interactive, and then download the relevant data - which could be filtered externally for the relevant species? This seems to work for the 37 combined DIWA areas.

timhicks-ala commented 4 years ago

Looks like the area report isn't quite right either, it shows plenty of records outside of those areas: https://biocache.ala.org.au/occurrences/search?q=qid:1598923543842&fq=#tab_mapView

The original reporter seems okay to reduce the number of areas they're working with to work around the issue.

timhicks-ala commented 4 years ago

Additionally raised in 92050

timhicks-ala commented 4 years ago

A user has confirmed that while a particularly complex shape file can trigger this issue, reducing the overall size of the area does work around the issue (as they are able to work with multiple smaller areas), which suggests this issue is entirely based on the complexity of an uploaded area.

nickdos commented 3 years ago

@adam-collins add commits.

adam-collins commented 3 years ago

Partially resolved with https://github.com/AtlasOfLivingAustralia/spatial-hub/commit/267ceb21152999072564f87bcee691c8ee79e7b9

adam-collins commented 3 years ago

related to #344

Tasilee commented 3 years ago

Not working as advertised on test. Mapping Eucalyptus gunnii on area Tasmania (from ASGS States/Territories) maps all occurrence records everywhere. I gave up waiting for it to finish mapping.

Capture

qifeng-bai commented 3 years ago

Reproduce this issue: Add to map -> gazzetter area -> Tasmania from ASGS stats/territories Add species: Eucalyptus gunnii

Current implementation is to collect WKT from this layer and upload wkt to biocache. It would cause issue when WKT is too big.

Fix: using layer, for example: cl1023 : Tasmania, instead of wkt

qifeng-bai commented 3 years ago

Another issue is caused by two suspected reasons: 1, oversized wkt 2, intersected polygons (There is no intersections of polygons by visual check on QGIS)

Working case: https://biocache.ala.org.au/ws/webportal/params/details/1616994553941

Find eucalyptus gunnii in two polygons

Broken case: https://biocache.ala.org.au/ws/webportal/params/details/1616715731279 When we load complicated areas, query in BS lost species and wkt. aspis (1).zip

@alexhuang091 found BS collect wkt and q from params, which has de facto limit of 2000 characters

qifeng-bai commented 3 years ago

Depended on: https://github.com/AtlasOfLivingAustralia/biocache-service/issues/579

qifeng-bai commented 3 years ago

Related to https://github.com/AtlasOfLivingAustralia/spatial-service/issues/120

qifeng-bai commented 3 years ago

After updated Tomcat settings, I confirmed that adding a species in a complicated area on Spatial-test and prod works now