npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

id-area-keys

v6.5.0

Published

OpenStreetMap area tags extracted from the iD editor presets

Downloads

2,284

Readme

build npm version

id-area-keys

areaKeys

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.

Example:

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
    },
    ...
  }
}

isArea

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.

Example:
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 trees

area=yes / area=no

In 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.

License

id-area-keys is available under the ISC License.

Version

To keep things simple, the released version of id-area-keys is pinned to a recently released version of the iD presets.