I am trying to create an automatic procedure for using ogr2ogr to read a PostGIS table and output a KML file containing line features. However, I need to define the styling of these lines including both width and color. Potentially I could save the styling information as attributes if that could help.

Is this possible with ogr2ogr?

  • 2
    It may happen automatically if you add a field named "OGR_STYLE" into your table in PostGIS and fill it with drawing instructions as described in gdal.org/ogr_feature_style.html.
    – user30184
    Apr 10, 2018 at 10:44

1 Answer 1


I will answer this question myself. As the comment by user30184 mentions, you can use a field named "OGR_STYLE" to define the styling for your features. I could not get this to work with point features, but it worked well with line features. For example:

OGR_STYLE: PEN(c:#b3ff00,w:2.5px)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.