Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
guidance-geojson
Advanced tools
guidance-geojson ---------------- Project for generating guidance-specific labelling/route styling data for GL from Mapbox Directions responses.
Project for generating guidance-specific labelling/route styling data for GL from Mapbox Directions responses.
var guidanceGeoJSON = require('guidance-geojson');
var geojson = guidanceGeoJSON(directionsResponse);
// console.log(geojson);
Guidance GeoJSON provides a FeatureCollection with the following feature types:
segments
are LineString features that together make up the route to be traveled.labels
are Point features for maneuver points where the user needs to make a turn.waypoints
are Point features for starting, final, or intermediate destinations.Each feature has the following properties exposed for styling in Mapbox Studio:
property | segment | label | waypoint |
---|---|---|---|
type | segment | label | waypoint |
bearing | null | 0-360 | null |
modifier | null | TBD | null |
name | null | Name of next road | Name of waypoint road |
waypoint | null | null | `"first" |
@TODO: provide example Guidance GeoJSON file for styling in studio as a static route.
Once you have created your map style you can have it dynamically style a route. To do so, however, you will need to use the stylePrep()
and styleRoute()
methods to omit the layers in your style when loading your map and then apply those styles to your dynamic guidance GeoJSON once loaded:
var guidanceGeoJSON = require('guidance-geojson');
var mapboxgl = require('mapbox-gl');
var directionsResponse = require('./stored-directions-response.json');
var map = new mapboxgl.Map({
container: 'map',
// Defers showing all layers from `style` beginning with `route`
style: guidanceGeoJSON.stylePrep(style, 'route')
});
map.on('style.load', function () {
var route = guidanceGeoJSON(directionsResponse);
// Restores style layers and adjusts dynamically to style `route` GeoJSON
guidanceGeoJSON.styleRoute(mapboxgl, map, route);
});
FAQs
guidance-geojson ---------------- Project for generating guidance-specific labelling/route styling data for GL from Mapbox Directions responses.
The npm package guidance-geojson receives a total of 17 weekly downloads. As such, guidance-geojson popularity was classified as not popular.
We found that guidance-geojson demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 60 open source maintainers 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.