Query Openstreetmap for specific amenity - openstreetmap

I want to query openstreetmaps api for amenitys near a specified city / coords. So something like
Find all hospitals near denver, within a radius of 50km. The openstreetmaps API Documentation doesn't say anything about amenitys or i didn't found that.
Is this possible via REST and if yes, how?

For this kind of request, you'll likely want to use Overpass API, which is a read-only API that's designed for queries (unlike the main OSM API, also known as Editing API, which is mostly useful for contributing to OSM).
Overpass API supports an around filter.
Your example – hospitals in a 50 km radius around Denver – might look like this. (This is a link to Overpass Turbo, which is a frontend that lets helps with building and testing Overpass API queries. Note that the Geocoding in the example is a convenience feature of Overpass Turbo. For regular Overpass API queries, you'll need to provide either the coordinates or OSM element(s) you want to filter around.)
To build your query, you will want to know which OpenStreetMap tags correspond to the feature types you're interested in. The OpenStreetMap wiki provides documentation for most commonly used tags, e.g. amenity=hospital in this example.

Related

How to use overpass api?

I am a total newbie so this may be a silly question, but I can't find any tutorials on how to query overpass api to display things on own website. Do I install it on my server or is there a code to query it in the script?
What I want to achieve is to have a searchbar on one page to search for tags, and that would display one random point with that tag on the other page with a leaflet map.
But I am struggling to even display any points on it. Would it be actually better to have a local geojson file with set list of points in one town if I want to limit them to just this town anyway?
I will be grateful for any help, it's a first time I am doing something like this and it horribly stresses me out
You can visually run and try overpass queries using http://overpass-turbo.eu/.
In order to unload the overpass server, it would be a good idea to fetch the data once (and update regularly) and host them on your own server (also pay attention to the terms of use of the specific APIs, they might limit the number of requests per hour or prohibit using the for autocomplete).
To query the server from an application, GET from https://overpass-api.de/api/interpreter?data=, followed by your request (the same you would type into overpass turbo, just without line breaks).
It is also possible to host an overpass instance on your own.
If you need to learn the Overpass Query Syntax first, you can read the docs.

Is mapbox geocoder API available for usage without a map?

I am reading through mapbox JS api but don't seem to find any the geocoding API call that would enable me to provide place lookup using my own typeahead component. So basically I am after sending out a query and receiving an array of results.
I do not mean the example on how to place geocoder Control on or off the map, but rather how can I provide places lookup in my own form [Angular, React, whatever] that does not display any map. Is that possible at all?
[UPDATE May 2020]
Mapbox now does allow you to use a Geocoder without using a map (search form with autocomplete)
July 1, 2019: Removed the default restriction that Services have to be
used in conjunction with a Mapbox map. Point of interest results from
the Geocoding API and Enterprise Boundaries must still be used in
conjunction with a Mapbox map.
Examples can be found from the Mapbox website and from Mapbox Github page.
This previous answer shows an alternative plugin/ service called Algolia that you can use to create a Geocoder.
Another alternative is to use Geocodio.
However, both Geocodio AND Mapbox Geocoder (without a map present) do not support POI (Point of Interest)
E.g. A named place including commercial businesses, public buildings, monuments, and parks, etc.
Hope this helps someone in the future!
This is apparently the violation of Mapbox's terms of service:
You may only use responses from the Geocoding API ("Geocodes") in
conjunction with a Mapbox map.
That's the reason why mapbox-gl-js MapboxGeocoder control (which consumes Mapbox Geocoding API) comes in conjunction with a Mapbox map only and means your scenario is not supported.
July 1, 2019: Removed the default restriction that Services have to be used in conjunction with a Mapbox map. Point of interest results from the Geocoding API and Enterprise Boundaries must still be used in conjunction with a Mapbox map.

Mapbox GL JS Geocoding to only reference Tileset

I'm using Mapbox's Geocoding (search box) and was wondering if there's a way that it would only reference my Tileset data rather than the generic global address search? Looks like Mapbox has a "Supplement geocoding search results from another data source", however the example is referencing geographic coordinates rather than addressing. So I'm still not sure if this is possible?
Basically I want to enter an address in the Geocoding search box and to have a particular polygon selected from my dataset on the map. Any help would be greatly appreciated.
The example you linked to shows how to supplement search results with a local source, not a remote source in the https://github.com/mapbox/mapbox-gl-geocoder.
Currently Mapbox doesn't provide a Geocoding API against your own data however depending on how large your dataset is (and assuming it's a Mapbox Dataset and not just a Mapbox Tileset) you could use the Datasets API to read in every feature into the client with https://github.com/mapbox/mapbox-sdk-js/blob/master/API.md#listfeatures and use the results of that to power the mapbox-gl-geocoder search like https://www.mapbox.com/mapbox-gl-js/example/mapbox-gl-geocoder-local-geocoder/

Getting 'Mountain' and other geographic entity types from Bing APIs

I've been trying to figure out how I can get 'Mountain' and other geographic entity types from the Bing Maps REST Location API. Using the "Find a location by Point" returns very little information.
Perhaps using the Bing Maps REST API isn't the best place for the kind of information I'm looking for, basically natural geographic features like mountains, lakes, etc. Any recommendations?
'Tanks.
Those types of feature (mountain, hill...) are not available inside the Bing Maps platform wether in the REST service or the Public Data Source from the Spatial Data Service (see the available categories: http://msdn.microsoft.com/en-us/library/hh478191.aspx)
In order to do so, depending on your needs, you can rely on OSM data or geonames information to retrieve information about places and known mountains/lake, see: http://www.geonames.org/search.html?q=mont+blanc&country=

Extract map information from Bing Maps

I would like to write a navigation software for windows phone 7 that is available without being on the internet. Therefore, I would like to download the map information from Bing maps. Not the entire world or country, just a small city - because this software is just for me and I only need navigation within my home town.
What I basically need is something similar to the map export that OpenStreetMap offers. I could not find anything equivalent on bing maps, so I wrote a program that queries bing maps (through the API) for routes. It then saves intersections and thus builds a graph. This technically works and I get a lot of streets, but sometimes bing leaves out a single intersection. In that case, my data will become invalid.
So I was wondering if there is any way of asking the API directly for a map export, returning something like an array of streets that is within a certain boundary rectangle. (Or something similar)
Thanks for your help
No, there is no standard API call in Bing Maps API that will let you do this.
Downloading all the street data within "a small city" would violate the terms of service. See 8.2(r) at http://www.microsoft.com/maps/product/terms.html.
If you want that data, you can try OpenStreetMap or else you would probably have to license the data from a commercial provider of such things which is no doubt very expensive.