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

qruta-calcular

v1.0.2

Published

Libreria de calculo

Downloads

8

Readme

This algorithm pretends to solve the efective route of public transport or privated routes.

Installation

npm install --save qruta-calcular

Usage

const calculate = require("qruta-calcular");
await calculate({rutas: arrayOfRoutes, config: configuration, origen: startLocation, destino: endLocation, area: area, qty: Quantity});

rutas

array of all posible routes Example:

[
    {
        "id":"routeId",
        "area":{
            "1":[[lat,lng]]
        },
        "distances":[
            0,
            23
        ],
        "path":[
            [lat,lng,stop]
        ],
        "name":"routeName",
        "company":"companyName",
        "details":"routeInfo",
        "osisp":true
    }
]
  • id: Unique id of the route
  • area: Object of polygons for the range of the route.
  • distances: Array of distances of the path, example: [0, 25,75] starting allways with 0, 25 meters is the distance between the first location and the second location of the path plus the distance of the previous location (25 + 0 = 25), 50 meters is the distance between the second location and the tirth location of the path plus the distance of the previous location (50 + 25 = 75).
  • path: array of array with [lat,lng,stop(optional)] of the route path.
  • osisp: Only Stop In Some Places, boolean true | false, default false, if true it will use only locations with stop of the current path.
  • name: Name of the route.
  • company: Name of the company.
  • details: Aditional info about the route.

config

Object of configutation Example:

{
  "walkInterval": 500,
  "avgError": 0.3,
  "proportion": 10,
  "walkingDistance": 200,
  "busSpeed": 45
}
  • walkInterval: Distance between areas
  • avgError: Average percentage of error.
  • proportion: This makes more or less important the walking distance.
  • walkingDistance: Distance to walk between 2 routes.
  • busSpeed: Average bus speed, this will help to get the average time.

origen

The origin location in [lat,lng]

destino

The destiny location in [lat,lng]

area

Number of the area to search

qty

Number of maximun responses

response

{
  success: true,
  codeError: 6,
  options: [
    {
      score: 9246.730232291655,
      routes: [
        {
          routeDistanceValue: 5256.725527524995,
          routeDistanceText: '5.3km',
          score: 9246.730232291655,
          route: {
            id: 'zITV42L9DX',
            name: 'C17',
            details: '4125 Centro - Santuario - Prado',
            company: 'Embusa',
            polyline: 'kk{aAnopg',
            stops: [
              [ 10.95878,-74.80072000000001, 'stop name'  ],
           ]
          },
          startPoint: [
            10.95878,
            -74.80072000000001
          ],
          endPoint: [
            10.990733,
            -74.789108
          ]
        }
      ],
      startWalk: 356.92917133053277,
      startWalkDistance: '356.9m',
      endWalk: 42.07129914613317,
      endWalkDistances: '42.1m',
      routeDistance: '5.3km',
      time: '13min'
    }
  ],
  start: [
    10.958107851215566,
    -74.7975266641815
  ],
  end: [
    10.990360000000067,
    -74.78916999999996
  ]
}

codeError

  • 6: No near routes to the pickup area
  • 7: No near routes to the dropoff area
  • 8: No routes found