Dear all,

first of all I want to thank you in advance for even reading my post and any effort you will put into helping me. I highly appreciate your expertise and time you spend to help me.

Now to the problem:

I discovered OSM on Friday to solve a problem that I have. For a certain area, I want to extract all the street names. Originally, I would just go to Google Maps and click on every street to get the street name, but I think that is very inefficient and I want to make it way easier. When it comes to coding etc, I am a total noob and I don't really know what I am doing.

So I stumbled upon this Question here to help my problem.

It is very useful, so far I installed Osmosis and got it running. The country that I want data from is Portugal. I managed to get the street names from a rectangle, however, the areas that I want are more complex like a mulitpolygon.

For that, I downloaded JOSM and its here where the first problem starts. I have no clue if I do it the right way, but I basically downloaded the GPS data from Lisbon. Actually I just needed the satellite map, but I had no idea how to get that on JOSM. Then I drew some nodes of my area and made it into a Multipolygon and saved it as an osm.file. I provide a link so you get the picutre:

alt text

Not sure if I am on the right track, but I downloaded Perl and installed it. In the Command line I put:

"perl PathToOSM2PolyScript PathToMultipolyFile"

The results were correct like the ones in the Question link that I posted, however here is the big problem: How do I get the results into a .poly file that can be read by Osmosis? This is where I am stuck.

Additionally, the last thing whats missing is then to filter the .osm file that contains all the data. I figured I can just open the .osm file with Excel and I get so much data, but how to I filter only for the street names?

I saw that in the Answer to the posted Question, the guy provided a line like this:

"sed -n 's/.*k="name" v="//;T;s|"/>||;p' Stockholm-names.osm |sort -u"

But where is that line put into? How does it work?

You guys see, I am not an expert in IT, but its really on my heart now to solve this problem. I tried to go ahead as far as I can all by myself. But now I got to a point where I can't go any further without help. So I am sorry to bother you guys, but please do help me with any solutions or suggestions.

Thank you in advance

Kind regards, Tom

asked 17 Feb '18, 14:30

J4ckaroo's gravatar image

J4ckaroo
16112
accept rate: 0%

edited 21 Feb '18, 19:23

aseerel4c26's gravatar image

aseerel4c26 ♦
31.9k16237548


Regarding your first question, how to create the extract you are looking for: You could download the "poly" plugin for JOSM which would allow you to save your polygon directly as a .poly file, no need for osm2poly then, followed by the appropriate osmosis (or osmium-tool) command. OR go the extracts.bbbike.org where you can draw your polygon on the web site and request an extract for exactly that polygon, no further tools needed!

Regarding your second question, how to get all street names in an extract, there are many different ways to do that but since you already have JOSM, you could try to load the file in JOSM, then select everything that has a highway tag and a name tag (the search box is quite informative), and save just the selected objects into a new file (you might need to create a new and empty file and copy over the selection). In the resulting XML file, find all lines that look like

<tag k='name' v='something' />

and you have your names.

permanent link

answered 17 Feb '18, 23:07

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
69.9k806321095
accept rate: 24%

Frederik Ramm, thank you so much! You have no idea how much you helped me! I really appreciate it, you are my most favourite person of the month, hahah!

I can't thank you enough!

The last thing I need is only, how do I execute the code that you used? With which program and where? Remember I am a noob :p

Cheers!

(19 Feb '18, 17:04) J4ckaroo

If by "how do I execute the code that you used" you mean "how do I find all lines that look like ... after I have saved all highways to a separate file in JOSM" then the answer is that there are many ways to do it. On Linux I would use the "grep" utility, writing something like

grep "<tag k='name'" my-saved-file.osm | cut -d\' -f4 | sort -u > allnames.txt

but you could, for example, simply load the file you have saved into a word processor or spreadsheed program and then sort all lines, and identify the block that begins with "<tag k='name'" manually...

(19 Feb '18, 21:42) Frederik Ramm ♦

I managed, thank you sooooo much!!!

(21 Feb '18, 16:47) J4ckaroo
Your answer
toggle preview

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:

×509
×107
×64
×37

question asked: 17 Feb '18, 14:30

question was seen: 814 times

last updated: 21 Feb '18, 19:23

powered by OSQA