Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing WKT process: parsing error and possible dead loop #230

Open
qifeng-bai opened this issue Jan 24, 2024 · 0 comments
Open

Fixing WKT process: parsing error and possible dead loop #230

qifeng-bai opened this issue Jan 24, 2024 · 0 comments
Assignees

Comments

@qifeng-bai
Copy link
Contributor

qifeng-bai commented Jan 24, 2024

This tool works with an area defined by 'current context', 'bounding box', etc, but It does not work with the area created by WKT

The task was created on Spatial-service, but stayed in the queue

Here is the WKT around Tas area:

POLYGON((
  143 -39,
  148 -39,
  148 -44,
  143 -44,
  143 -39
))

Issue 1:
SimpleRegion.parseSimpleRegion can parse properly:
POLYGON((143 -39,148 -39,148 -44,143 -44,143 -39))

but it cannot parse correctly:
POLYGON((\n 143 -39,\n 148 -39,\n 148 -44,\n 143 -44,\n 143 -39\n))

Temporary solution:

            //remove return/space that immediately occur after ','
            p = p.replaceAll('[\\n]+', '')
            //remove space that immediately occur after ','
            p = p.replaceAll(',[\\s]+', ',').trim()

We logged before and after

[Spatial-service] 2024-01-25 12:00:17.343  INFO au.org.ala.spatial.process.SlaveProcess [SlaveProcess.groovy:1117] : Parsing WKT
[Spatial-service] 2024-01-25 12:00:17.412  INFO au.org.ala.spatial.process.SlaveProcess [SlaveProcess.groovy:1127] : Check BBox: [[143.0, -44.0], [148.0, -39.0]]

Issue 2:
However, if we are processing a complicated WKT, for example a WKT for Tasmania, there is a possibility that the process is in a dead loop in calculating grid cut:
https://github.com/AtlasOfLivingAustralia/spatial-service/blob/develop/src/main/groovy/au/org/ala/spatial/process/SlaveProcess.groovy#L1116

qifeng-bai added a commit that referenced this issue Jan 25, 2024
failed on calculate bbox on wkt, for examaple: '`POLYGON((\n  143 -39,\n  148 -39,\n  148 -44,\n  143 -44,\n  143 -39\n))`'
@adam-collins adam-collins removed their assignment Jan 25, 2024
@qifeng-bai qifeng-bai changed the title The Classify tool cannot start the task when we define an area with WKT Fixing WKT process: parsing error and possible dead loop Jan 29, 2024
qifeng-bai added a commit that referenced this issue Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants