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

geo-data-integration

v1.0.15

Published

This package is based on the OpenLR location referencing methods to map a linestring to the network of a digital map.

Downloads

30

Readme

Codecov Coverage

Package that can be used to match lines with the road network of a map

This package is based on the OpenLR location referencing methods to map a linestring to the network of a digital map.

First version where many things can still be improved, mostly the ease of use.

Usage:

Initialise mapdatabase with lines and nodes:

let n1 = new Node(1,51.2126651,4.4066541);
let n2 = new Node(2,51.2126422,4.4066453);
let n3 = new Node(3,51.2126153,4.4067580);
let n4 = new Node(4,51.2125941,4.4068391);

let l1 = new Line(1,n1,n2);
let l2 = new Line(2,n2,n3);
let l3 = new Line(3,n3,n4);

let nodes = {1: n1, 2: n2, 3: n3, 4: n4};
let lines = {1: l1, 2: l2 ,3: l3};

Let mapDataBase = new MapDataBase(lines,nodes);

Encode a line:

let encoded = LineEncoder.encode(mapDataBase,l1,0,0); // mapdatabase, line to encode, positive offset, negative offset

or

let location = {
  type: locationTypeEnum.LINE_LOCATION,
  locationLines: [l1],
  posOffset: 0,
  negOffset: 0
};
let encoded = OpenLREncoder.encode(location,mapDataBase);

Decode the encoded line:

let decoded = LineDecoder.decode(mapDataBase,encoded.LRPs,encoded.posOffset,encoded.negOffset,decoderProperties);

or

let decoded = OpenLRDecoder.decode(encoded,mapDataBase,decoderproperties);

Decoderproperties format:

let decoderProperties = {
    dist: 5,    // maximum distance (in meter) of a candidate node to a LRP
    bearDiff: 60, // maximum difference (in degrees) between the bearing of a candidate node and that of a LRP
    frcDiff: 3, // maximum difference between the FRC of a candidate node and that of a LRP
    lfrcnpDiff: 3, // maximum difference between the lowest FRC until next point of a candidate node and that of a LRP
    distanceToNextDiff: 40, // maximum difference (in meter) between the found distance between 2 LRPs and the given distanceToNext of the first LRP
    alwaysUseProjections: false, // always use projections, even if direct nodes are found
    useFrcFow: true,  // use the frc and fow values
    distMultiplier: 40, // multiplier for the impact of the distance on the rating of a candidate line
    frcMultiplier: 35, // multiplier for the impact of the functional road class on the rating of a candidate line
    fowMultiplier: 40, // multiplier for the impact of the form of way on the rating of a candidate line
    bearMultiplier: 30, // multiplier for the impact of the bearing on the rating of a candidate line
    maxSPSearchRetries: 200, // maximum amount of shortest path lookups, used to limit decode time
    maxDecodeRetries: 2, // maximum amount of retries when decoding fails with the current distance
    distMultiplierForRetry: 2 // multiplier for the distance value to use when retrying
};

Example initialisation of mapdatabase with Routable Tiles

let mapDatabase = new MapDataBase();
fetchRoutableTile(14,8392,5469)
                .then((data)=>{getRoutableTilesNodesAndLines(data.triples)
                  .then((nodesAndLines)=> {
                      let parsed = RoutableTilesIntegration.getNodesLines(mapDatabase, nodesAndLines.nodes,nodesAndLines.lines);
                      mapDataBase.addData(parsed.lines,parsed.nodes);
                  })
                  .then(()=>{
                    //database initialized and ready to use
                  });
                });

Demo app that uses this code can be found here and deployed here