leaflet

Constrain Mapbox panning north/south only?

柔情痞子 提交于 2020-01-07 02:54:28
问题 Anyone know how to constrain the panning in a Mapbox map only using north/south bounds? What I would like to do is use the world copy so that users can continuously pan east to west, but restrict the north and south panning so that you can't pan outside of the map tiles (which I find super annoying). I'm currently using a maxbounds when initializing the map to prevent panning into the white tiles above and below the poles, but that's a no-go with world copying. 回答1: You can use -Infinity west

Leaflet edit toolbar icons misaligned

寵の児 提交于 2020-01-07 02:37:06
问题 I am using - Leaflet version 1.0.1 and Leaflet draw version - 0.4.1 The edit toolbar icons appear to be misaligned on page load. Please help! 回答1: I found a solution to this issue by using the css file in the "Master" branch together with the leaflet-draw script which I downloaded. 来源: https://stackoverflow.com/questions/40337606/leaflet-edit-toolbar-icons-misaligned

Can't add layers dynamically to layer group when click checkboxes using Leaflet

自作多情 提交于 2020-01-06 18:03:20
问题 my issue is I can't remove layer of each checkbox, I had already post this issue, unfortunately I didn't get any answer. I'm trying now to use layer group which I add to it layer for each clicked checkbox, but when I tried to remove each layer, it remove the last one, so I noticed that the layers are not added to layer group. So how to add layers to layer group dynamically, in other words how to add layer each time I clicked on a given checkbox? Can you help me please to figure out what is

Why is my click function not working as expected?

一曲冷凌霜 提交于 2020-01-06 15:20:54
问题 I've created a simple js project which plots a series of points using leaflet.js. I then want to populate an info window with point specific data with an on click event. But I can't seem to get it to work. This is roughly what I've done: var circle = L.circle( [data[i]['latitude'], data[i]['longitude']], 50, { color: 'red', fillColor: 'red', fillOpacity: .5} ).addTo(map) .bindPopup(data[i]['SCHNAME']) .on('click', fill_info_window(data, i)); function fill_info_window(data, i){ /* fill data */

can't implement L.mapbox.simplestyle with geoJson

一个人想着一个人 提交于 2020-01-06 12:57:44
问题 I'm trying to implement simplestyle's options for marker size and color , but can't get them to render. In this simple test case, I'm trying to follow Mapbox's own example quite closely: var myData = [ { "type": "Feature", "geometry": { "type": "Point", "coordinates": [4.509373,51.932994] }, "properties": { "marker-size": "large", "marker-color": "#ffcc00" } } ]; var map = L.mapbox.map('map', 'examples.map-20v6611k') .setView([51.932994,4.509373], 8); L.geoJson(myData, { style: L.mapbox

can't implement L.mapbox.simplestyle with geoJson

∥☆過路亽.° 提交于 2020-01-06 12:56:39
问题 I'm trying to implement simplestyle's options for marker size and color , but can't get them to render. In this simple test case, I'm trying to follow Mapbox's own example quite closely: var myData = [ { "type": "Feature", "geometry": { "type": "Point", "coordinates": [4.509373,51.932994] }, "properties": { "marker-size": "large", "marker-color": "#ffcc00" } } ]; var map = L.mapbox.map('map', 'examples.map-20v6611k') .setView([51.932994,4.509373], 8); L.geoJson(myData, { style: L.mapbox

Jquery Leaflet Marker Layer Cluster Support with layers generated from unique json values- Leaflet.FeatureGroup.SubGroup

三世轮回 提交于 2020-01-06 08:16:59
问题 EDIT 3: I was able to get it working. I was making it harder than it actually was! https://jsfiddle.net/crashvector/xczj76om/13/ EDIT 2: Here is a link to a working fiddle of what I currently have. This has the seperate layers, but doesn't have the clustering function I am trying to implement. https://jsfiddle.net/xczj76om/12/ EDIT: I have updated my JS with a version that maps a cluster layer, and three individual layers based on the Classification listed in the JSON. My desire is to

Rotate Leaflet markers tooltip text

梦想的初衷 提交于 2020-01-06 08:10:22
问题 I have some JSON with data that should be shown on the map. var shapesCoordinates = '[{"shapeId": 1,"coordinates": [-1500,500],"text": "bla bla", "rotation": 20},{"shapeId": 2,"coordinates": [-1800,800],"text": "idemooooo", "rotation": 60}]'; var shapess = JSON.parse(shapesCoordinates); var markers = []; for (var i = 0; i < shapess.length; i++) { var marker = L.marker(shapess[i]['coordinates'], { opacity: 0.01 }).bindTooltip(shapess[i]['text'], { permanent: true, className: "shapesText",

How to create a choropleth on a leaflet Map R

老子叫甜甜 提交于 2020-01-06 06:52:29
问题 Problem I have loaded in the shapefile of the UK, no issues. Lets call this FILE1 . I also have a data frame file with 2 columns: Longitude, Latitude. lets call this FILE2 . I am trying to plot the coordinates of FILE2 onto the shapefile map of FILE1 and create a choropleth map I am also receiving the following error: Error in polygonData.default(data) : Don't know how to get path data from object of class tbl_df CODE I have taken the code from this question: Choropleth maps in R using

How to access polygon information from shapefile leaflet R

谁说我不能喝 提交于 2020-01-06 04:51:17
问题 I made a map of London using https://data.london.gov.uk/dataset/statistical-gis-boundary-files-london and shiny and R and leaflet. I added an attribute to the shapefile, and now want to be able to highlight the shapefile and print information when the user clicks on a specific polygon. I looked at shiny leaflet ploygon click event, Marker mouse click event in R leaflet for shiny, and How to implement input$map_marker_click correctly?, and know I need to use ObserveEvent , but have not been