[gdal-dev] DXF to Postgis using ogr2ogr
Bob Pawley
rjpawley at shaw.ca
Tue Dec 20 16:30:20 EST 2011
When I run
ogrinfo --config DXF_INLINE_BLOCKS FALSE W_Works.dxf
it results in this message
Open of `W_Works.dxf'
using driver `DXF' successful.
1: blocks
2: entities
And I’m using DraftSight as a drawing viewer.All of the information I want is on the model, but it still won’t import unless I explode the dxf file before saving.
I did try running your suggested sql command. I got an error “Undefined function ‘Dump’ used.
I also used the sql suggestion as a trigger function on the import table. Neither blocks nor entities were recognized.
Bob
From: Ralf Suhr
Sent: Monday, December 19, 2011 8:52 AM
To: Bob Pawley
Cc: gdal-dev at lists.osgeo.org
Subject: Re: [gdal-dev] DXF to Postgis using ogr2ogr
http://www.gdal.org/ogr/drv_dxf.html
Does ogrinfo print out the "blocks" layer?
ogrinfo --config DXF_INLINE_BLOCKS FALSE File.dxf
INFO: Open of `File.dxf'
using driver `DXF' successful.
1: blocks
2: entities
To see what can be imported by ogr use a dxfviewer that display only the model space. I have tested ogr with dxf version up to AC1018 without problems except the paper space.
Gr
Ralf
On Montag 19 Dezember 2011 17:21:58 Bob Pawley wrote:
> Thanks Ralf
>
> So far, I haven’t been able to populate the block columns unless I use a
> DXF file which has been exploded before saving.
>
> In all of my searching, I have not come across your suggestion of
> dereferencing the block. Can you point me to some documentation?
>
> Bob
>
>
> From: Ralf Suhr
> Sent: Monday, December 19, 2011 12:58 AM
> To: gdal-dev at lists.osgeo.org
> Cc: Bob Pawley
> Subject: Re: [gdal-dev] DXF to Postgis using ogr2ogr
>
> Hi Bob,
>
>
>
> the dxf driver writes to tables "entities" and "blocks". You have to
> dereference the block layer yourself.
>
>
>
> SELECT Translate( Scale( Rotate((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);
>
>
>
> Sometimes you have blocks with world coordinates and no connection in
> entities.
>
> SELECT (Dump(b.wkb_geometry)).geom AS wkb_geometry,
>
> b.ogr_style,
>
> b.layer,
>
> b.linetype,
>
> b.subclasses,
>
> b.text
>
> FROM blocks b
>
> WHERE blockname NOT IN
>
> (
>
> SELECT DISTINCT blockname
>
> FROM entities
>
> WHERE blockname IS NOT NULL
>
> );
>
>
>
> Some newer DXF Formats can have features in paper space. This is now not
> supported by ogr2ogr.
>
>
>
>
>
> Gr
>
> Ralf
>
> On Freitag 16 Dezember 2011 22:14:38 Bob Pawley wrote:
> > I have imported a dxf file into Postgis using the following command line
> > -
> >
> >
> >
> > set DXF_INLINE_BLOCKS=FALSE&set DXF_MERGE_BLOCK_GEOMETRIES=FALSE&set
> >
> > PGCLIENTENCODING=LATIN1&&ogr2ogr -f "PostgreSQL" PG:"host=localhost
> >
> > user=postgres dbname=dbname password=pass" W_Works.dxf -nln Import_PID
> >
> > -overwrite –skipfailures
> >
> >
> >
> > All geometries are intact.
> >
> >
> >
> > However, the text is part of the Linestring layer and not in the text
> >
> > column of the Postgresql table.
> >
> >
> >
> > Is this to be expected?
> >
> >
> >
> > Is there some way of screening out the text as text and point geometry?
> >
> >
> >
> > Bob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20111220/7bbf9828/attachment-0001.html
More information about the gdal-dev
mailing list