Giter Site home page Giter Site logo

dandanyouxiang / mapbox-gl-markers Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mapbox/mapbox-gl-markers

0.0 1.0 0.0 24 KB

Mapbox GL plugin that implements the GeoJSON marker spec

Home Page: https://mapbox.github.io/mapbox-gl-markers

License: MIT License

JavaScript 91.10% HTML 8.90%

mapbox-gl-markers's Introduction

mapbox-gl-markers

new1

A Mapbox GL JS plugin that turns your GeoJSON into an interactive map in minutes.

Usage

1. Using the web tool

  1. 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
  2. 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.

GeoJSON marker-spec

Supported fields:

  • marker-image Image to use for the marker
  • title Title of the marker popup
  • description Description in the popup
  • image An image to add in the popup
  • website 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.

Contributing

  • npm start to run the development page with live reload
  • npm run build to update the final dist/mapbox-gl-markers.js file

mapbox-gl-markers's People

Contributors

planemad avatar

Watchers

James Cloos 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.