[gdal-dev] DXF to Postgis using ogr2ogr

Bob Pawley rjpawley at shaw.ca
Wed Dec 28 13:09:35 EST 2011


Thanks Ralf

I downloaded the latest development installer (http://www.gisinternals.com/sdk/PackageList.aspx?file=release-1310-gdal-1-8-mapserver-6-0.zip) and tried your suggestion using it.

I still get an error when running the Postgresql code “column b.ogr_style does not exist”. This is correct as neither table has, or has had, a column ogr_style.

Bob

From: Ralf Suhr 
Sent: Wednesday, December 28, 2011 1:07 AM
To: Bob Pawley 
Cc: gdal-dev at lists.osgeo.org 
Subject: Re: [gdal-dev] DXF to Postgis using ogr2ogr

Bob, you need a gdal version 1.8 or higher.



On Dienstag 27 Dezember 2011 19:48:33 Bob Pawley wrote:

> Something is still not penetrating this thick skull of mine.

> 

> When I run

> 

> ogr2ogr --config DXF_INLINE_BLOCKS FALSE --config 

> DXF_MERGE_BLOCK_GEOMETRIES FALSE -f "PostgreSQL" PG:"host=localhost

> user=postgres dbname=db password=pass" W_Works.dxf -overwrite

> -skipfailures -sql "SELECT

> ST_Translate(ST_Scale(ST_Rotate((ST_Dump(b.wkb_geometry)).geom,

> e.blockangle / 180 * PI()), e.blockscale[1], e.blockscale[2]),

> ST_X(e.wkb_geometry), ST_Y(e.wkb_geometry)) AS wkb_geometry, CASE WHEN

> b.ogr_style IS NOT NULL THEN b.ogr_style ELSE e.ogr_style END AS

> ogr_style, e.layer, e.linetype, e.subclasses, b.text FROM entities e INNER

> JOIN blocks b USING (blockname)"

> 

> I get error - Undefined function `st_dump`used.



You can not use PostGIS functions on dxf file source.



> 

> When I run a simplified version

> 

> ogr2ogr --config DXF_INLINE_BLOCKS FALSE --config 

> DXF_MERGE_BLOCK_GEOMETRIES FALSE -f "PostgreSQL" PG:"host=localhost

> user=postgres dbname=db password=pass" W_Works.dxf -overwrite

> -skipfailures -sql "SELECT wkb_geometry From entities"

> 

> I get error - unrecognized field name wkb_geometry

> 

> In the last, when I substitute wkb_geometry for the blocks (name, angle,

> scale) or text I get no errors.

> 

> In all of the commands I`ve run, the block table remains empty.



The dxf file contains two different ogr layers.



ogr2ogr --config DXF_INLINE_BLOCKS FALSE --config DXF_MERGE_BLOCK_GEOMETRIES FALSE -f "PostgreSQL" PG:"host=localhost user=postgres dbname=db password=pass" W_Works.dxf entities



ogr2ogr --config DXF_INLINE_BLOCKS FALSE --config DXF_MERGE_BLOCK_GEOMETRIES FALSE -f "PostgreSQL" PG:"host=localhost user=postgres dbname=db password=pass" W_Works.dxf blocks



And finaly run the sqls inside the postgis database.



> 

> Bob

> 

> 

> 

> From: Ralf Suhr

> Sent: Wednesday, December 21, 2011 1:30 AM

> To: Bob Pawley

> Cc: gdal-dev at lists.osgeo.org

> Subject: Re: [gdal-dev] DXF to Postgis using ogr2ogr

> 

> On Import you can't use -nln option or you run ogr2ogr to times. One for

> entities layer and secound for blocks.

> 

> 

> ogr2ogr -f postgresql -nln myentities PG:"..." W_Works.dxf entities

> 

> ogr2ogr -f postgresql -nln myblocks PG:"..." W_Works.dxf blocks

> 

> 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20111228/7c22a652/attachment.html


More information about the gdal-dev mailing list