EmbeddedMap.prototype._initializeMap = function () {
	var _this = this,
	    options = this._options,
	    baseLayer = L.tileLayer(options.baseLayer.url, options.baseLayer),
	    map;

	if (options.hasOwnProperty('static') && options.static) {
		this._map = map = L.map(this._el, {
			dragging: false,
			touchZoom: false,
			scrollWheelZoom: false,
			doubleClickZoom: false,
			boxZoom: false,
			tap: false,
			keyboard: false,
			zoomControl: false
		});
	} else {
		this._map = map = L.map(this._el, options.map);
	}

	if (this._options.bounds) {
		this._map.once('load', function () {
			_this._map.fitBounds(options.bounds);
		});
	}

	map.addLayer(baseLayer);
};
Example #2
0
    render() {
        let { width, height } = getComputedStyle(this.dom);
        let map = null;
        // 百度地图
        if(this.mapType == 'baidu') {
            let crs = new L.Proj.CRS('EPSG:3395',
                '+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs',
                {
                    resolutions: function () {
                        let level = 19
                        let res = [];
                        res[0] = Math.pow(2, 18);

                        for(let i = 1; i < level; i++) {
                            res[i] = Math.pow(2, (18 - i));
                        }

                        return res;
                    }(),
                    origin: [0, 0],
                    bounds: L.bounds([0, 20037508.342789244], [20037508.342789244, 0])
                });


            map = L.map(this.dom, {
                renderer: 'canvas',
                minZoom: 2,
                crs: crs
            }).setView([39.91349, 116.407945], 3);

            L.tileLayer(this.tileLayer, {
                attribution: '&copy; 百度地图',
                maxZoom: 18,
                minZoom: 3,
                subdomains: '1234',
                tms: true
            }).addTo(map);
        }
        else {
            map = L.map(this.dom, {
                renderer: 'canvas',
                minZoom: 2,
            }).setView([39.91349, 116.407945], 3);

            L.tileLayer(this.tileLayer, {
                maxZoom: 18,
                minZoom: 3,
            }).addTo(map);
        }

        map.invalidateSize(true);

        return map;
    }
Example #3
0
function init(element, options){
  if (!element) {
    throw new Error('Error initializing  element that is not a DOM element');
  };

  if (typeof element === "string") {
    element = document.getElementById(element);
  };

  options = _.defaults(options || {}, defaults);
  this.map = L.map(element).setView(options.center, options.zoom);
  if (options.bgTileUrl) {
    L.tileLayer(options.bgTileUrl).addTo(this.map);
  }

  var modules = [];
  this.add = function(module){
    if (!module || !module.isMapVizModule) {
      throw new Error('module must be a  module.');
    };

    module.addTo(this);
    modules.push(module);
    return module;
  };

  this.getModules = function() {
      return _.clone(modules);
  };
};
 componentDidMount () {
   // Intialize leaflet only if not initialized.
   if (!MapStore.isMapExist(MapSetting.sMapId)) {
     this.map = L.map(MapSetting.sMapId, {
         zoomControl: MapSetting.bZoomControl,
         closePopupOnClick: MapSetting.bClosePopupOnClick,
         doubleClickZoom: MapSetting.bDoubleClickZoom,
         touchZoom: MapSetting.bTouchZoom,
         zoomAnimation: MapSetting.bZoomAnimation,
         markerZoomAnimation: MapSetting.bMarkerZoomAnimation,
         minZoom: MapSetting.iMinZoom,
         maxZoom: MapSetting.iMaxZoom,
     }).setView(new L.LatLng(MapSetting.vPosition.x, MapSetting.vPosition.y), MapSetting.iDefaultZoom);
     this.map.invalidateSize(false);
     this.map.whenReady(this.afterRenderMap);
   } else {
     MapActions.setMapType(MAPTYPE.TREE);
     this.map = MapStore.getMapModel(MapSetting.sMapId).map;
     this.flatTileLayer = MapStore.getMapModel(MapSetting.sMapId).flatTileLayer;
     this.satTileLayer = MapStore.getMapModel(MapSetting.sMapId).satTileLayer;
     this.focusLayer = MapStore.getMapModel(MapSetting.sMapId).focusLayer;
     this.markersLayer = MapStore.getMapModel(MapSetting.sMapId).markersLayer;
   }
   this.updateProps(this.props);
   // this.map.closePopup();
 }
Example #5
0
  initialize: function(id) {
    var _this = this;

    this.map = L.map(id, { attributionControl: false });
    this.geojsonLayer = {};
    this.geomLayer = L.geoJson(null, {
      style: createStyle,
      pointToLayer: function(feature, latlng) {
        return L.circle(latlng, 24);
      },
      onEachFeature: function(f, layer) {
        _this.geojsonLayer[L.stamp(f)] = layer;
        featureControl(f, layer);
      }
    });

    L.tileLayer(config.tiles.url, {
      attribution: config.tiles.atttribution
    }).addTo(this.map);

    L.control.attribution({ position: 'bottomleft' }).addTo(this.map);

    this.geomLayer.addTo(this.map);
    this.map.setView([0, 0], 2);
    this.map.on('click', L.bind(function(e) { this.fire('click', e); }, this));
  },
Example #6
0
  componentDidMount () {
    if (! this.state.map) {
      const mapElement = this.refs.map;
      const options = {
        touchZoom: false,
        scrollWheelZoom: false,
        zoom: 5
      };
      const map = Leaflet.map(mapElement, options);

      // vertically centering map popup
      if (!this._onPopupOpen) {
        this._onPopupOpen = (event) => {
          let px = map.project(event.popup._latlng);
          px.y -= event.popup._container.clientHeight / 2;
          map.panTo(map.unproject(px), {animate: true});
        };
        map.on('popupopen', this._onPopupOpen);
      }

      this.setState({map: map});
    }

    if (! this.state.latitude || ! this.state.longitude) {
      this._getGeocode(this.props);
    } else {
      this._setMap();
    }
  }
  function initialize() {
    map = L.map($element[0], {
      center: [0,0],
      zoom: 3,
      minZoom: 0,
      maxZoom: 18,
      zoomControl: false,
      trackResize: true,
      scrollWheelZoom: false,
      attributionControl: false
    });

    if ($scope.feature) {
      addObservation($scope.feature);
    }

    map.on('mouseover', function() {
      if (!controlsOn) {
        controlsOn = true;
        map.addControl(zoomControl);
        map.addControl(worldExtentControl);
      }
    });

    map.on('mouseout', function() {
      if (controlsOn) {
        map.removeControl(zoomControl);
        map.removeControl(worldExtentControl);
        controlsOn = false;
      }
    });
  }
Example #8
0
  componentDidMount() {
    this.timer = setInterval(this.handleInterval.bind(this), 3000);
    this.map = L.map('MapView').setView([51.5050362, -0.0900202], 13);
    this.marker = L.marker([51.5050362, -0.0900202], {
      icon: L.icon({
        iconUrl: marker,
	iconAnchor: [12, 35]
      })
    });

    this.polyline = L.polyline = L.polyline([],
      { color: 'red' }
    );
    L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
      attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors',
      maxZoom: 18,
      minZoom: 8
    }).addTo(this.map);

    this.marker.addTo(this.map);
    this.polyline.addTo(this.map);

    /* eslint-disable */
    this.map.on('click', (e) => {
      console.log(e);
    });
    /* eslint-enable */
  }
Example #9
0
    TileMapMap.prototype._createMap = function (mapOptions) {
      if (this.map) this.destroy();

      // add map tiles layer, using the mapTiles object settings
      if (this._attr.wms && this._attr.wms.enabled) {
        this._tileLayer = L.tileLayer.wms(this._attr.wms.url, this._attr.wms.options);
      } else {
        this._tileLayer = L.tileLayer(mapTiles.url, mapTiles.options);
      }

      // append tile layers, center and zoom to the map options
      mapOptions.layers = this._tileLayer;
      mapOptions.center = this._mapCenter;
      mapOptions.zoom = this._mapZoom;

      this.map = L.map(this._container, mapOptions);
      this._layerControl = L.control.layers();
      this._layerControl.addTo(this.map);
      
      this._addSetViewControl();
      this._addDrawControl();
      this._addMousePositionControl();
      L.control.measureScale().addTo(this.map);
      this._attachEvents();
      syncMaps.add(this.map);
    };
Example #10
0
    addMap: function() {
      // the center of the map is the address of the University of L'Aquila
      var options = {
        center: new L.LatLng(42.3676443, 13.3496695),
        zoom: 12
      };

      // create the map
      var map = L.map('map', options);
      // say thanks to Leaflet
      map.attributionControl.setPrefix("Leaflet");

      // create a marker and add it to the map
      L.marker([42.3676443, 13.3496695]).addTo(map);

      // create an icon for showing the user its current location
      var positionIcon = L.icon({
        iconUrl: './img/hereIcon.png',
        iconSize: [20, 20],
      });

      // get the current location of the user
      navigator.geolocation.getCurrentPosition(function(position) {
        L.marker([position.coords.latitude, position.coords.longitude], {
          icon: positionIcon
        }).addTo(map);
      }, function() {});

      // add a layer showing Open Street Map's tiles
      var layer = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
        attribution: 'Map data &copy; OpenStreetMap',
        maxZoom: 20
      });
      map.addLayer(layer);
    }
	constructor(canvasEl, options) {
		this.debug = false;
		this.options = options;
		this.gpx_content = null;
		this.gpx_parser = null;
		this.center_lat = this.options.center_lat;
		this.center_lng = this.options.center_lng;
		this.zoom = this.options.zoom;
		this.el = canvasEl;
		this.bounds = L.latLngBounds();
		this.map = L.map('w_map_canvas', {
			center:[18.0, 12.0],
			zoom:3,
			scrollWheelZoom : false,
			tap: false,
			gestureHandling: true,
		});
		L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
			attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
		}).addTo(this.map);
		this.map.on('load', () => {
			// let z = this.map.getBoundsZoom(this.bounds);
		});
		this.map.on('resize', () => {
			const z = this.map.getBoundsZoom(this.bounds);
			this.map.setZoom(z);
			this.map.firBounds(this.bounds);
		});
	}
  /**
   * Spin up the leaflet instance.
   */
  _initLeaflet() {

    let el = findDOMNode(this.refs.image);

    this.map = L.map(el, {
      crs: L.CRS.Simple,
      attributionControl: false,
      zoomControl: false,
    });

    // Zoom buttons.
    let zoomControl = L.control.zoom({
      position: 'topright',
    });

    // Image layer.
    let layer = L.tileLayer.zoomify(config.tiles, {
      width:  config.size,
      height: config.size,
    });

    this.map.setView([0, 0], 1);
    this.map.addControl(zoomControl);
    this.map.addLayer(layer);

  }
Example #13
0
    resolveDevelopersAddress = () => {
        let tiles = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
            maxZoom: 18,
            attribution:
                '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors, Points &copy 2012 LINZ'
            }),
            latlng = L.latLng(this.state.latitude, this.state.longitude);

        var map = L.map('map-main', {center: latlng, zoom: 2, layers: [tiles]});
        this.state.developers.map((developer, i) => {
            this.state.geocoder.geocode({'address': developer.address}, (results, status) => {
                if (status == google.maps.GeocoderStatus.OK) {
                    let result = results[0].geometry.location;
                    let latlog = new L.latLng(result.lat(), result.lng());
                    let popup1 = new L.Popup({'autoClose':false});
                    popup1.setLatLng(latlog);
                    popup1.setContent("<strong><a href='#/mern-developers/" + developer.username + "'>@" +  developer.username + "</a></strong>");
                    L.marker(latlog).addTo(map)
                        .bindPopup(popup1).openPopup();

                    map.addLayer(popup1);
                }
            });
        });
    }
Example #14
0
gbptm.positioning_map = function (el, opts) {
  var map = L.map(el, {
    attributionControl: false,
    keyboard: true,
    tap: true,
    dragging: true,
    zoomControl: true,
    touchZoom: true,
    scrollWheelZoom: true,
    doubleClickZoom: true,
    maxZoom: 18,
    minZoom: 10
  })
  map.setView(opts.center, opts.zoom)
  var locateControl = L.control.locate({
    drawCircle: false,
    follow: true,
    keepCurrentZoomLevel: true,
    showPopup: false,
    onLocationError: $.noop,
    onLocationOutsideMapBounds: $.noop
  }).addTo(map)
  map.on('dragstart', locateControl.stopFollowing)
  locateControl.start()
  L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {}).addTo(map)
  gbptm.micromap = map
  return map
}
Example #15
0
 initialise() {
   this.map = L.map(this.div, {
     center: this.coordinates,
     zoom: 15
   });
   L.tileLayer('https://{s}.tiles.quaidorsay.fr/tile/forte{r}/{z}/{x}/{y}.png').addTo(this.map);
 }
Example #16
0
  initMap: function (container) {
    const map = L.map(container)

    L.tileLayer('http://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}', {
      attribution: 'Tiles &copy; Esri &mdash; Esri, DeLorme, NAVTEQ',
      maxZoom: 16
    }).addTo(map)

    map.on('moveend', () => {
      const centerGeojson = this.latlngToGeojson(map.getCenter())
      this.trigger('moved', centerGeojson)
    }, this)

    // If user starts panning the map before locating is done, don't setView after locate
    map.on('dragstart', () => this.setViewAfterLocate = false, this)

    map.setView(this.initialLocation, this.initialZoom)

    map.locate({enableHighAccuracy: true, maximumAge: 60000})

    map.on('locationfound', (e) => {
      if (this.setViewAfterLocate) map.setView(e.latlng, 16)
      this.createLocationIndicator(e).addTo(map)
      this.saveLocation(e.latlng)
    })

    this.createSaveButton().addTo(map)
  },
  componentDidMount () {
    // Intialize leaflet only if not initialized.

    if (!MapStore.isMapExist(MapSetting.sMapId)) {
      this.map = L.map(MapSetting.sMapId, {
          zoomControl: MapSetting.bZoomControl,
          closePopupOnClick: MapSetting.bClosePopupOnClick,
          doubleClickZoom: MapSetting.bDoubleClickZoom,
          touchZoom: MapSetting.bTouchZoom,
          zoomAnimation: MapSetting.bZoomAnimation,
          markerZoomAnimation: MapSetting.bMarkerZoomAnimation,
          minZoom: MapSetting.iMinZoom,
          maxZoom: MapSetting.iMaxZoom,
      }).setView(new L.LatLng(MapSetting.vPosition.x, MapSetting.vPosition.y), MapSetting.iDefaultZoom);
      this.map.invalidateSize(false);
      this.map.whenReady(this.afterRenderMap);
    } else {
      MapActions.setMapType(MAPTYPE.DONATION);
      this.map = MapStore.getMapModel(MapSetting.sMapId).map;
      this.flatTileLayer = MapStore.getMapModel(MapSetting.sMapId).flatTileLayer;
      this.satTileLayer = MapStore.getMapModel(MapSetting.sMapId).satTileLayer;
      this.focusLayer = MapStore.getMapModel(MapSetting.sMapId).focusLayer;
      this.markersLayer = MapStore.getMapModel(MapSetting.sMapId).markersLayer;
      this.renderMarkers(this.props.locations, this.props.selected);
      let temp = LocationStore.getState().temp;
      this.renderActiveMarker(temp);
      setTimeout(function() {
        this.renderPopup(LocationStore.getLocation(this.props.selected));
      }.bind(this), 100);
    }
    this.updateProps(this.props);
    this.map.closePopup();
  }
Example #18
0
ready(() => {
  map = L.map('map');

  map.setView([29.951066, -90.071532], 13);

  L.tileLayer('http://stamen-tiles-{s}.a.ssl.fastly.net/toner-lite/{z}/{x}/{y}.{ext}', {
      attribution: 'Map tiles by <a href="http://stamen.com">Stamen Design</a>, <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a> &mdash; Map data &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
      subdomains: 'abcd',
      minZoom: 12,
      maxZoom: 19,
      ext: 'png'
  }).addTo(map);

  let defaultStyle = {
    "weight": 3,
    "opacity": 0.7
  }

  routes.forEach((route) => {
    getRouteShape(route, (err, data) => {
      if (err) return console.log(err)

      let style = Object.assign(defaultStyle, data.properties.style);

      L.geoJson(data, {style: style}).addTo(map)
    })
  })

});
Example #19
0
                                         success: function(data){
                                            
                                            var latitudine = data.results[0].geometry.location.lat;
                                            var longitudine = data.results[0].geometry.location.lng;

                                             var mapCenter = {
                                                lat: latitudine,
                                                lon: longitudine
                                              };

                                            var options = {
                                                center: new L.LatLng(mapCenter.lat, mapCenter.lon),
                                                zoom: 12
                                             };

                                             // creo mappa
                                             var map = L.map('mapid', options);
                                            map.attributionControl.setPrefix("Leaflet");

                                             // creo marker con popup e lo aggiungo alla mappa
                                            L.marker([mapCenter.lat, mapCenter.lon]).addTo(map)
                                            .bindPopup(address + '<br>' + citta + ' ' + cap)
                                            .openPopup();


                                          // add a layer showing Open Street Map's tiles
                                      var layer = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
                                      attribution: 'Map data &copy; OpenStreetMap',
                                      maxZoom: 20
                                        });
                                     map.addLayer(layer);

                                        }
  render: function(selector) {
    var element = slick.find(selector);
    this._map = L.map(element, { attributionControl: false }); 
    this._map.setView([23, 18], 2);
    L.tileLayer('http://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}', {
	    attribution: 'Tiles &copy; Esri &mdash; Esri, DeLorme, NAVTEQ',
	    maxZoom: 16
    }).addTo(this._map);
    if(this._withoutUK) {
      this._statistics = this._statistics.without("United Kingdom"); 
    }
    this._statistics.last().proportionally().sqrt().each(bind(this, function(name, statistic) {
      var country = this._repo.getCountry(name);
      if(country) {
        var radius = statistic.value() * this._maxRadius;
        var marker = L.circleMarker(
          [country.latitude(), country.longitude()], 
          {radius: radius, color: colors.base }
        );
        this._markers[name] = marker;
        marker.addEventListener("click", bind(this, function() {
          this._onMarkerClick(name);
        }));
        marker.addTo(this._map);
        
      }
    }));
  },
Example #21
0
  componentDidMount(){
    this.mountains = require('../assets/mountains.json');

    this.map = L.map('map').setView([this.mountains[0].latitude.value, this.mountains[0].longitude.value], 8);
    L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
      attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
    }).addTo(this.map);

    setTimeout( () => {
      this.map.invalidateSize();
    }, 10)

    console.log(require('../images/marker.png'));
    var largeicon = L.icon({
        // iconUrl: require('../images/marker.png'),
        iconUrl: '/tw-100-mountain' + require('../images/marker.png'),
        iconSize: [25, 41]
    });

    this.markerGroup = L.layerGroup().addTo(this.map);

    this.markers = this.mountains.map( mountain => {
      let marker = L.marker(
                    [mountain.latitude.value, mountain.longitude.value],
                    {
                      icon: largeicon,
                      title: mountain.name
                    }
                  )
      this.markerGroup.addLayer(marker);
      return marker;
    })
  }
Example #22
0
    addMap: function() {

      // the center of the map is the address of the University of L'Aquila
      var mapCenter = {
        lat: 42.3676443,
        lon: 13.3496695
      };

      var options = {
        center: new L.LatLng(mapCenter.lat, mapCenter.lon),
        zoom: 12
      };

      // create the map
      var map = L.map('map', options);
      // say thanks to Leaflet
      map.attributionControl.setPrefix("Leaflet");

      // create a marker and add it to the map
      L.marker([mapCenter.lat, mapCenter.lon]).addTo(map);

      // add a layer showing Open Street Map's tiles
      var layer = L.tileLayer(
        'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
          attribution: 'Map data &copy; OpenStreetMap',
          maxZoom: 20
        });
      map.addLayer(layer);
    }
Example #23
0
    TileMapMap.prototype._createMap = function (mapOptions) {
      if (this.map) this.destroy();

      if (this._attr.wms && this._attr.wms.enabled) {
        _.assign(mapOptions, {
          minZoom: 1,
          maxZoom: 18
        });
      }

      const savedZoom = _.get(this._geoJson, 'properties.zoom');

      // get center and zoom from mapdata, or use defaults
      this._mapCenter = _.get(this._geoJson, 'properties.center') || defaultMapCenter;
      this._mapZoom = Math.max(Math.min(savedZoom || defaultMapZoom, mapOptions.maxZoom), mapOptions.minZoom);

      // add map tiles layer, using the mapTiles object settings
      if (this._attr.wms && this._attr.wms.enabled) {
        this._tileLayer = L.tileLayer.wms(this._attr.wms.url, this._attr.wms.options);
      } else {
        this._tileLayer = L.tileLayer(mapTiles.url, mapTiles.options);
      }

      // append tile layers, center and zoom to the map options
      mapOptions.layers = this._tileLayer;
      mapOptions.center = this._mapCenter;
      mapOptions.zoom = this._mapZoom;

      this.map = L.map(this._container, mapOptions);
      this._attachEvents();
      this._addMarkers();
    };
GeometryEditor.prototype.initMap = function() {
    // create map div
    var mapId = 'map-' + guid();
    var $mapDiv = $('<div id="' + mapId + '"></div>');
    $mapDiv.addClass('map');
    $mapDiv.css('width', this.settings.width);
    $mapDiv.css('height', this.settings.height);
    $mapDiv.insertAfter(this.dataElement);

    // create leaflet map
    var map = L.map(mapId).setView(
        [this.settings.lat, this.settings.lon],
        this.settings.zoom
    );

    // init layers
    for (var i in this.settings.tileLayers) {
        var tileLayer = this.settings.tileLayers[i];
        L.tileLayer(tileLayer.url, {
            attribution: tileLayer.attribution,
            maxZoom: 18
        }).addTo(map);
    }

    return map;
};
Example #25
0
ready(() => {
  map = L.map('map');

  map.setView([window.lastKnownLocation.lat, window.lastKnownLocation.lon], 11);

  L.tileLayer('http://stamen-tiles-{s}.a.ssl.fastly.net/toner-lite/{z}/{x}/{y}.{ext}', {
      attribution: 'Map tiles by <a href="http://stamen.com">Stamen Design</a>, <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a> &mdash; Map data &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
      subdomains: 'abcd',
      minZoom: 0,
      maxZoom: 20,
      ext: 'png'
  }).addTo(map);

  let loc = new L.LatLng(window.lastKnownLocation.lat, window.lastKnownLocation.lon);

  marker = new L.CircleMarker(
    loc,
    {
      radius: 5,
      opacity: 1.0,
      fillOpacity: 0.5
    }
  );

  marker.addTo(map);

  let time = window.lastKnownLocation.created;

  popup = L.popup()
    .setLatLng(loc)
    .setContent(`<p>Recorded at: ${time}</p>`)
    .openOn(map);
});
Example #26
0
  render: function() {
    this.renderWithTemplate();

    this.map = L.map(this.queryByHook('map'), {zoomControl: false});
    new L.Control.Zoom({position: app.config.map.zoomPosition}).addTo(this.map);
    var tp;

    if (L.Browser.retina) {
      tp = 'lr';
    }
    else {
      tp = 'ls';
    }

    L.tileLayer('http://tiles.lyrk.org/' + tp + '/{z}/{x}/{y}?apikey=' + apikey,
     {
       attribution: '| Data: ' +
                    '<a href="http://www.overpass-api.de/">OverpassAPI</a>' +
                    ' OpenStreetMap | <a href="http://geodienste.lyrk.de/" ' +
                    'target="_blank">Tiles by Lyrk</a> | <a href="http://' +
                    'geodienste.lyrk.de/copyright">Lizenz</a>' +
                    '</div>',
       maxZoom: 16
     }).addTo(this.map);

    this.setUserPosition();
    this.map.addControl(this.locateControl);
  },
Example #27
0
    $.fn.venueMap = function(action, opts) {
        opts = opts || {}
        var $self = $(this)
        var map = $self.data('map')

        if (!map) {
            var centre = opts.location || [52.20531, 0.12279]
            var zoom = opts.location ? 16 : 14
            map = L.map($(this).attr('id')).setView(centre, zoom);

            L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
                attribution: '&copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors',
            }).addTo(map);

            $self.data('map', map)
        }
        
        switch(action) {
            case 'add-marker':
                let marker = L.marker(opts.location)
                    .addTo(map).bindPopup(opts.content)
                if (opts.open) {
                    marker.openPopup()
                }
                return marker
            case 'select-marker':
                if (opts.marker) {
                    $self.scrollTo()
                    map.setView(opts.marker.getLatLng(), 17)
                    opts.marker.openPopup()
                }
                break
        }
    }
Example #28
0
    createMap: function (options) {
        var center = options.centerWM || {x: 0, y: 0},
            zoom = options.zoom || 2,
            map = L.map(options.domId, {
                center: U.webMercatorToLeafletLatLng(center.x, center.y),
                zoom: zoom
            }),
            basemapMapping = getBasemapLayers(options.config);

        if (_.isArray(basemapMapping)) {
            _.each(_.values(basemapMapping),
                function (layer) {
                    map.addLayer(layer);
                });
        } else {
            var visible = _.keys(basemapMapping)[0];
            map.addLayer(basemapMapping[visible]);
            this.layersControl = L.control.layers(basemapMapping, null, {
                autoZIndex: false
            }).addTo(map);
        }

        if (options.disableScrollWithMouseWheel) {
            map.scrollWheelZoom = false;
        }

        this.map = map;
        return map;
    },
Example #29
0
    build() {
        let map = L.map(this.id, {
            layers: [OSM],
            center: [60, 100],
            zoom: 3,
            maxZoom: 22
        });

        L.tileLayer.wms("http://pkk5.rosreestr.ru/arcgis/services/Cadastre/CadastreWMS/MapServer/WmsServer", {
                layers: '24,23,22,21,20,19,18,16,15,14,13,12,11,10,9,7,6,5,2,1',
                subdomains: "abcd",
                format: 'image/png24',
                transparent: true,
                attribution: "РосРеестр",
                maxZoom: 22
            }).addTo(map);

        // if (L.TileLayer.EsriRest) {
        //
        //     new L.TileLayer.EsriRest("http://pkk5.rosreestr.ru/arcgis/rest/services/Cadastre/Cadastre/MapServer", {
        //         subdomains: "abcd",
        //         layers: '0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,21',
        //         transparent: true,
        //         maxZoom: 22
        //     }).addTo(map);
        // }
        return map
    }
Example #30
0
function EarthquakeSpotter(domid, options){
    /*
        Pulls earthquake data from specified source and displays in table. 

        domid - the div where data should be displayed. 
        options - object with following properties:
            data_url: main data source
            backup_url: backup datasource
     */

    this.data_url = options.data_url;
    this.backup_url = options.backup_url;
    this.root = $(domid);
    this.quakes = [];
    this.markers = [];
    this.data_table = this.root.find(".earthquake-table > tbody:last");

    this.map = L.map(this.root.find(".earthquake-maparea").get(0)).setView([0, 0], 0);
    L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
                attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
                }).addTo(this.map);

    //hook up some events
    // refresh button
    this.root.find(".earthquake-refresh-button").click(
            $.proxy(function(){
                this.get_data();
            }, this));

    //clicking on data table
    this.data_table.click($.proxy(this.table_event_handler, this));
}