0

With help from this forum I developed an ogr2ogr command to transform and reproject a gml file holding cadastral parcel polygons.

ogr2ogr -lco COORDINATE_PRECISION=8 -f "GeoJSON" parcel.geojson 
-t_srs "EPSG:4326" parcel.gml -sql "select gml_id as id, begrenzingPerceel from perceel"

As the parcel file also holds irrelevant offshore parcels, I would like to clip them off. Therefore I added a -clipdst option to the command:

ogr2ogr -lco COORDINATE_PRECISION=8 -f "GeoJSON" parcel.geojson -clipdst boundaries_NL.geojson
-t_srs "EPSG:4326" parcel.gml -sql "select gml_id as id, begrenzingPerceel from perceel"

The question is whether this is the most efficient solution as the processing time increased from 20 minutes to 32 hours. The following image gives an overview of the issue:

enter image description here

4
  • GeoJSON and GML are extremely inefficient formats for that kind of processing because they do not support any kind on indexing. In this case spatial index is what you would need. I would import both datasets first into PostGIS, index them, and run the spatial query in the database. Small optimization could be achieved by simplifying the country border, less than 117737 coordinates should be enough.
    – user30184
    Commented Apr 16 at 13:13
  • I see. I am indeed interested to develop my workflow in this way, but I lack knowledge to set this up by myself. I do have a Postgres database running in a Docker container, but I don't know how the CREATE statement should look like for the GML file as well as the GeoJSON file. The same goes for the Index creation statement and the actual "clip"-query. Are you able and willing to assist me in this?Perhaps on a fee basis?
    – Sebastiaan
    Commented Apr 16 at 15:10
  • Using python it is also fairly easy to have an efficient solution for your problem. So if you are able to write (or run) python scripts...
    – Pieter
    Commented Apr 16 at 19:33
  • 1
    Unfortunately not. And given the already running Postgres database with Postgis extension, that might perhaps be a better way for me.
    – Sebastiaan
    Commented Apr 16 at 21:01

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.