[Tile-serving] [openstreetmap/osm2pgsql] Support locations_on_ways PBF format extension (Issue #1679)

mmd notifications at github.com
Mon Jun 6 08:21:43 UTC 2022


(Note: I'm moving this topic from a discussion to an issue, since it hasn't received much feedback yet)

Since more than 6 years, PBF format supports Node Locations on Ways (https://blog.jochentopf.com/2016-04-20-node-locations-on-ways.html). I was wondering what would be needed to include support for this PBF format extension in osm2pgsql as well.

I think it would also be a good showcase to validate assumptions about potential data models enhancements.

Below a copy of the original discussion:

### Discussed in https://github.com/openstreetmap/osm2pgsql/discussions/1519

<div type='discussions-op-text'>

<sup>Originally posted by **mmd-osm** June  5, 2021</sup>
Since libosmium has support for _locations on ways_, I was wondering if this format extension might be relevant for osm2pgsql as well, at least for an initial load.

The toy example below was the bare minimum needed to import such a PBF file. I'm sure, a more sophisticated approach is possible by evaluating the PBF header pbf_optional_feature, which should include an `LocationsOnWays` in that case.

Calling osm2pgsql using:` -r pbf,locations_on_ways=true`

middle-ram.cpp:

Added in set_requirements (for testing purposes only)
`m_store_options.way_nodes = false;`

 line 200, nodes_get_list

```
if (m_store_options.locations) {
    for (auto &nr : *nodes) {
        if (nr.location().is_undefined())     <<< added check. locations_on_ways pbf can skip set_location
          nr.set_location(m_node_locations.get(nr.ref()));
```

</div>

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/issues/1679
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/osm2pgsql/issues/1679 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20220606/613475d4/attachment.htm>


More information about the Tile-serving mailing list