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

Dear OSM community,

I'm having problems with large relations. Mostly coastlines, seas or oceans (e.g. https://www.openstreetmap.org/relation/4497545). They cause problems when I try to segment large map tiles because they are not split apart if I keep relations together, causing quite high nodes counts per split.

My question is: Is there some way to filter out such big relations using osm filter or similar commandline tools? Is anyone else having problems with this, and how did you address this problem?

Best regards, David

asked 15 Oct '21, 18:09

Gemons's gravatar image

Gemons
11112
accept rate: 0%


With osmosis you can do regional cuts using the clipIncompleteEntities=true option. This will then remove all nodes outside of the region, and modify ways that lie partly in and partly outside the region to only refer to the nodes inside. The same for relations.

However this process can lead to invalid geometries, so a large forest multipolygon that extends outside of your area might not be contained at all.

(These large water bodies are a pet peeve of mine, I think they misrepresent the facts, are solely created to have nice labels on the map, and should be deleted and replaced by a node in the middle.)

permanent link

answered 15 Oct '21, 18:32

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

Thanks for the fast reply. I tried to clip relations at the bounding box of my map tiles, but as you mentioned I also saw that this sometimes produces weird results. E.g. one time I had a U-shaped forest. After clipping it was not clear anymore where inside and outside of the forest was.

I think if there is no existing solution to filter a relation by node count (or member count could be enough as well) I will have to implement some filter like that on my own inside the program logic.

I hope that the overall number of relations filtered out due to this will be low enough such that I can manually evaluate if the relations that were thrown away should really be thrown away.

(15 Oct '21, 18:44) Gemons

Question is, what are you splitting the map for? IF you were to convert OSM data into geometries first (e.g. import into PostgreSQL) then you could split that nicely and cut large areas into smaller areas along the boundaries. Or use vector tiles. But I can't tell you if that will work for your use case since I don't know enough about that.

(15 Oct '21, 18:48) Frederik Ramm ♦

I'm currently working on a map that only shows the type of environment. E.g. forest, water, meadow ... For this I merge multiple tag groups describing the envrionment into 11 environment groups. Then I import the map data into e.g. Python or Matlab and process the geometry. The code I have only works good on smaller map tiles ans the merging of polygons becomes quite expensive when the polygons become larger. Therefore, I split the map into smaller tiles upfront and process the tiles one by one. Ideally I will do this for the whole world map, mich means it should run automated as much as possible.

(15 Oct '21, 18:57) Gemons

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×236
×66
×60
×18

question asked: 15 Oct '21, 18:09

question was seen: 1,298 times

last updated: 15 Oct '21, 18:57

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