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

sqlite3.IntegrityError violates Geometry constraint [geom-type or SRID not allowed] #321

Closed
chris48s opened this issue Sep 17, 2024 · 0 comments

Comments

@chris48s
Copy link
Owner

shp_to_spatialite() attempts to be "clever" and detect a suitable geometry type based on the first record

columns["geometry"] = features[0]["geometry"]["type"].upper()

This falls apart once you have a shapefile that has multiple geometry types in it. Here's an example of a shapefile input that reproduces this problem

two_things.zip

The easiest way to handle this is just to hard-code the geometry column type as GEOMETRY which is what I already do for GeoJSON files.
You could try and work out up-front if all the features are of the same type (but this could take a long time). You could also allow the user to manually specify the type of the geom column as a param. This is basically the same problem you already anticipated with GeometryCollection in #8 so you might as well apply the same solution for both.

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

1 participant