On 5/7/2015 2:58 AM, Walter Nordmann wrote:
Hi,
at the moment i'm using osm2pgsql with slim-mode + flatfile for my imports
and diff-updates and everything is running fine.
But now i need to create pbf-exports of my database and i would like to
access the node-data of the flatfile, because planet_osm_nodes is empty
(whicht is ok).
If you're speaking of the OSM PBF format, the osm2pgsql schema is
ill-suited for this, as it doesn't have all the metadata needed.
Is there any way to access those nodes by osm_id? I tried to write a litte
program starting with node-persistent-cache-reader.c but i did not manage
it. Many nodes are missing.
As Frederik mentioned, there's a bug. Make sure you're using 0.87.3 or
later, not 0.87.3-dev.
At the end i would like to write my own pg/plsql-Function get_node(osm_id)
which gives me the geometry of that node (reading the flatfile of course).
The right way to do this is probably to implement a foreign data wrapper
(FDW) as a PostgreSQL extension reading the flat-nodes file. This would
let it appear as a table and you could then JOIN to it and interact with
it as you normally would.
http://pgxn.org/dist/oracle_fdw/ and
http://www.postgresql.org/docs/9.4/static/postgres-fdw.html can give you
an idea how you interact with a FDW.
_______________________________________________
dev mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/dev