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

taginfo_to_gsheet

v1.0.1

Published

a simple script to get taginfo data and put it into a google sheet

Downloads

1

Readme

TagInfo to Google Sheets

A script to get information from the Open Street Map TagInfo API and append it to a Google Sheet for further presentation.

Intended to be run as a cronjob on a daily basis.

Installation

You need npm to install. This is bundled as part of node.js.

npm i -g taginfo_to_gsheet

Usage

taginfo_to_gsheet <googleSheetsCredentials> <tagInfoSearch>

  • googleSheetsCredentials
    • Path to Google provided credentials file (for accessing Google APIs)
  • tagInfoSearch
    • Path to file containing tagInfo search data in JSON format.

Format of tagInfo search data

[
    {
        "tag_info": [
            {"name": "oneway", "key": "oneway", "value": "yes"}
        ],
        "google_sheet_id": "<sheet-id-goes-here>",
        "worksheet_number": 0
    }
]
  • tag_info
    • An array of searches that you'd like to perform.
  • google_sheet_id
    • The id (as found in the last part of the google sheet's URL)
    • Ensure the sheet has the following columns date, tag, all, nodes, ways, relations
  • worksheet_number
    • E.g. 0 for the first worksheet, 1 for the second etc

Options for tag_info searches

  • {"name": "food standards", "key": "fhrs:id"}

    • search for instances of the key fhrs:id
  • {"name": "oneway", "key": "oneway", "value": "yes"}

    • search for oneway=yes
  • {"name": "paths and footways", "key": "highway", "values": ["path","footway"]}

    • search for database entries (nodes, ways, relations) that match highway=path or highway=footway
  • {"name": "need fixing", "keys": ["fixme", "FIXME"]}

    • search for instances of the key fixme or FIXME
  • {"name": "designations", "key": "designation", "values": ["public_footpath","public_bridleway"], "matches_key": "highway"}

    • searches for designation=public_footpath or designation=public_bridleway that appear on highway=*
  • {"name": "designations for footpaths", "key": "designation", "values": ["public_footpath","public_bridleway"], "matches_key": "highway", "matches_values": ["footway","path"]}

    • searches for designation=public_footpath or designation=public_bridleway that appear on either highway=footway or highway=path

Multiple searches

You can run multiple searches in 2 ways.

  • Firstly you can have many values for "tag_info" and they will all be added to consecutive lines in the google sheet
  • Secondly you can have multiple entries, each with their own google_sheet_id and worksheet number.

In the following example "oneway" and "paths and footways" both go on the same sheet, and "need fixing" goes on a different worksheet.

[
    {
        "tag_info": [
            {"name": "oneway", "key": "oneway", "value": "yes"},
            {"name": "paths and footways", "key": "highway", "values": ["path","footway"]}
        ],
        "google_sheet_id": "<sheet-id-goes-here>",
        "worksheet_number": 0
    },
    {
        "tag_info": [
            {"name": "need fixing", "keys": ["fixme", "FIXME"]}
        ],
        "google_sheet_id": "<sheet-id-goes-here>",
        "worksheet_number": 1
    }
]

Creating a Google Service Account

  • Create / Activate a Google Developer account
  • In the Google Dashboard, create a new project
  • Activate the Google Sheets API for that project
  • With the Google Sheets API selected, create a Service account.
  • Edit the service account and add a key to it.
  • When adding a key, there is a JSON option, choose this and that's the file you'll need.
  • Add the email of the service account to the sheet you'd like to add to by 'inviting' them to edit the sheet.

Development

If you are working locally with this repo, then use npm link to create the taginfo_to_gsheet binary from the local source code (and use npm unlink to clean up afterwards)