[gdal-dev] Export label to dxf from postgresql by ogr2ogr
Alan Thomas
athomas at thinkspatial.com.au
Sat Jul 28 08:16:46 PDT 2018
Hi,
When I run your first command (with a couple of syntax fixes - it is
incorrect to delimit parts of the style string with single quotes) I
get a DXF file with two labels.
$ ogr2ogr -f "DXF" "demo.dxf" "PG:<connection string here>" -sql
"SELECT geom, 'LABEL(f:Times New Roman,s:12pt,t:' || text || ')' AS
OGR_STYLE FROM public.test"
ERROR 1: DXF layer does not support arbitrary field creation, field
'ogr_style' not created.
You can ignore that error message; the styling data does get used
correctly by the DXF writer.
Unfortunately I only have GDAL 2.2.4 to hand at the moment, which does
not contain any of the recent improvements to the DXF driver. It is
possible that the behaviour is different on GDAL 2.3. Can you confirm
whether this command works for you?
Alan
On Thu, 26 Jul 2018 at 18:19, ? ?? <giserliang at hotmail.com> wrote:
>
> I need to export label to dxf from postgresql by ogr2ogr command, label information is text field in PG, but it is always unsuccessful, I always lose the text label information.
>
> Those commands are here:
>
> ogr2ogr -f "DXF" "demo.dxf" "PG:host=localhost user=postgres dbname=demo pas sword=xxxx port=5432" -sql "SELECT geom, 'LABEL(f:\'Times New Roman\',s:12pt,t:\'' || text || '\')' AS OGR_STYLE FROM demo"
>
> ogr2ogr -select 'text' -f "DXF" "demo.dxf" "PG:host=localhost user=postgres dbname=demo pas sword=xxxx port=5432" "demo"
>
>
> PG Fields are here:
>
>
> What is wrong with those commands? Any Help? Thanks
> ________________________________
> giserliang at hotmail.com
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
--
Alan Thomas
Software Developer
ThinkSpatial
http://www.thinkspatial.com.au
More information about the gdal-dev
mailing list