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

solr-spatial-field backend fails on longitude > 180 degree harvests #307

Open
benjwadams opened this issue Mar 1, 2023 · 5 comments
Open

Comments

@benjwadams
Copy link

I'm using solr-spatial-field as the CKAN spatial backend, along with ckanext-harvest to kick off harvests.

When some datasets with > 180 degrees of latitude are attempting to harvest, the harvester crashes due to an unhandled exception from Solr:

2023-03-01 20:58:57,773 ERROR [ckan.lib.search] Solr returned an error: Solr responded with an error (HTTP 400): [Reason: ERROR: [doc=b0b4a646f731d1fb151af2ad5441d62b] Error adding field 'spatial_geom'='POLYGON ((160 0, 257 0, 257 54, 16$
 54, 160 0))' msg=Unable to parse shape given formats "lat,lon", "x y" or as WKT because org.locationtech.spatial4j.exception.InvalidShapeException: Bad X value 257.0 is not in boundary Rect(minX=-180.0,maxX=180.0,minY=-90.0,maxY=90.0) i$
put: POLYGON ((160 0, 257 0, 257 54, 160 54, 160 0))]
@benjwadams benjwadams changed the title solr-spatial-field backend fails on longitude > 180 harvests solr-spatial-field backend fails on longitude > 180 degree harvests Mar 1, 2023
@bonnland
Copy link
Contributor

bonnland commented Mar 2, 2023

The documentation mentions that you'll have to split bboxes across the anti-meridian in order to index in Solr:

https://docs.ckan.org/projects/ckanext-spatial/en/latest/spatial-search.html?highlight=meridian#custom-indexing-logic

@benjwadams
Copy link
Author

I ended up creating a fix for this, but is there any reason this can't be fixed here, or skipped, instead of crashing the harvest process?

@bonnland
Copy link
Contributor

There is a chance it wasn't as high a priority as other issues. I am not working on CKAN development full time, but I would imagine that your solution could be useful to others, and you could make a pull request to let others benefit from your solution.

@benjwadams
Copy link
Author

I'll try to contribute back, will have to make a unit test for the geometry splitting functionality.

@markstuart
Copy link

I'd be interested in a solution for this too @benjwadams, have you added the geometry splitting in an extension or repo where I could maybe test the code out? Or maybe you could raise a work in progress PR against this repo and add the test later on?

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

3 participants