leaflet

leaflet - manually cluster markers

谁都会走 提交于 2021-01-28 11:14:32
问题 I need to manually cluster/uncluster few markers on the map (not automatically by zoom) is there a way to tell Leaflet.markercluster which markers to cluster manually and not automatically by zoom. I tried manipulating the L.markerClusterGroup layer internal cluster._gridClusters and cluster._gridUnclustered which holds an array of all the zooms and markers/clusters in each. but changing the objects seems to do nothing and not represented on map. a solution example would be: selectedMarkers =

setOpacity for multiple markers at the time

雨燕双飞 提交于 2021-01-28 07:47:16
问题 I'm using leaflet for my project and I want to use filter marker in it. To do it, I will setOpacity to 0 for all markers and re setOpacity to 1 for my targets. I know leaflet allow to setOpacity for each market but can I set all markers at the same time? Thanks for your help! 回答1: There are many ways to achieve that In leaftlet Create a layer group and add each marker to this group : var myGroup = L.layerGroup([mark1, mark2, ...]); You can add the entire group to the map. Then, when you want

Changing the leaflet map language?

天大地大妈咪最大 提交于 2021-01-28 06:04:05
问题 Please is it possible to ** change the language of leaflet map ** tiles in a specific area? like changing it to Arabic language 回答1: If you use this plugin for Leaflet which gives Google Map tiles, then that will be based on your Browser settings according to Google's API Concepts page. You can get Open Street Map labels in various languages by adding the language identifer to the tile server link. Like this: http://{s}.www.toolserver.org/tiles/osm-labels-ar/{z}/{x}/{y}.png You still need the

Map is not visible at initialization using react-leaflet

心已入冬 提交于 2021-01-28 05:41:53
问题 I have this react component: import React, { Fragment } from 'react'; import L from 'leaflet'; import { Map, TileLayer, Marker, Popup } from 'react-leaflet'; import 'leaflet/dist/leaflet.css'; const customMarker = new L.icon({ iconUrl: '/images/poemEditorTools/location-pointer-new.svg', iconSize: [56, 72], iconAnchor: [26, 72], }); const MyPopupMarker = ({ content, position }) => ( <Marker position={position} icon={customMarker} > <Popup>{content}</Popup> </Marker> ) const MyMarkersList = ({

Use HTML5 File Reader and send it to Leaflet Omnivore

别说谁变了你拦得住时间么 提交于 2021-01-28 02:55:34
问题 I'm using Leaflet JavaScript and following this tutorial: https://www.html5rocks.com/en/tutorials/file/dndfiles/ I'm building a tool for my work. It allows the user to upload a CSV file with lat/long info and plot it on a map via Leaflet Omnivore. I am able to get the html5 examples to work. But, when do I do with the data it reads in? Leaflet Omnivore requires the local path to the file being uploaded like this: var testCSV = omnivore.csv('path/to/file.csv').addTo(map).on('error', function

Select one feature of multiple overlapping features (here polygons) on a Leaflet map

僤鯓⒐⒋嵵緔 提交于 2021-01-28 02:35:40
问题 I have a map with multiple polygons rendered on it which can overlap eachother. I use leafletPip.pointInLayer(point, layer) from https://github.com/mapbox/leaflet-pip for determining which polygons do overlap. This happens in the processClick function. In the Vue object I create the map and my GeoJSON layer with the polygons. What I now want is following feature: if you click on a point on the map and this point is contained in multiple polygons, you have something like a selection tool, e.g.

Count elements in MarkerCluster

妖精的绣舞 提交于 2021-01-27 21:55:45
问题 So I have a couple of stores as layers on my map. All my stores are added to the MarkerCluster and that one is added to map, everything works fine. But I want to display a short info about the store when it's in my viewPort. With usual stores (layers) this was working first try, but the clustered Group does not work :( I started with this one: map.eachLayer(function(layer) but it did not just give me the stores, but alot of things. So I went further to: if(map.getBounds().contains(layer

Using leaflet-d3 on svelte

杀马特。学长 韩版系。学妹 提交于 2021-01-27 18:57:45
问题 i have to use leaflet-d3 on svelte to create a hexmap. I'm using a code already tested for other stuff. It can be found here. function createMap(id, config, zoomFunction) { let initialView = [config.startLat, config.startLng]; if(!config.startLat || !config.startLng){ initialView = [0,0] config.startZoom = 1; } let m = L.map(id, {preferCanvas: true, minZoom: config.minZoom, maxZoom: config.maxZoom }).setView(initialView, config.startZoom); let layers = { 'Street map': L.tileLayer.provider(

react-leaflet: adding a TopoJSON layer

爷,独闯天下 提交于 2021-01-27 18:23:01
问题 I just started using the react-leaflet library and got a map to load with a geoJSON layer, however I would like to use a TopoJSON layer instead. I know that it is possible with pure Leaflet like this: https://gist.github.com/rclark/5779673/. But how would I go about doing this with React-Leaflet? Edit class MapViz extends React.Component { getStyle() {...}; render() { const position = [x,y]; var geoData = topojson.feature(test_topo,test_topo.objects).geometries; return ( <Map id="my-map"

Create polygon per row and retain columns

心已入冬 提交于 2021-01-27 17:30:12
问题 Good morning, afternoon or evening I have grouped some positional data into 1 hour bins. For each I have extract the minimum lat and lon. It looks like this: df <- "ID time_bin count lat lon maxlat minlat maxlon minlon 1 2018-10-07 22:00:00 47 51.21723 -5.021828 51.22082 51.21457 -5.019105 -5.024372 2 2018-10-07 23:00:00 61 51.21797 -4.907367 51.23592 51.21224 -4.743538 -5.018899 3 2018-10-08 00:00:00 65 51.27263 -4.612118 51.32474 51.23751 -4.576005 -4.734378 4 2018-10-08 01:00:00 107 51