GithubHelp home page GithubHelp logo

isabella232 / directions-icons Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mapbox/directions-icons

0.0 0.0 0.0 2.21 MB

Navigation specific icons

License: Other

HTML 8.10% JavaScript 91.90%

directions-icons's Introduction

directions-icons

Download zip of icons

Standard set icons used for the v5 Mapbox Directions API.

On every directions API response there is a maneuver object on each step. Within the maneuver object, there are modifier and type keys. These keys are concatenated together with a _ and prefixed with direction_ to form an icon string that maps 1:1 with the icons in this repository.

{
    "maneuver": {
        "type": "turn",
        "location": {
            "type": "Point",
            "coordinates": [
                -122.447702,
                37.791708
            ]
        },
        "modifier": "left",
        "instruction": "Turn left onto Presidio Avenue"
    },
    "distance": 558,
    "duration": 53,
    "way_name": "Presidio Avenue",
    "direction": "S",
    "heading": 171,
    "mode": "driving"
}

The icons for this step would be direction_turn_left.png.

In cases where there is not a modifier the icon would be the type + .png. Example:

{
    "maneuver": {
        "type": "continue",
        "location": {
            "type": "Point",
            "coordinates": [
                -122.447702,
                37.791708
            ]
        },
        "instruction": "Continue onto Presidio Avenue"
    },
    "distance": 558,
    "duration": 53,
    "way_name": "Presidio Avenue",
    "direction": "S",
    "heading": 171,
    "mode": "driving"
}

The-icons for this step would be direction_continue.png.

Icons

To see available icons, see icons.md

Install and Usage

git clone https://github.com/mapbox/directions-icons.git
cd directions-icons
npm install
npm start

Custom colors

In index.js you can add to the colors object:

var colors = [{
    name: 'dark',
    color: '#000'
}, {
    name: 'light',
    color: '#fff'
}];

Simply add a new name and and new color and re-run with npm start. This will create a new folder color name and an updated zip.

Adding a new icon

To add a new icon:

  1. Create an svg
  2. Name it type_modifier and save it to src/svg/. Example: turn_left.svg
  3. run node index.js

License

To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.

CC0-1.0

directions-icons's People

Contributors

bhousel avatar natslaughter avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.