I was wondering whether it is possible to use icon font icons (e.g. Font Awesome) as markers in Google Maps V3 to replace the default marker. To show/insert them in a HTML or PHP document the code for the marker would be:
<i class="icon-map-marker"></i>
If you want the awesomefont MARKER with an awesomefont ICON INSIDE:
1. copy the SVG path of the awesomefont marker (click download and copy the SVG path) and use it as
icon
(remember to credit the authors, see license). Then you can change it's color to anything you want.2. As
label
you only insert the awesome font icon code and the color you want.I just had the same problem - decided to do a quick and dirty conversion and host on github.
https://github.com/nathan-muir/fontawesome-markers
You can manually include the JS file, or use
npm install fontawesome-markers
orbower install fontawesome-markers
.Just include the javascript file
fontawesome-markers.min.js
and you can use them like so:Edit (April-2016): There's now packages for v4.2 -> v4.6.1
I know this is an old post, but just in case you can use the
MarkerLabel
object now:Worked for me.
.
Reference Google Maps Maker
Here's my attempt at the same thing (using "markerwithlabel" utility library) before I realised Nathan did the same more elegantly above: http://jsfiddle.net/f3xchecf/
I've put together a simple JS library that generates nice SVG markers using the Font Awesome icons. https://github.com/jawj/MapMarkerAwesome
The light weight solution
480kb
25kb
To avoid these dependencies, simple go to fontawesome-markers, find the path for the icon you want, and include it as follows: