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

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%


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.

permanent link

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

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.

permanent link

answered 24 Apr '19, 08:15

volo86's gravatar image

volo86
36224
accept rate: 0%

edited 24 Apr '19, 08:27

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:

×129
×92
×36
×13

question asked: 05 Apr '19, 23:05

question was seen: 3,465 times

last updated: 24 Apr '19, 08:27

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