Ticket #3350 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

Add option to osm2pgsql to keep data tagged as natural=coastline

Reported by: springmeyer Owned by: jburgess777@…
Priority: major Milestone:
Component: utils Version:
Keywords: osm2pgsql Cc: dane@…


Data tagged natural=coastline data is discarded (filtered out) in osm2pgsql based on the assumption that this information will be pulled from the  coastline error checker application after being further processed.

But, it is foreseeable that users may prefer the raw ways to be imported, particularly to be able to store linestrings of the coastlines.

The attached patch adds a -K,--keep-coastlines option that if passed will skip the default behavior of discarding coastline data.


osm2pgsql_keep_coastlines_option.diff Download (3.8 KB) - added by springmeyer 3 years ago.
Add option to osm2pgsql to avoid skipping coastlines

Change History

comment:1 Changed 3 years ago by TomH

  • Owner changed from tom@… to jburgess777@…
  • Status changed from new to assigned

Changed 3 years ago by springmeyer

Add option to osm2pgsql to avoid skipping coastlines

comment:2 Changed 3 years ago by springmeyer

It should be noted to anyone interested in this patch that your mileage will vary using the coastlines this way. The coastline error checker does some sophisticated topological processing of the data to try to make it more usable, and raw coastlines imported directly into the database may not meet expectations.

comment:3 Changed 3 years ago by jburgess777@…

  • Status changed from assigned to closed
  • Resolution set to fixed

Thanks for the patch Dane. I applied it with a minor modification to split out the island handling in r24605. I don't know whether my change is strictly necessary but it prevents these lines from being skipped when you keep the coastlines.

I noticed that when you enable the option there are also many more polygons, presumably from small islands and lakes which are all tagged with natural=coastline. There are also a few extra points from nodes tagged with natural=coastline.

comment:4 Changed 3 years ago by springmeyer

  • Cc dane@… added

Hi Jon,

Thanks so much for the review, and applying it!

In my testing I noticed that closed islands did seem to remain (as polygons), but nevertheless seems wise to enforce that for predictability and code clarity.



Note: See TracTickets for help on using tickets.