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


I am trying to create a database with cities and their streets.

Could you write down the best way to do that? Unfortunately a lot of the questions are quite confusing. (I already have my country's osm data.)


asked 23 May '17, 13:25

mutantChipmunk1's gravatar image

accept rate: 0%

I think you need to clarify this: do you want a listing of all street names by each city? By city do you mean large cities or any centre of population? Do you just want streets in urban areas or are rural roads OK too?

(23 May '17, 14:35) SK53 ♦

Yes, you are right. So i will try to specify my project. Actually I would like to keep all data from the roads file. If a street or road is in a city I would want to connect them somehow in my database. Here is my proplem, I cant seem to find the relation between the streets/roads and the cities in the downloaded file. And I will be needing the GPS coordinates of the element in the roads file, I already know that I need the points of the roads to do so. (I would like to visualize a streetmap.) Thank you for your help!

(23 May '17, 14:52) mutantChipmunk1

I suspect, given that you seem to be rather stuck early on, that your best approach is to use an "off the shelf" solution in the form of an osm2pgsql schema database and import your country data in to that.

That will provide you with the geometries of all the streets and administrative borders (if available in your country) which you can then use however you wish.

See (while these are instructions for a tile server, you can naturally use the data in the DB any way you see fit).

permanent link

answered 23 May '17, 16:04

SimonPoole's gravatar image

SimonPoole ♦
accept rate: 18%

Okay, I have it in my database, I used osm2pgsql and opened my database in pgAndmin4. But I just cannot find the connection between the cities and the streets. I have my tables, planet_osm_line, planet_osm_nodes, etc. I can see that a street contains nodes, and from the nodes I will get the coordinates. As a result I would need just a csv file or something like that.

(24 May '17, 15:15) mutantChipmunk1

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

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


question asked: 23 May '17, 13:25

question was seen: 3,603 times

last updated: 24 May '17, 15:15

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