[gdal-dev] DXF to Postgis using ogr2ogr

Bob Pawley rjpawley at shaw.ca
Wed Dec 28 17:18:56 EST 2011


Hi Ralf

I managed to include ogr_styles by using the –sql option. 

However the blocks table is still empty. There fore when I run the Postgresql script the result comes up empty.

Would it be possible for you to send me a dxf file that has worked for you, just in case the dxf I am using is structured differently. (I’m using engineering not geographic information.)

In email I have about a 3 meg limit.

Thanks.

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/d632ead7/attachment-0001.html


More information about the gdal-dev mailing list