NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

I'm converting an extracted chunk of OSM data to GeoJSON. We can use GDL ogr2ogr commands like:

ogr2ogr -f GeoJSON tmp_lines.geojson tmp_osm-solar-withreferenced.pbf lines
ogr2ogr -f GeoJSON tmp_mpoly.geojson tmp_osm-solar-withreferenced.pbf multipolygons

By default, ogr2ogr doesn't automatically convert all closed ways into polygons, only ones with certain tags which can be defined in osmconf.ini. The default is:


How can I tell ogr2ogr that I want ALL closed ways to be treated as polygons? I know it's not always advisable in general, but in my case it's what I want, and especially I want un-tagged ways to handled like this. The closed_ways_are_polygons flag only seems to accept an explicit list.

asked 29 Apr '20, 09:27

mcld's gravatar image

accept rate: 0%

It looks like you can't (the implementation just explicitly checks the listed keys):

I imagine post processing the GeoJSON is going to be the easiest way to get what you want.

permanent link

answered 29 Apr '20, 12:22

maxerickson's gravatar image

accept rate: 32%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 29 Apr '20, 09:27

question was seen: 2,077 times

last updated: 29 Apr '20, 12:22

NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum