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

occrp-story-map-generate-geojson

v0.2.6

Published

Generates GeoJSON for use with OCCRP story map at occrp-story-map

Downloads

16

Readme

occrp-story-map-generate-geojson

This is a standalone CommandLine tool that generates GeoJSON for use with occrp-story-map.

The tool will read from a stories.json file in the format of the occrp-story-map project, and will query an OSRM compatible API for directions between the points in the story.

It will then output these points as GeoJSON to the file specified by the OUTPUT variable either on the command-line or in the .env file.

Getting started

Note: This library is intended as a dependency for occrp-story-map. It functions as a standalone, but it's not really useful.

Setting up for development

yarn install
cp .env.sample .env

Executing the command-line tool

./bin/run

Flags

| Option | Description | | ---------------- | ---------------------------------------------------------- | | --version -v | Display version | | --help -h | Display usage information | | --output -o | Override the output file and use the provided path | | --input -i | Override the input path provided and use the provided path |

Env variables

The project supports an .env file at the root, but it also will read from the .env file loaded at the root of a project where it is a dependency.

The following .env variables are supported:

| Option | Required | Description | | --------------------- | ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ROUTER_PROFILE | optional | The default Router Profile and corresponding router to use. Default: 'driving' | | ROUTE_OVERVIEW | optional | The OSRM route_overview value. Can be full or simplified. Full provides a comprehensive high-resolution GeoJSON set. Simplified provides a simple GeoJSON approximation with only a few points | | FILE_NAME | optional | The name of the output file. Default routes.json | | OUTPUT | required if not provided on command-line | The path to write the output file. E.g. dist. | | INPUT | required if not provided on command-line | The path of the input file. E.g. story/story.en.json. | | ALWAYS_USE_ALL_POINTS | optional | If true then routes will be generated that visit every previous point in the story. Otherwise, routes only go from the previous point to the next one. |

Routers

The tool uses a small standalone javascript class to provide an interface with any OSRM-compatible routing interface.

The Router class is defined in router.js. This could be easily extended in the future to support other APIs.

Each provided router is defined in src/routers. These are instances of the Router class.

Currently the following routers are provided:

| Router | InstanceOf | Description | | ---------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | | trainRouter.js | Router | Provides an interface to the Railway router available at https://signal.eu.org/. Routes calculated follow rails provided in the OpenStreetMaps database. | | drivingRouter.js | Router | Provides an interface to the OSRM Router https://router.project-osrm.org/. Routes calculated follow streets and roads. |

Adding a new router

To add a new OSRM-compatible router, you simply need to duplicate src/routers/drivingRouter.js, update the URL and 'profile' provided in the constructor with those of the OSRM Compatible router.

You then need to add your router to the availableRouters object in src/router.js. The key of this object will be the ROUTER_PROFILE that you need to specify in your env file.

Point-specific routers

Some story points specify which router profile should be used for the point in their JSON structure with the key transportType. This key overrides all the other variables set (environment variables for example). The value of this key must correspond to a router in availableRouters in src/routers.js.