How to use the mapbox.js.marker function in mapbox

To help you get started, we’ve selected a few mapbox examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openseattle / sewardparkstories.org / lib / map.js View on Github external
var tileLayer = L.mapbox.tileLayer(options.tileLayer)

  var map = L.map(options.el, {
    center: state.map.center,
    zoom: state.map.zoom,
    zoomControl: false,
    layers: [tileLayer],
    attributionControl: false
  })

  state.on('resize', function () {
    map.setZoom(state.map.zoom)
    map.setView(state.map.center)
  })

  var location = L.marker([47, -122], {
    icon: L.mapbox.marker.icon({
      'marker-size': 'small',
      'marker-color': '#fa0'
    })
  }).addTo(map)

  movement.on('data', function (data) {
    location.setLatLng(new L.LatLng(data.coords.latitude, data.coords.longitude))
  })

  new L.Control.Zoom({ position: 'topright' }).addTo(map)

  function attributionPosition (position) {
    new L.control.attribution({ position: state.attribution })
      .setPrefix('')
      .addAttribution('<a href="https://www.mapbox.com/about/maps/">© Mapbox</a>')
github AutoLingo / autolingo / app / components / utilities.jsx View on Github external
return (event) => {
      this.map.fitBounds([country.fitBounds], {maxZoom: country.zoomNum});
      this.map.dragging.disable();
      this.props.selectCountry(country.name, [country.fitBounds], country.zoomNum)

      if (country.name === 'globe') {
        //then put them back to right coordinates
        this.usaMarker = L.marker([45.6981, -104.36035], {icon: this.usaIcon}).addTo(this.map);
        this.chinaMarker = L.marker([42.23727, 98.84277], {icon: this.chinaIcon}).addTo(this.map);
        this.franceMarker = L.marker([52.69116, -2.43896], {icon: this.franceIcon}).addTo(this.map);
        this.spainMarker = L.marker([47.54952, -8.69141], {icon: this.spainIcon}).addTo(this.map);
        this.koreaMarker = L.marker([45.07518, 122.11494], {icon: this.koreaIcon}).addTo(this.map);

      }

      if(country.name=== 'america' || country.name==="china" || country.name==="spain" || country.name==="france" || country.name==="korea") {
        this.map.removeLayer(this.usaMarker)
        this.map.removeLayer(this.spainMarker)
        this.map.removeLayer(this.chinaMarker)
        this.map.removeLayer(this.koreaMarker)
        this.map.removeLayer(this.franceMarker)
      }
    }
  }