leaflet

Dynamically adding/removing FeatureGroup to/from the Layer Control?

雨燕双飞 提交于 2020-01-06 03:15:53
问题 I am currently using leaflet.draw plugin to draw polygons and lines. The plugin depends on FeatureGroup for storing and editing. I want to manage these geometries (e.g. turn their visibility on or off) like those in the layer control. Ultimately, I want to be able to add and remove these FeatureGroups. Is this achievable? Additional Information (thanks to iH8 for commenting and sorry for the lack of details): Here is what I want to achieve: 1. Treat FeatureGroup like dynamic layers (can add

Get and display lat long from address using Leaflet Control Search

梦想与她 提交于 2020-01-06 01:15:27
问题 I am using leaflet.js and this plugin: https://github.com/stefanocudini/leaflet-search and need a way of getting the lat and long coordinates from the address search and putting them into an input field, or just being able to use them... The answer may well be in the code below, just can't figure out how to do it... var geocoder = new google.maps.Geocoder(); function googleGeocoding(text, callResponse) { geocoder.geocode({address: text}, callResponse); } function filterJSONCall(rawjson) { var

Adding jquery ruler on leaflet map

限于喜欢 提交于 2020-01-05 08:04:31
问题 I need a ruler on leaflet map along X,Y axis but leaflet API does not support it and there is no plugin available. There is a jquery ruler that servers my needs. Is it possible to add jquery ruler on leaflet map ? Here is the example : http://ruler.hilliuse.com/ The ruler must adjust to the zoom level of leaflet map also. Please suggest. 回答1: If you can calculate the corners of the map after every zoom, then just reset the start point of the ruler ;). May be you have to write some logic for

Display traffic data with maps

不羁的心 提交于 2020-01-05 05:57:11
问题 I am trying to show traffic information on OpenStreetMap. Considering that the traffic information is a value from 0 to 3 (wich means bad, regular and free) and. also consider that value is changing in a certain frequency. Does anyone has a suggestion to make this work? Maybe drawing polylines in the map, I prefer to stay simple. My aplication use Leaflet maps and node.js 来源: https://stackoverflow.com/questions/45312914/display-traffic-data-with-maps

Leaflet MultipolygonField widget, not receiving touch events

霸气de小男生 提交于 2020-01-05 05:37:07
问题 On my desktop using Django-1.9 admin, on Firefox, the django-leaflet MultipolygonField widget works as expected. However, on a Samsung tablet using either Chrome or Firefox or the native browser, although I can select the tool to start drawing the polygon, by touching it, it is impossible to place any point on the map. It seems like the widget does not respond to any touch/hit/punch event. Is anybody else experiencing something like that? I have posted a relevant question in django-leaflet

Package leaflet - map doesn't show

谁说胖子不能爱 提交于 2020-01-05 05:36:07
问题 I got some question about the package "leaflet" which I'm using with Rstudio. My problem is, that the basemap isn't shown. But at the bottom of the viewer is written "OpenStreeMap" and the options to zoom in and out are also shown. Somebody knows about this problem? library(leaflet) m <- leaflet() m <- addTiles(m) m <- addMarkers(m, lng=174.768, lat=-36.852, popup="The birthplace of R") m The easy example is shown here: https://rstudio.github.io/leaflet/ 回答1: If you are behind a proxy try to

How can I add a north arrow to a leaflet.js map?

人走茶凉 提交于 2020-01-05 04:14:15
问题 Is there an easy way to add a north arrow to a leaflet.js map? I have searched a bit online but I cannot find much. 回答1: You can add a control that contains a div with your north arrow image: var north = L.control({position: "bottomright"}); north.onAdd = function(map) { var div = L.DomUtil.create("div", "info legend"); div.innerHTML = '<img src="your-north-arrow.png">'; return div; } north.addTo(map); See Leaflet's control documentation for more info on positioning and other options. 来源:

Leaflet js fictional map

落爺英雄遲暮 提交于 2020-01-05 04:07:13
问题 I am new to Leaflet and I would like to find out if how to create a fully interactive fictional map. I have an image that I would like to convert to a leaflet map. This image has a number of connections and points like a graph basically. I want to first of all convert that image to the map, be able to hover over the points, highlight them and display information about them and also to create animations at some point but not immediately with the connections. There is also a requirement to

R Leaflet custom attribution string

不打扰是莪最后的温柔 提交于 2020-01-05 03:37:50
问题 When using the R leaflet package, how can I add something additional to the attribution string (i.e. the "Leaflet | ..." in the bottom right corner)? For example, I how would I add something like "data source: ..." to the attribution text on this map: leaflet(data = quakes[1:20,]) %>% addTiles() %>% addMarkers(~long, ~lat, popup = ~as.character(mag), label = ~as.character(mag)) 回答1: You can add an attribution argument to addTiles : leaflet(data = quakes[1:20,]) %>% addTiles(attribution = 'I

Leaflet Markercluster: Exempt marker from clustering

試著忘記壹切 提交于 2020-01-05 03:18:10
问题 How can one exampt a marker with open popup from collapsing into a cluster when zooming out? I am using leaflet and markercluster as set up in this example: HTML: <div id="map"></div> CSS: html, body { height: 100%; } #map { height: 100%; } JS: const map = L.map('map', { zoom: 5, center: [0,0], maxZoom: 18 }); const clustered = L.markerClusterGroup(); map.addLayer(clustered); const m1 = L.marker(L.latLng(0,0)); m1.addTo(clustered); m1.bindPopup('one'); const m2 = L.marker(L.latLng(0,1)); m2