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

I have imported the osm file into postgresql. The tables I have are planet_osm_ndes,planet_osm_ways, planet_osm_point. planet_osm_roads etc. But no table contains the information of neighbouring nodes of a node. I tried connecting to the database using java and tried finding the neighbours, but the code runs for hrs and still no output. Is there a easy way to do it

asked 12 Feb '18, 03:21

batraj's gravatar image

batraj
11112
accept rate: 0%

edited 12 Feb '18, 03:22


The osm2pgsql database schema is optimised for drawing maps; for this use case, neighbouring nodes are uninteresting. If you have used the --slim flag on osm2pgsql (which you apparently have since you mention planet_osm_nodes), you can look at the "nodes" array of ways in planet_osm_ways (step 1: find out which ways contain your node of interest, step 2: find out where in the node list your node occurs, step 3: find the nodes before and after, if applicable). However, it sounds as if your use case might warrant a different kind of database import that gives you easier access to the node/way connections, for example check out the "ApiDB" import offered by Osmosis.

permanent link

answered 12 Feb '18, 09:54

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

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:

×165
×134
×18

question asked: 12 Feb '18, 03:21

question was seen: 2,112 times

last updated: 12 Feb '18, 09:54

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