A Mapbox GL JS plugin that turns your GeoJSON into an interactive map in minutes.
1. Using the web tool
- Create and save your geojson to an open hosting service like Github Gist. For Gists, copy the raw url
https://gist.githubusercontent.com/anonymous/11d74ac48876bafa64868658d99c4846/raw/c6a8c80959cbf1814afeb28bd1757b68bd5f78a8/map.geojson
- Open the Mapbox Markers web tool and add the url to your geojson as a
?data=<url>
parameter before the map hash.
2. Using Mapbox GL JS or NPM mapbox-gl-markers
Include the JS and CSS in the :
<script src='https://rawgit.com/mapbox/mapbox-gl-markers/master/dist/mapbox-gl-markers.js'></script>
<link href='https://rawgit.com/mapbox/mapbox-gl-markers/master/dist/mapbox-gl-markers.css' rel='stylesheet' />
Add the plugin after initializing your Mapbox GL map:
map.addControl(new MapboxMarkers(geojson[, options])); // Pass a GeoJSON feature collection that follows the marker-spec
See available options. You can also set the following using URL parameters:
- data URL to an external GeoJSON. Use a Gist.
Supported fields:
marker-image
Image to use for the markertitle
Title of the marker popupdescription
Description in the popupimage
An image to add in the popupwebsite
Link to a website, defaults to an OSM link to the location if blank
This is a WIP: https://paper.dropbox.com/doc/marker-spec-1-11DEmlIrR8bk1dlm3sU8B . Note: Other properties in the GeoJSON simplestyle-spec has not been implemented yet.
npm start
to run the development page with live reloadnpm run build
to update the final dist/mapbox-gl-markers.js file