How to get all street names of city

Hi all,
Please share for me, How to get all street names of city

1 Like

The most usual tool to extract data from OSM is by using Overpass (https://overpass-turbo.eu/).
A simple way to get all street names from a place, “Brinches” in the example bellow, consists of a query to the database with something like


[out:csv(highway,name)];
area
  [name="Brinches"];
way(area)[highway][name];
out;

Just copy and paste this code to the text area on the left side of the Overpass page, change the name of the place to the place you pretend to evaluate, run the query and select the folder “Data” on the upper right side of the page to see the results.

2 Likes

Cool feature.
When asking for Rome (Italy), a “quota limit” comes out.
What to do?

I ran the query now for area[name=“Roma”], it seems to works fine on my computer, I got more than 40,000 street names.
Perhaps the server was busy with other requests at the time you tried to run the query.
But keep in mind that I haven’t found any city limits with that name (“Roma”), only the district is named “Roma”, so you’ll probably get more information than you want, like suburban streets or neighboring villages.

Try to use this query in overpass:


[out:csv ("name")][timeout:2500];
{{geocodeArea:Roma}}->.searchArea;
(
  way["highway"]["name"](area.searchArea);
);
for (t["name"])
{
  make street name=_.val;
  out;
}

https://overpass-turbo.eu/s/1bcc
This query extracts street names list from area without duplicates. This query returns 16715 records for Roma instead of 40000.

1 Like

I do

[out:csv ("name")][timeout:2500];
{{geocodeArea:Kaliningrad}}->.searchArea;
(
  way["highway"]["name"](area.searchArea);
);
for (t["name"])
{
  make street name=_.val;
  out;
}

I did not receive the entire list, for example there is no Moscow avenue

Is there a street with this name in Kaliningrad? I can’t find it on Opensteetmap. Could you send way ID of this street in OSM?

way 297727234

It’s kind of the only street left, because now my list is longer than it was. Thanks for the sample code. I wonder if it is possible to compose a query to get the streets and their geometries? Because now it’s like this
I have an array of streets

$response = json_decode(curl('https://nominatim.openstreetmap.org/search?format=json&q=' . urlencode($f['city'] . ', ' . $f['street']) . '&polygon_geojson=1'), true);

Using your query for Kaliningrad I did found ‘Московский проспект’ on street names list. You should try again. Copy whole list and paste content to notepad, than use find function.

Here is search result on image:

1 Like

Hello,
I am building an app where I should display all the street names in a drop down when the user selects a city.
Is there a way to include the overpass Api in my code?
I am using javascript.

Thanks

Hi,

@

Is there a way to add a column representing the city name and another with the postal code?

Thank you

Hi, is it posible to obtain in the same file the ID of the street?

Are you aware that one street in real life CAN exist in the OSM database by a chain of many single way elements?

So you want to have the OSM object ID number of a single element, or of all elements of a street?

1 Like

[out:csv (“name”)][timeout:2500];
{{geocodeArea:Roma}}->.searchArea;
(
way[“highway”]“name”;
);
for (t[“name”])
{
make street name=_.val;
out;

2 Likes

How to get all street names of city in italy based the zip code?
tks

Has anyone resolved how to ensure that the list of street names generated is for only the city they are interested in ie not cities in other countries by the same name. I have generated a list of street names for Wellington but it includes all cities in the world named Wellington. I am interested in a list of Wellington, New Zealand street names only.

Thanks!

1 Like

QLever is a good tool for gathering statistics within an arbitrary boundary. This query returns an alphabetical listing of the name=* values of streets and paths that lie wholly or partially within Wellington City (relation ID 4266321).

PREFIX osmkey: <https://www.openstreetmap.org/wiki/Key:>
PREFIX osmrel: <https://www.openstreetmap.org/relation/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX osm: <https://www.openstreetmap.org/>
PREFIX ogc: <http://www.opengis.net/rdf#>
SELECT ?name WHERE {
  osmrel:4266321 ogc:sfIntersects ?street .
  VALUES ?street_types {
    # highway=* values that represent streets.
    "motorway" "motorway_link"
	"trunk" "trunk_link"
	"primary" "primary_link"
	"secondary" "secondary_link"
	"tertiary" "tertiary_link"
	"unclassified" "service"
	"residential" "living_street"
	"pedestrian" "busway"
	"proposed" "construction"
  }
  ?street osmkey:highway ?street_types .
  ?street rdf:type osm:way .
  ?street osmkey:name ?name .
}
GROUP BY ?name
ORDER BY ASC(?name)

Wikibooks has some documentation about SPARQL, the query language you see here, though it’s written for a different analysis tool.

1 Like