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

Hello, I'm newbie with the .osm files and I'm trying to get All streets names from a Country with the ID of the city, filtering the file with osmfilter. Now I'm trying to get them with: ./osmfilter ...o5m --keep="highway=cycleway highway=path highway=primary highway=residential highway=tertiary" > ....o5m But I'm getting nodes without bodies and I can't figure out which is the City ID.

Regards

asked 06 Apr '14, 17:58

Petar81's gravatar image

Petar81
26225
accept rate: 0%

edited 06 Apr '14, 18:42

scai's gravatar image

scai ♦
33.3k21309459

are you sure that you only get an osm file with only nodes and NO ways?

And about the city where each way belongs to: Tell us where any filter program should know what belongs to a single city in the area you need. Are there good boundary relations or boundary ways for each city? or do you want to differentiate address data via the addr:city tag?

(08 Apr '14, 15:53) stephan75

Hello, I'm not familiar with osm files like I said, I don't know if I need to get ways or nodes, I read somewhere in the documentation that for each street there is ID of the City which it belongs to. I extracted the Cities successfuly and now I'm trying to get the streets. That's all. I want to put them in 2 MySQL Tables and list them Cities and Streets

(09 Apr '14, 16:18) Petar81
1

Would it be possible to link to the "I read somewhere..." link?

(09 Apr '14, 16:59) SomeoneElse ♦
1

Petar, if you want to use raw OSM data for your aims you should at least get familiar with the model of OSM elements ... see http://wiki.openstreetmap.org/wiki/Elements as a starting point.

You wrote: "I extracted the cities successfully" ... How did you do that in detail?? Tell us please so that we can lead you to a solution.

Getting a list of all streets belonging to a certain city is definitively possible with OSM data.

(09 Apr '14, 19:33) stephan75

Like I said I used OSMFILTER for this:

./osmfilter32 country.o5m --keep="place=city or place=town" --ignore-dependencies --keep-tags="all place= is_in:country= name:bg= name:en=" > coutry-cities.o5m

Simple as that. Now I'm trying to get ALL street. I'm now using "<way>" and to keep the "addr:tag" BUT it not all <way>s have addr:city..., THIS is my osmfilter details: ./osmfilter32 coutry.o5m --keep-ways --drop-nodes --keep-tags="is_in:country= name:en= name= name:bg=" --keep="highway=cycleway or highway=path or highway=primary or highway=residential or highway=tertiary"

country-streets.o5m

(11 Apr '14, 11:36) Petar81
1

Please be aware that having any addr: tag on any highway in the main OSM data you have downloaded is basically WRONG!

Because addr: tags are to determine the position of addresses, and NOT any streets belonging to a city.

So if you have cities or places with addr: tags in your area, that is "not so good tagging style" about the raw OSM data.

(11 Apr '14, 12:26) stephan75

So that's just Wrong, ok. Then how to use the raw OSM data to get streets names with Cities without Polygon in MySQL?

(11 Apr '14, 12:55) Petar81
2

You need polygons, or to be more exact in OSM language: you need boundary relations that display the boundary around a city or a place.

It depends on the area what you are aiming at whethet these boundary relations are already in OSM database.

Either tell us the area you are aiming at, or have a look on your own via http://openmapsurfer.uni-hd.de -> choose layer: OSM roads grayscale and overlay: OSM admin boundaries.

(11 Apr '14, 14:14) stephan75

I'm aming at: user inputs City from database and that selects all streets from the City. Can you give me example how to extract all Cities and Streets from given Country and put them into MySQL? Thank you in advance =)

(11 Apr '14, 14:42) Petar81

Re "... that selects all streets from the City" - what criteria should be used to determine that a particular street is within the city?

(11 Apr '14, 14:45) SomeoneElse ♦

The criteria is if it is in the city(even if it continues to other city) or it's very small in size, to be shown as IN the city. And only show up 1 in the results(because I read that a street can be represented as multiple vectors).

(11 Apr '14, 14:50) Petar81
1

OK, but how does the server that you're talking to know whether it's in a city or not? A way in OSM will NOT have an attribute of what city it's in - it just has nodes, each of which has a latitude and longitude value (as previously mentioned, see http://wiki.openstreetmap.org/wiki/Elements for more info).

(11 Apr '14, 14:54) SomeoneElse ♦

I found this link: http://cdn.oreillystatic.com/en/assets/1/event/56/Openstreetmap%20-%20_PostGIS%7CMySQL%7CSpatiaLite%20-%20OpenLayers%20From%20Map%20to%20Web%20Presentation.pdf

The guy which has created it, have tables(if you see page 21): 1) Planet_osm_polygon 2) Planet_osm_roads He's using Planet polygon for cities(not sure how) and he has separate table for all roads.

But how to separate the Cities in the Planet_osm_polygon?

I want to do it like here: http://services.gisgraphy.com/public/geocoding_worldwide.htm Choose Country, choose City, list all Streets. How can it be done?

(11 Apr '14, 15:24) Petar81
showing 5 of 13 show 8 more comments

looking further at the website of gisgraphy.com they say that their framework is opensource, and they have installation instructions if you want to set up an own server.

Have you tried that already?

permanent link

answered 11 Apr '14, 16:30

stephan75's gravatar image

stephan75
12.6k556210
accept rate: 6%

There is one problem - This is JAVA application. I need it to be PHP. Secondly for the server part I will need 155 GB of space which is a lot for just Streetnames and cities... Is there an alternative way I can use for PHP?

(12 Apr '14, 11:15) Petar81

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:

×219
×107
×60
×33

question asked: 06 Apr '14, 17:58

question was seen: 10,511 times

last updated: 12 Apr '14, 11:15

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