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

@jawg/taxonomy

v1.3.0

Published

Building a map taxonomy chart with style.json

Downloads

10

Readme

Taxonomy

Map taxonomy chart for mapbox GL styles.

Thanks Nath Slaughter @natslaughter for the original article and idea of taxonomy.

Read the original article here

Read the new article about this tool here

GitHub Page and Live Demo

screenshot

Usage

Simple page

For a simple view of your taxonomy chart, you can use our demo on github. Here is the link and what it should look like :

https://jawg.github.io/taxonomy/demo?url=<your-style-url>

Without style url in the query parameter, it will show our simple example.

Web integration

You can add your taxonomy chart in your website or blog by using this code in your HTML :

<head>
  <link rel="stylesheet" type="text/css" href="https://jawg.github.io/taxonomy/dist/style.css">
</head>

<body>
  <taxonomy style-url="<your-style-url>"></taxonomy>
  <script src="https://jawg.github.io/taxonomy/dist/taxonomy-bundle+riot.js"></script>
</body>

Specification

Global metadata

{
  "metadata": {
    "taxonomy:title": "Global taxonomy title",
    "taxonomy:groups": [
      {
        "id": "admin-boundaries",
        "type": "line",
        "title":"Administrative boundaries"
      },
      {
        "id": "roads",
        "type": "line",
        "title":"Roads",
        "zooms": {
          "minzoom": 5,
          "maxzoom": 20
        }
      },
      {
        "id": "landcover",
        "type": "polygon",
        "title":"Water & Landcover",
        "zooms": 13
      },
      {
        "id": "places",
        "type": "symbol",
        "title":"Political & Place Labels",
        "zooms": [2, 4, 6, 8, 10, 12, 14, 16]
      },
      {
        "type": "annotation",
        "content": "<div style='font-size: 12px; text-align: center;'>Annotation for ending</a></div>"
      }
    ]
  }
}

taxonomy:groups

  • taxonomy:title: This is the title that will be displayed on the top of your taxonomy.
  • taxonomy:groups: This an array of objects in your style metadata. Required
    • id: This is the identifier for your taxonomy group. This will be use for your layer grouping. Required.
    • type: This is the type of your style object. This is use for the taxonomy rendering. One of line, polygon, symbol and annotation. Required.
    • title: This is the title that will be displayed for your taxonomy group.
    • zooms: This is all zoooms where taxonomy will be computed. Can be array, number, object. Default zooms from 1 to 19.
      • Examples:
        • array: [0, 2, 4, 6, 8, 10, 12, 14], [5, 6, 7, 8]...
        • number: 3, 16...
        • object: minzoom and maxzoom are required {minzoom: 5, maxzoom: 20}, {minzoom: 0, maxzoom: 12}...

Layers metadata

{
  "id": "layer-id",
  "ref": "layer-for-casing",
  "metadata": {
    "taxonomy:group": "taxonomy-groups-id",
    "taxonomy:casing": "layer-for-casing",
    "taxonomy:example": "Example for symbols",
    "taxonomy:matches": [
      { "name": "meta-layer-name", "get:class": "value-from-tile", "example": "Example for symbols" }
    ]
  }
}
  • taxonomy:group: This must match a taxonomy:groups.id from your global metadata. Required.
  • taxonomy:casing: This will refer to another layer id. That's mean the current layer is the casing of the layer pointed by taxonomy:casing. This layer must be a line type. This will render an outline for taxonomy:casing (We can also use ref id from your layer).
  • taxonomy:example: This is a text example for symbols groups. Default text is layer id.
  • taxonomy:matches: This is an array of objects that will process a match or case expression.
    • name: The name or title to display for this example.
    • example: The text to display if it's a symbol.
    • [expression]:[key]: The value to return when this expression is found, this should be a value that can be found in your tile. You can add many expressions.
      • Example {"name": "Green Grass", "get:class": "grass"} will display Green Grass and replace occurences of ["get", "class"] by grass.

Concrete example

See example.json

Credits

Powered by JawgMaps

Sponsored by Qwant