[gdal-dev] ogr2ogr PDF

Andreas Neumann a.neumann at carto.net
Mon Nov 11 00:13:23 PST 2019


Hi Paul, 

As usual, there are several ways: 

1. You can either create a new attribute called "OGR_STYLE" (see section
2.8 in the spec) that contains the style definition (see chapter 2 in
the spec) 

2. or you create an external .ofs (OGR feature style side-file) as
described in section 2.7 of the spec 

3. or you use the OGR support Classes as described in chapter 3 of the
spec. 

All information is in the spec, incl. some examples. 

I would probably use options 1 or 2 in your case. Option one can be done
in an SQL-Select query, where you create the OGR_STYLE attribute on the
fly with your query. 

Greetings, 

Andreas 

On 2019-11-11 08:45, paul.malm at lfv.se wrote:

>> 

> Thanks Andreas, 
> 
> Yes, I would like to automate it. I have read the page you suggested but I don't understand how to implement it with ogr2ogr. 
> 
> Kind regards, 
> 
> Paul 
> 
> Från: Andreas Neumann [mailto:a.neumann at carto.net] 
> Skickat: den 11 november 2019 08:35
> Till: Malm, Paul (Operations AIM)
> Kopia: gdal-dev at lists.osgeo.org
> Ämne: Re: [gdal-dev] ogr2ogr PDF 
> 
> Hi Paul, 
> 
> ogr2ogr usually doesn't care much about styling, unless you use ogr feature styles: 
> 
> https://svn.osgeo.org/gdal/trunk/gdal/ogr/ogr_feature_style.html 
> 
> Or you use QGIS 3.10* which has a nice GeoPDF export built in. But if you want to automate things, I understand that the automated solution might be better for your workflow. 
> 
> *Disclaimer: QGIS 3.10 must be compiled with GDAL >= 3.0 and proj6, which as far as I know is currently not the case for QGIS Windows standalone builds. See also https://gis.stackexchange.com/questions/340030/create-geospatial-pdf-geopdf-is-greyed-out-in-pdf-export-options-in-qgis-3-10 
> 
> Greetings, 
> 
> Andreas 
> 
> On 2019-11-11 08:28, paul.malm at lfv.se wrote:

> Hi list, 
> 
> I have a question on how to export a PDF file from PostGIS with a color on the lines instead of the default black lines. I have searched on the internet but have not reached all the way... 
> 
> I have 2 tables that I would like to export into test.pdf (rivers and roads) 
> 
> ogr2ogr -f "PDF" c:\Temp\test.pdf PG:"host=xxx.xxx.xxx.x user=yyyy dbname=testdb password=pwd" rivers roads 
> 
> I would, for instance set like to set line width to 1 px and color to 4040FF on rivers, 
> 
> Width 3 px and color FF4040 on roads. 
> 
> Thanks, 
> 
> Paul 
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20191111/1cc357a4/attachment.html>


More information about the gdal-dev mailing list