
Product
Introducing GitHub Actions Scanning Support
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.
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 37 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.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.

Product
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.

Research
The Socket Threat Research Team uncovered malicious NuGet packages typosquatting the popular Nethereum project to steal wallet keys.