[gdal-dev] DXF to Postgis using ogr2ogr
Bob Pawley
rjpawley at shaw.ca
Mon Dec 19 11:21:58 EST 2011
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/20111219/1a5f4458/attachment.html
More information about the gdal-dev
mailing list