Hello,

My question is perhaps simple but I'm beginning in GIS development. I want to query all nodes with a specific attribute set around my device, all I know is my current GPS position.

For example, I want to find all nodes in a radius of 300 meters around me. I think I have to create a bounding box with coordinates matching this circle of 300 meters but I wanna know if a service exists in the api to create this box or if not, what is the formula I can use.

My known input parameters are the current position location (coordinates) and the radius in which I want to query and I want the list of all availables nodes or at least the coordinates of the bounding box suitable for overpass api queries.

Thanks in advance,

asked 29 Jan '13, 17:16

fievel's gravatar image

fievel
41114
accept rate: 0%


The "great circle" distance between two points on the Earth's surface can be calculated using the Haversine Formula. There may well be an implementation of that available to you in whatever toolkit you're using.

If not (or if it looks too complicated), and if you're only interested in a small area (say around your local city) then you could just cheat and use whatever longitude-to-metres conversion works at your latitude (just measure it) to ensure that your BBOX is big enough to return all of the data that you might be interested in.

Obviously a bounding box is by its very nature rectangular rather than circular, so if "within 300m" is an exact requirement rather than just a way of saying "fairly close" you'll need to do some calculations with the data that you get back.

permanent link

answered 30 Jan '13, 11:30

SomeoneElse's gravatar image

SomeoneElse ♦
32.0k63330748
accept rate: 15%

I will check for the formula, thanks. For your last remark, I'm conscious about that, in fact I think the bounding box will be something like the smallest square englobing the circle of 300m radius from my location.

(30 Jan '13, 11:41) fievel
permanent link

answered 30 Jan '13, 12:38

fievel's gravatar image

fievel
41114
accept rate: 0%

I guess you have seen this recent question and you also want do it in an app. The wiki as quite a lot of info reguarding bounding boxes,tiles and zoom levels. have you looked carefully at that? https://help.openstreetmap.org/questions/19227/find-coordinates-of-bounding-box

permanent link

answered 30 Jan '13, 11:06

andy%20mackey's gravatar image

andy mackey
11.7k74126259
accept rate: 4%

Well that's not exactly the same problem because he have the map, I don't want to display the map at all, just find nodes that are interesting to me around my position.

(30 Jan '13, 11:28) fievel
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:

×350
×108
×10

question asked: 29 Jan '13, 17:16

question was seen: 4,592 times

last updated: 30 Jan '13, 12:38

powered by OSQA