This package contains the areaKeys data structure extracted from the
OpenStreetMap id-tagging-schema project.
Because of the open nature of OpenStreetMap tagging, there never be a complete list of tags used in OSM, so we want it to have logic like "assume that a closed way with an amenity tag is an area, unless the amenity is one of these specific types".
The areaKeys data structure allows testing of such conditions.
The returned object L is a keeplist/discardlist of tags. A closed way
with a tag (k, v) is assumed to be an area if k in L && !(v in L[k])
(see iD.osmWay#isArea()).
In other words, the keys of L form the keeplist, and the subkeys form the discardlist.
In this subset of the areaKeys data structure, we can see that any closed ways
with landuse=* or leisure=* are probably area
features. But closed way exceptions like leisure=slipway or leisure=track
are probably linear features.
{
"areaKeys": {
...
"landuse": { },
"leisure": {
"slipway": true,
"track": true
},
...
}
}This package also includes isArea utility function for testing
an OpenStreetMap object against the area list. The isArea function
accepts an Object of tags, and returns true if those tags imply
an area feature, or false if those tags imply a linear feature.
import { isArea } from 'id-area-keys';
isArea({ 'natural': 'wood' });
// true - a closed way tagged `natural=wood` is an area filled with trees
isArea({ 'natural': 'tree_row' });
// false - a closed way tagged `natural=tree_row` is a linear ring of treesIn OpenStreetMap, an area tag can be used to force or disambiguate whether
a closed way should be treated as a filled area (area=yes) or as a linear
ring (area=no).
Because area tags override the other tags, an area key does not appear
in areaKeys data structure, and users of this library must either handle
area=yes/area=no tags in their own code, or use this library's exported
isArea function, which does contain code to handle area=yes/area=no.
id-area-keys is available under the ISC License.
To keep things simple, the released version of id-area-keys is pinned to a recently released version of the iD presets.