Git Product home page Git Product logo

directions-icons's Introduction

directions-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

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

directions-icons's Issues

Missing Icon for FerryEnter and FerryExit

From Valhalla's turn by turn's output, there are these two possible results kFerryEnter and kFerryOutput (maneuver 28 and 29). Is there a plan to add the icons to the repo?

localise icons for left hand driving side

Although many of the icons in this repo are driving side independent, many are driving side dependent, and it appears they are all right side driving icons.

Is anyone interested in working on left side driving versions of the icons?

If not, would you accept a PR for this?

Arrival icons imply a turn

The left and right arrival icons imply a left and right turn, respectively, with a curved arrow:

The Mapbox Directions API and OSRM use the arrival maneuver modifier to indicate the side of the road on which the user can find the destination (or whether it is straight ahead). The modifier does not indicate a turn direction.

This is problematic especially for driving directions, because very often the user will not perform a conventional turn at all. For example, the user may need to parallel park, or they may only intend to drop off a passenger.

I'm not sure what a suitable replacement glyph would look like. It may be cheesy, but how about a hand pointing to the dot from the left or right? I think it would even be reasonable to reuse the straight arrival icon for both left and right arrival.

/cc @bsudekum @natslaughter @zugaldia

Merge icons have inverted meaning

The merge left and right icons are drawn from the perspective of traffic that has the right of way, as opposed to the user who has to merge:

Seen another way, the icons are rotated to match the bearing after the merge rather than the bearing before the turn, which is inconsistent with ordinary left and right turn icons. This inconsistency is especially disorienting when paired with a map that automatically rotates to match the user's bearing or course.

By comparison, the standard glyph in North America depicting an upcoming merge onto another road is optimized for the user's bearing before the merge:

W4-5R

You don't see this sign often in the United States because the merge is usually posted with a single sign in the median.

/cc @natslaughter @bsudekum @zugaldia

Add missing icons

We're missing all icons with type: invalid. I think these icons should be trumped by the modifier. Few examples:

  • invalid_straight.png
  • invalid_slight_left.png

/cc @natslaughter

NPM install throws error

Hi thanks for the awesome icons! I was trying to generate a new set of icons in a different color and I followed the instructions in the readme but I got the following errors when running npm install command. Can you please help? Thanks a lot.

C:\GitHub Projects\directions-icons>npm install
npm WARN deprecated [email protected]: protozero should no longer be used via npm, install instead via https://github.com/mapbox/mason
npm WARN deprecated [email protected]: This version is no longer maintained. Please upgrade to the latest version.
npm WARN deprecated [email protected]: This version is no longer maintained. Please upgrade to the latest version.
npm WARN deprecated [email protected]: This version is no longer maintained. Please upgrade to the latest version.

[email protected] install C:\GitHub Projects\directions-icons\node_modules\mapnik
node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/mapnik/v3.7.2/node-v64-win32-x64-Release.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp ERR! Tried to download(undefined): https://mapbox-node-binary.s3.amazonaws.com/mapnik/v3.7.2/node-v64-win32-x64-Release.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:484:19)
gyp ERR! stack at PythonFinder. (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:509:16)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:282:31
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:154:21)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\GitHub Projects\directions-icons\node_modules\mapnik\lib\binding\mapnik.node" "--module_name=mapnik" "--module_path=C:\GitHub Projects\directions-icons\node_modules\mapnik\lib\binding"
gyp ERR! cwd C:\GitHub Projects\directions-icons\node_modules\mapnik
gyp ERR! node -v v10.15.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\GitHub Projects\directions-icons\node_modules\mapnik\lib\binding\mapnik.node --module_name=mapnik --module_path=C:\GitHub Projects\directions-icons\node_modules\mapnik\lib\binding' (1)
node-pre-gyp ERR! stack at ChildProcess. (C:\GitHub Projects\directions-icons\node_modules\mapnik\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:962:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
node-pre-gyp ERR! System Windows_NT 10.0.17763
node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\GitHub Projects\directions-icons\node_modules\mapnik\node_modules\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\GitHub Projects\directions-icons\node_modules\mapnik
node-pre-gyp ERR! node -v v10.15.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\GitHub Projects\directions-icons\node_modules\mapnik\lib\binding\mapnik.node --module_name=mapnik --module_path=C:\GitHub Projects\directions-icons\node_modules\mapnik\lib\binding' (1)
npm WARN [email protected] requires a peer of acorn@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-pre-gyp install --fallback-to-build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Alaa\AppData\Roaming\npm-cache_logs\2019-04-01T19_46_16_026Z-debug.log

Missing icon for some manoeuvres

Hey,
Just figured out my app crashed since this change in Mapbox Java the icons for the manoeuvres exit roundabout don't exist here so my app tried to find a null icon.
Maybe there should be an icon for this manoeuvre as well?
I'll handle the scenario where there can be manoeuvres that don't have icons but I guess it would be best if they all have one.
cc @osana

merge_straight.svg is broken

Great icons - thank you very much! It seems the merge_straight.svg is broken. Content of the SVG XML:

`

<title>direction</title> `

ISC license not included in zip

The ISC license requires the copyright notice and license be distributed with the software, and the zip file doesn't include it.

I'd do a PR, except that as per @bhousel "tbh that one should probably be CC0 also"

cc @TomH

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.