This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Highlight multiple cities boundaries

0

Hello from Italy! I'm pretty new in OSM.

I'm trying to highlight the boundaries of an area determineted by a list of cities. I know that every city have a relation number and I know how to extract the boundaries of a single city (using nominatim or geojson.io that looks better for me), but how can I combine multiple cities in one single map?

LIST EXAMPLE:

Milano (relation 44915) Corsico (relation 44993) Rho (relation 44993)

Sometimes the list is longer than 30 cities.

Is there a way to make this? Thanks!

asked 05 Apr '19, 23:05

volo86's gravatar image

volo86
36224
accept rate: 0%


2 Answers:

2

Overpass-API is a straightforward way to retrieve the data, using a simple script that just asks for each relation:

(
  rel(44915);
  rel(44993);
  rel(45188);
);
out geom;

Overpass Turbo adds several export formats for data retrieved from Overpass-API, check the export button there. You could pick a suitable one and load that into geojson.io or such.

answered 07 Apr '19, 13:06

maxerickson's gravatar image

maxerickson
12.7k1083176
accept rate: 32%

oh thanks! it was so easy (for who know what is doing). Thanks again! Any hint about how to automatically retrieve relation id starting from city name?

(08 Apr '19, 08:20) volo86

City name to relation ID can be done via a geocoder, for example Nominatim.

(08 Apr '19, 09:12) scai ♦

ok, I understand that but I was wondering if is possibile to write the same code using the name of the city instead of the relation id (or create a spreadsheet where in column A I write the name of the city and in column B appear the rel id)

(08 Apr '19, 16:08) volo86
1

Something like http://overpass-turbo.eu/s/HO5

The assumption that the cities you are looking for all have an admin_level=8 tag may break down.

The .searchArea stuff restricts the results to matches inside of Italy.

(08 Apr '19, 17:23) maxerickson

0

I am practicing with turbo overpass but I can't understand how to manage city names with the apostrophe or composed of two or more words (for example "Villa Sant'Angelo"). If I write "rel [admin_level = 8] [name = Villa Sant'Angelo] (area.searchArea);" overpass gives me an error. any suggestions? thank you

Edit: I understand that I need to replace spaces with underscore, but the problem remain for apostrophe.

answered 24 Apr '19, 08:15

volo86's gravatar image

volo86
36224
accept rate: 0%

edited 24 Apr '19, 08:27

Source code available on GitHub .