<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<p>Hi Paul,</p>
<p>As usual, there are several ways:</p>
<p>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)</p>
<p>2. or you create an external .ofs (OGR feature style side-file) as described in section 2.7 of the spec</p>
<p>3. or you use the OGR support Classes as described in chapter 3 of the spec.</p>
<p>All information is in the spec, incl. some examples.</p>
<p>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.</p>
<p>Greetings,</p>
<p>Andreas</p>
<p id="reply-intro">On 2019-11-11 08:45, paul.malm@lfv.se wrote:</p>
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0">
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0">
<div> </div>
</blockquote>
</blockquote>
<style type="text/css">@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:Verdana;
panose-1:2 11 6 4 3 5 4 4 2 4;}
#replybody1 p.v1MsoNormal, #replybody1 li.v1MsoNormal, #replybody1 div.v1MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
#replybody1 a:link, #replybody1 span.v1MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
#replybody1 a:visited, #replybody1 span.v1MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
#replybody1 p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
#replybody1 p.v1v1msonormal, #replybody1 li.v1v1msonormal, #replybody1 div.v1v1msonormal
{mso-style-name:v1msonormal;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
#replybody1 p.v1v1msochpdefault, #replybody1 li.v1v1msochpdefault, #replybody1 div.v1v1msochpdefault
{mso-style-name:v1msochpdefault;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
#replybody1 span.v1v1msohyperlink
{mso-style-name:v1msohyperlink;}
#replybody1 span.v1v1msohyperlinkfollowed
{mso-style-name:v1msohyperlinkfollowed;}
#replybody1 span.v1v1e-postmall17
{mso-style-name:v1e-postmall17;}
#replybody1 p.v1v1msonormal1, #replybody1 li.v1v1msonormal1, #replybody1 div.v1v1msonormal1
{mso-style-name:v1msonormal1;
margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
#replybody1 span.v1v1msohyperlink1
{mso-style-name:v1msohyperlink1;
mso-style-priority:99;
color:blue;
text-decoration:underline;}
#replybody1 span.v1v1msohyperlinkfollowed1
{mso-style-name:v1msohyperlinkfollowed1;
mso-style-priority:99;
color:purple;
text-decoration:underline;}
#replybody1 span.v1E-postmall26
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:windowtext;}
#replybody1 span.v1E-postmall27
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
#replybody1 .v1MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
#replybody1 div.v1WordSection1
{page:WordSection1;}</style>
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0">
<div id="replybody1">
<div lang="SV">
<div class="v1WordSection1">
<p class="v1MsoNormal"><span style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;">Thanks Andreas,</span></p>
<p class="v1MsoNormal"><span style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;">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.</span></p>
<p class="v1MsoNormal"><span style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;">Kind regards,</span></p>
<p class="v1MsoNormal"><span style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;">Paul</span></p>
<p class="v1MsoNormal"><span> </span></p>
<div>
<div style="border: none; border-top: solid #B5C4DF 1.0pt; padding: 3.0pt 0cm 0cm 0cm;">
<p class="v1MsoNormal"><strong><span style="font-size: 10.0pt; font-family: 'Tahoma','sans-serif';">Från:</span></strong><span style="font-size: 10.0pt; font-family: 'Tahoma','sans-serif';"> Andreas Neumann [mailto:a.neumann@carto.net] <br /><strong>Skickat:</strong> den 11 november 2019 08:35<br /><strong>Till:</strong> M</span><span style="font-size: 10.0pt; font-family: 'Tahoma','sans-serif';">alm, Paul (Operations AIM)<br /><strong>Kopia:</strong> gdal-dev@lists.osgeo.org<br /><strong>Ämne:</strong> Re: [gdal-dev] ogr2ogr PDF</span></p>
</div>
</div>
<p class="v1MsoNormal"> </p>
<p><span style="font-size: 10.0pt; font-family: 'Verdana','sans-serif';">Hi Paul,</span></p>
<p><span style="font-size: 10.0pt; font-family: 'Verdana','sans-serif';">ogr2ogr usually doesn't care much about styling, unless you use ogr feature styles:</span></p>
<p><span style="font-size: 10.0pt; font-family: 'Verdana','sans-serif';"><a href="https://svn.osgeo.org/gdal/trunk/gdal/ogr/ogr_feature_style.html" target="_blank" rel="noopener noreferrer">https://svn.osgeo.org/gdal/trunk/gdal/ogr/ogr_feature_style.html</a></span></p>
<p><span style="font-size: 10.0pt; font-family: 'Verdana','sans-serif';">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.</span></p>
<p><span style="font-size: 10.0pt; font-family: 'Verdana','sans-serif';">*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 <a href="https://gis.stackexchange.com/questions/340030/create-geospatial-pdf-geopdf-is-greyed-out-in-pdf-export-options-in-qgis-3-10" target="_blank" rel="noopener noreferrer">https://gis.stackexchange.com/questions/340030/create-geospatial-pdf-geopdf-is-greyed-out-in-pdf-export-options-in-qgis-3-10</a></span></p>
<p><span style="font-size: 10.0pt; font-family: 'Verdana','sans-serif';">Greetings,</span></p>
<p><span style="font-size: 10.0pt; font-family: 'Verdana','sans-serif';">Andreas</span></p>
<p id="v1reply-intro"><span style="font-size: 10.0pt; font-family: 'Verdana','sans-serif';">On 2019-11-11 08:28, paul.malm@lfv.se wrote:</span></p>
<blockquote style="border: none; border-left: solid #1010FF 1.5pt; padding: 0cm 0cm 0cm 5.0pt; margin-left: 0cm; margin-right: 0cm;">
<blockquote style="border: none; border-left: solid #1010FF 1.5pt; padding: 0cm 0cm 0cm 5.0pt; margin-left: 0cm; margin-right: 0cm;">
<div>
<p class="v1MsoNormal"><span style="font-size: 10.0pt; font-family: 'Verdana','sans-serif';"> </span></p>
</div>
</blockquote>
</blockquote>
<blockquote style="border: none; border-left: solid #1010FF 1.5pt; padding: 0cm 0cm 0cm 5.0pt; margin-left: 0cm; margin-right: 0cm;">
<div id="v1replybody1">
<div>
<p class="v1v1msonormal1">Hi list,</p>
<p class="v1v1msonormal1">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...</p>
<p class="v1v1msonormal1">I have 2 tables that I would like to export into test.pdf (rivers and roads)</p>
<p class="v1v1msonormal1">ogr2ogr -f "PDF" c:\Temp\test.pdf PG:"host=xxx.xxx.xxx.x user=yyyy dbname=testdb password=pwd" rivers roads</p>
<p class="v1v1msonormal1"> </p>
<p class="v1v1msonormal1">I would, for instance set like to set line width to 1 px and color to 4040FF on rivers,</p>
<p class="v1v1msonormal1">Width 3 px and color FF4040 on roads.</p>
<p class="v1v1msonormal1"> </p>
<p class="v1v1msonormal1">Thanks,</p>
<p class="v1v1msonormal1">Paul</p>
</div>
</div>
<p class="v1MsoNormal"><span style="font-size: 10.0pt; font-family: 'Verdana','sans-serif';"> </span></p>
<div>
<p class="v1MsoNormal"><span style="font-size: 10.0pt; font-family: 'Courier New';">_______________________________________________<br />gdal-dev mailing list<br /><a href="mailto:gdal-dev@lists.osgeo.org" rel="noreferrer">gdal-dev@lists.osgeo.org</a><br /><a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank" rel="noopener noreferrer">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a></span></p>
</div>
</blockquote>
<p><span style="font-size: 10.0pt; font-family: 'Verdana','sans-serif';"> </span></p>
</div>
</div>
</div>
</blockquote>
<p><br /></p>
</body></html>