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 |
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. answered 30 Jan '13, 11:30 SomeoneElse ♦ 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
|
I think this is related to this : http://gis.stackexchange.com/questions/2951/algorithm-for-offsetting-a-latitude-longitude-by-some-amount-of-meters answered 30 Jan '13, 12:38 fievel |
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 answered 30 Jan '13, 11:06 andy mackey 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
|