Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JSON output to stats script and use layer source #882

Merged
merged 15 commits into from
Jun 23, 2023

Conversation

ZeLonewolf
Copy link
Member

@ZeLonewolf ZeLonewolf commented Jun 20, 2023

Fixes #777

This PR overhauls the stats script.

First, it splits out all of the layer extraction commands into a separate "util" script since it's thematically different from stats generation.

Next, this changes the layer grouping to use the underlying source layer rather than thematic groups. This will improve our ability to assess how we're using OpenMapTiles layers.

Lastly, it adds a JSON output option, which is a prerequisite to showing stats deltas as suggested in #881.

@ZeLonewolf ZeLonewolf requested a review from 1ec5 June 20, 2023 01:31
@github-actions
Copy link

PR Preview:

Sprite Sheets:

Sprites 1x
Sprites 2x

@ZeLonewolf ZeLonewolf marked this pull request as ready for review June 20, 2023 02:13
scripts/stats.js Outdated Show resolved Hide resolved
@ZeLonewolf ZeLonewolf requested a review from 1ec5 June 22, 2023 01:45
@ZeLonewolf
Copy link
Member Author

node scripts/stats -j -pp
Returns:

{
  "layerCount": 349,
  "styleSize": 1005817,
  "layerGroup": {
    "background": {
      "size": 122,
      "count": 1
    },
    "landuse": {
      "size": 309,
      "count": 1
    },
    "park": {
      "size": 2365,
      "count": 3
    },
    "aeroway": {
      "size": 2059,
      "count": 7
    },
    "landcover": {
      "size": 361,
      "count": 2
    },
    "boundary": {
      "size": 13691,
      "count": 9
    },
    "water": {
      "size": 912,
      "count": 3
    },
    "waterway": {
      "size": 3543,
      "count": 3
    },
    "transportation": {
      "size": 920221,
      "count": 299
    },
    "building": {
      "size": 292,
      "count": 1
    },
    "transportation_name": {
      "size": 8838,
      "count": 3
    },
    "poi": {
      "size": 10094,
      "count": 2
    },
    "water_name": {
      "size": 4647,
      "count": 2
    },
    "aerodrome_label": {
      "size": 5951,
      "count": 4
    },
    "place": {
      "size": 32062,
      "count": 9
    }
  }

scripts/stats.js Outdated Show resolved Hide resolved
scripts/stats.js Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
scripts/util.js Outdated Show resolved Hide resolved
scripts/util.js Outdated Show resolved Hide resolved
scripts/util.js Outdated Show resolved Hide resolved
scripts/util.js Outdated Show resolved Hide resolved
@ZeLonewolf ZeLonewolf requested a review from 1ec5 June 23, 2023 01:00
CONTRIBUTING.md Outdated Show resolved Hide resolved
Co-authored-by: Minh Nguyễn <[email protected]>
@ZeLonewolf ZeLonewolf merged commit e3ebcf4 into main Jun 23, 2023
@ZeLonewolf ZeLonewolf deleted the zlw-source-layer-stats branch June 23, 2023 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Style statistics based on source layer
2 participants