An overview of using OpenStreetMap data in your applications
key=value
.
For example, the above features could be tagged:
highway=primary
, highway=residential
, man_made=bridge
building=*
natural=coastline
, leisure=park
*
(asterisk) to signal any value should be accepted. This is especially useful for buildings,
where building=yes
and building=house
could both be drawn as buildings, and names, to filter out
unnamed items for labelling.
Finding the right combination of tags for the features you want to download starts with
searching the TagInfo website for your target feature.
To help users find the right tag inside your application, you can embed an OpenStreetMap tag search
in your map. This lets users search “National Park” and get served potential OSM tags that are relevant to their query.
highway=path
and filter for named hiking trails
by also asking for
name=*
.
We can download features by hitting the OSM extract API with our tags highway=path&name=*
.
Here’s an example searching in Australia’s state of Tasmania:
features
is an array of the downloaded features. Here’s one of those features from our hiking trail extract,
the “Wilson Bight Track” hiking trail in Tasmania, Australia:
properties
as a JSON dictionary. Keys are typically lowercase
and describe the geometry’s purpose on the map. The geometry contains coordinates in (longitude, latitude) order.
source
: