0

I am learning the process of extracting only certain layers inside the dxf file and converting them into GEOJSON files using the ogr2ogr of Gdal. Let me show you an example.

ex) ogr2ogr -f "GEOJSON" "public/images/jsonData/plants.json" -where "Layer='plants'" public/images/Ceco.NET-Architecture-Tm-53.dxf entities

The command confirms that only data with the layer name dxf file internal plants are extracted and converted to geojson.

In this way, you can extract the geojson file by entering the layer name inside the dxf file, but is there a way to create multiple geojson by collecting the same layers inside the dxf file with one command?

1 Answer 1

2

GeoJSON file can contain only one layer, and unlike for example the CSV driver, the GDAL GeoJSON driver https://gdal.org/drivers/vector/geojson.html does not support using a directory with several GeoJSON files as one datasource with several layers. So that alone makes it impossible to create many GeoJSON files with one ogr2ogr command.

In addition, if ogr2ogr command is using a -sql or a simplified -where parameter then the output is always a single layer because the SQL query returns only one result set.

0

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.