
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Express middleware to map the great circle path between any two airports.
Gcpath is a Connect/Express middleware package that allows you to easily plot the flightpath between two airports on a static map in PNG-format.
It links up to simple formatted URLs with two IATA airport codes such as /map/BRU/YYZ
and calls the Mapbox static API to produce a map with markers on both sides and the great circle path between the two.
Gcpath can be used anywhere in your path structure but expects to receive two parameters named :from
and :to
that will contain upper case IATA codes when requested:
const express = require('express')
const app = express()
const gcpath = require('gcpath')
app.use('/map/:from/:to', gcpath({
token: '{Your Mapbox API token}'
}))
app.listen(3000, function() {
console.log('Listening on port 3000')
})
In this configuration, a call to /map/BRU/YYZ
will return a 512 by 512 pixel image of the shortest flightpath between Brussels Airport and Toronto Pearson airport. See below for details on how to change the size or the colour of images.
The gcpath function takes an object of options as the first and only parameter. Only one of these is required:
token
: Your personal Mapbox API-token. Check here to obtain one. (required)width
: Width of the image in pixels (default: 512)height
: Height of the image in pixels (default: 512)style
: The Mapbox style to use for the base layer of the map (default: 'streets-v10')fromIcon
: Name of the Mapbox Maxi icon to use at the origin airport (default: 'airport')fromColour
: Background colour (in hex format) of the icon to use at the origin aiport (default: '#002850')toIcon
: Name of the Mapbox Maxi icon to use at the destination airport (default: 'airport')toColour
: Background colour (in hex format) of the icon to use at the destination aiport (default: '#002850')pathColour
: Stroke colour (in hex format) to use for the path between both airports (default: '#ff0006)MIT (c) 2018 Raphael Cockx (@raphaelcockx)
FAQs
Express middleware to map the great circle path between any two airports.
The npm package gcpath receives a total of 0 weekly downloads. As such, gcpath popularity was classified as not popular.
We found that gcpath demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.