I've successfully loaded a bunch of shapefiles into a PostGIS database. I would like to be able to retrieve specific geometry and layers as dxf files based on SQL queries.
I'm using PostGIS, GDAL, PostgreSQL, and Python from the OSGeo4W suite on Windows.
I'm imagining that I should be using ogr2ogr a bit like this:
$ ogr2ogr -sql "SELECT * FROM some_table" -f "dxf" outputfile.dxf -overwrite "PG:dbname=mydb user=dbusername password=dbpassword"
but when I do that with the appropriate values, I get a series of errors like this:
ERROR 1: DXF layer does not support arbitrary field creation, field 'objectid' not created.
Resulting in an error for every attribute column in the layer some_table
But I do get a dxf file.
If I've already created a .dxf file, and I rerun the command above (including the -overwrite
option), I get this error instead:
Layer sql_statement not found, and CreateLayer not supported by driver. ERROR 1: Terminating translation prematurely after failed translation from sql statement.
I have already checked to make sure that the GDAL_DATA
environmental variable is set correctly. (to C:\OSGeo4W\share\gdal
)
It's certainly possible that I'm approaching this task incorrectly because I'm new to all these tools, so I'm open to any suggestions and tips about how to make .dxf files from GIS data stored in PostgreSQL based on SQL queries.
No comments:
Post a Comment