Askerma NaN
Askerma NaN

Reputation: 23

Look for specified place type with OpenStreetMap and Nominatim

In my app, I use Leaflet with OpenStreetMap. I also use Nominatim to get place details. I want to check whether the place is gas station. But, when I point to gas station, and get place details, the JSON file often have different "type" property. It can be:

type: "fuel"   <-- this is great
or
type: "convenience"
or
type: "yes"
or maybe even other

Can I, somehow, specify if place is really a gas station?

Example JSON output for a GAS STATION https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=50.0487556&lon=21.999057381458194

place_id: 143194204, licence: "Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright", osm_type: "way", osm_id: 230603036, lat: "50.0487556", …}
place_id: 143194204
licence: "Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright"
osm_type: "way"
osm_id: 230603036
lat: "50.0487556"
lon: "21.999057381458194"
place_rank: 30
category: "shop"
type: "convenience"
importance: 0
addresstype: "shop"
name: "Orlen"
display_name: "Orlen, 10, Warszawska, 1000-Lecia, Rzeszów, województwo podkarpackie, 35-205, Polska"
address: {convenience: "Orlen", house_number: "10", road: "Warszawska", suburb: "1000-Lecia", city: "Rzeszów", …}
boundingbox: (4) ["50.0486885", "50.0488243", "21.9989449", "21.9991699"]
__proto__: Object

I considered using Google Places API with Geocoding API, but Geocoding requires billing account, so I'd not use that.

EDIT:

Thanks to below comment, I managed to get raw data from OSM by using osm_id from nominatim reverse geocoding call. Just use: http://overpass-api.de/api/interpreter?data=[out:json];way(MY_OSM_ID);out;

Upvotes: 1

Views: 2986

Answers (1)

scai
scai

Reputation: 21469

The object from your question is both a gas station and a convenience shop. It is tagged as amenity=fuel and shop=convenience. However Nominatim has to decide which type to print and apparently convenience has a higher priority than fuel.

If you want to check the tags of a specific object then Nominatim is probably the wrong choice. Nominatim is a geocoder, intended for converting names into geographic coordinates (geocoding) or vice-versa (reverse-geocoding). If you already know the OSM ID and element type then you can download its raw data directly from OSM to check all original tags. If you just know the rough location then you could use Overpass API to download specific POIs (e.g. fuel stations) in this area.

Upvotes: 0

Related Questions