kj-9 / setup-spatialite-macos

getting started with spatialite on macOS
0 stars 0 forks source link

ExportGeoJson2 does not work for a table created by `geojson-to-sqlite` #1

Closed kj-9 closed 2 months ago

kj-9 commented 2 months ago

does not work:

 $ python -c "from geojson_to_sqlite.cli import cli;cli()" \
  sample.db points points.json --spatialite --pk name

$ SPATIALITE_SECURITY=relaxed python -m sqlite_utils --load-extension=spatialite \
    sample.db "select ExportGeoJSON2('points', 'geometry', 'points-export.json')"

Not a valid Geometry Column.
[{"ExportGeoJSON2('points', 'geometry', 'points-export.json')": null}]

works:

$ SPATIALITE_SECURITY=relaxed python -m sqlite_utils --load-extension=spatialite \
    sample.db "select ImportGeoJSON('points.json', 'points')"                    
[{"ImportGeoJSON('points.json', 'points')": 9}]

$ SPATIALITE_SECURITY=relaxed python -m sqlite_utils --load-extension=spatialite \
    sample.db "select ExportGeoJSON2('points', 'geometry', 'points-export.json')"
[{"ExportGeoJSON2('points', 'geometry', 'points-export.json')": 9}]
kj-9 commented 2 months ago

Not a valid Geometry Column.

I don't know why this happens.

but anyway i realize that just using ImportGeoJson is fine. yes it will adds auto generated integer pk, but it is just fine. I can run some migration after load table if i don't like setup.

so drop geojson-to-sqlite and close this issue.