Hi, I would like to use the OSM data in my application but I'm not sure if it is feasible in an easy way. I need to extract country bounding boxes. My use case looks like: user sends his coordinate to my app and the app should return a country name where the user is. The app must run in offline mode, so it's not possible to send request to the OSM. I know that bounding boxes do not give me very good accuracy, but I think it should be enough, because it's a trade off between accuracy and performance. If you have any hints or advices for me, I would be very grateful. So my question is: Is it possible in an easy way to extract from the OSM country bounding boxes as a set of boxes for each country (including islands and other country areas)? asked 28 Aug '14, 08:08 ChrisOPL |
This site https://wambachers-osm.website/boundaries/ allows you to download all boundaries (countries, but also other admin levels) in a variety of formats. Is that what you are looking for ? Data is extracted from OSM. answered 01 Oct '14, 16:58 escada Frederik Ramm ♦ |
Nominatim returns the bounding box for relations in its XML output, for instance http://nominatim.openstreetmap.org/search?q=United+Kingdom&format=xml. You can make sure you’ve got the relation for the country as it will be tagged as answered 28 Aug '14, 22:31 Wynndale Thanks for the answer. You assumed that I have a country name. Unfortunately I'm looking for a solution where I have boundaries for all countries. It means that I need to extract all boundaries, because in my app I have to check if a user coordinate is inside a country. One more thing here is that "United+Kingdom" query doesn't return for example islands of the UK.
(29 Aug '14, 16:20)
ChrisOPL
|
Does anyone know other solution than Wynndale wrote above? I tried to use data from http://www.naturalearthdata.com/ but it is not good enough for me (e.g. there are missing islands). answered 01 Oct '14, 08:34 ChrisOPL |
You can go to your database directly and query for country polygons like so
(This query will run for a while, add "LIMIT 5" or so to test it without waiting.) This query returns multipolygons for the countries, but you could further refine the query to use something like
which would then give you a series of bounding boxes for each country. answered 13 Oct '16, 09:33 Frederik Ramm ♦ |
[meta] Why am I not able to convert this answer to a comment to the first answer?? On other threads its works for me here!
@stephan75 Unfortunately OSQA has been updated recently and is now full of bugs ;( Converting answers to comments doesn't always work anymore.