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

I'm trying to add just the names of parking lots to a names data set for our university. Using Overpass Turbo, I can extract a geojson file using the wizard by having it look for "amenity=parking and name=" This identifies the parking lots I need and I run the Overpass query and export the resulting geojson file. When I import the geojson file into the dataset in Mapbox, it imports the parking lots as polygons, where each polygon has a tag "amenity=parking" and "name=" However I'd like the parking lots to be represented only by its name in the center of the polygon. Is there a way to convert a polygon to a point in Mapbox or in the geojson file, or is there a way to have Overpass Turbo identify a lot, but only export it's name and location?

asked 04 Feb '19, 19:35

URcommunications's gravatar image

URcommunicat...
11224
accept rate: 0%


This outputs the centre of each parking place.

[out:json][timeout:25];
// gather results
(
  // query part for: “amenity=parking and name=*”
  node["amenity"="parking"]["name"]({{bbox}});
  way["amenity"="parking"]["name"]({{bbox}});
  relation["amenity"="parking"]["name"]({{bbox}});
);
// print results
out center;

Disclaimer - not tried importing it into mapbox, apologies if this is a red herring.

permanent link

answered 04 Feb '19, 23:03

andrewblack's gravatar image

andrewblack
3651214
accept rate: 57%

It worked perfectly! Thanks. Funny, I had generated almost exactly the same thing using the wizard but instead of "out center;" it had "out body;" That made all the difference. Thanks!

(05 Feb '19, 14:49) URcommunicat...

I generated this using the wizard then edited the bit at the botton. I often use "out center" a lot (UK readers note the spelling!). E.g. if I want to know where POIs are but am not interested in layout of the building.

(09 Feb '19, 11:02) andrewblack

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:

×228
×219
×71
×36

question asked: 04 Feb '19, 19:35

question was seen: 2,879 times

last updated: 09 Feb '19, 11:02

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