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

Get list of cities in region (circle).

0

Hello guys! I need to get list of cities in region.

  1. pick a point on a map
  2. enter the circle radius
  3. paint a circle around point with this radius
  4. get all cities in circle

Now I'm using OpenLayers and draw circle with RegularPolygon.

I think I need your advice how should I make it if it is possible.

Thanks in advance!

asked 24 Jan '19, 15:15

Aaalexxx's gravatar image

Aaalexxx
16113
accept rate: 0%

edited 24 Jan '19, 15:47


One Answer:

1

Sorry for being very brief, but you can use OverPass to query anything you want around a certain point with the around function

So in OpenLayers you have to convert the click to lat/lon, then construct an http-request to the Overpass API with around in the query, do the http-request, parse the result and show it somehow. I'm sure you can find examples of combining Overpass and OpenLayers.

answered 25 Jan '19, 06:47

escada's gravatar image

escada
19.0k16166302
accept rate: 21%

Source code available on GitHub .