I am very new to overpass api. I am trying to find a way to get nearby cities. i,e if I enter a city or a state, I should be able to get cities within that input area. And as an option, I want to filter the results for a specific country. I have tried several ways. But none of them seems to work.

[out:json];area["name"="India"][admin_level=2];area["name"="Kerala"]["border_type"="state"];(node["place"="city"]["name"="Cochin"](area);)->.center;node(around:10000)["place"];out;

Here India is the country Kerala is a state of the country And Cochin is a city inside that state. So I am trying to find the nearby cities of Cochin

asked 10 Apr, 17:08

zudheer's gravatar image

zudheer
112
accept rate: 0%


Hi Zudheer, you might want to take a look at overpass-turbo, it has a wizard (see menu-button on the top) which translates easy words to queries, great for experimenting and learning. I'Ve made you a quick example here ->

https://overpass-turbo.eu/s/HSo

On a little side-note, I think it'S safe to say this code:

  node["place"="city"](area.searchArea);
  way["place"="city"](area.searchArea);
  relation["place"="city"](area.searchArea);

can be shortened by:

nwr["place"="city"](area.searchArea);

Hope it helped!

permanent link

answered 10 Apr, 18:08

tijmenheid's gravatar image

tijmenheid
362310
accept rate: 0%

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:

×341
×162
×111
×62

question asked: 10 Apr, 17:08

question was seen: 142 times

last updated: 10 Apr, 18:08

powered by OSQA