leaflet

Leaflet - Prevent loading tiles outside of MaxBounds

余生长醉 提交于 2020-01-24 13:14:46
问题 I'm having issues with leaflet trying to load tiles that dont exist and that are outside of my MaxBounds. jsfiddle replicating issue with my tileset Also tried with the following at the end: map.setBounds(new L.LatLngBounds(southWest, northEast)); but that seems to just break popups and markers and everything else without solving my issue. The full size of the map is 4096x4096 Unrelated question, is it possible to change the coord system to always use unprojected pixel coords without having

Opening a leaflet popup on a layerGroup

亡梦爱人 提交于 2020-01-24 09:07:48
问题 I am trying to draw country shapes on a leaflet map using L.GeoJSON(data).addTo(map) . I then want to bind a popup to the click event of that country shape... new L.GeoJSON(data, { onEachFeature: function(feature, layer) { layer['on']('click', popupFunction); } }).addTo(this.map); popupFunction = function(event) { var layer = event.target; // Open the 'add' popup and get our content node var bound = layer.bindPopup( "<div>Hello World!</div>" ).openPopup(); // Ugly hack to get the HTML content

Opening a leaflet popup on a layerGroup

大兔子大兔子 提交于 2020-01-24 09:06:27
问题 I am trying to draw country shapes on a leaflet map using L.GeoJSON(data).addTo(map) . I then want to bind a popup to the click event of that country shape... new L.GeoJSON(data, { onEachFeature: function(feature, layer) { layer['on']('click', popupFunction); } }).addTo(this.map); popupFunction = function(event) { var layer = event.target; // Open the 'add' popup and get our content node var bound = layer.bindPopup( "<div>Hello World!</div>" ).openPopup(); // Ugly hack to get the HTML content

Add “rgb” legend to R leaflet heatmap

旧城冷巷雨未停 提交于 2020-01-24 05:50:05
问题 I made some interactive heatmaps using leaflet (particularly the addHeatmap() command from the leaflet.extras package) and shiny . Having created a desired map, I would like to add a legend to it. What I am interested in is a "rgb" legend, based on density values deduced by addHeatmap() from pure long/lat coords. What I need is something like this map - https://www.patrick-wied.at/static/heatmapjs/example-legend-tooltip.html - unfortunately I have no knowledge of JS and can't rewrite this

Custom Mapbox Geocoder Control

↘锁芯ラ 提交于 2020-01-24 04:28:36
问题 I felt like this would be a simple task to do a Google / StackOverflow search for, but I can't seem to find anything on the topic... Anyways, all I want to do is create my own Geocoder Search bar that works OUTSIDE of my mapbox map. For instance, take the Zillow homepage. When you visit the homepage, you are not yet on the map. You can enter a zip code into the search bar provided, press enter (or the button), and then the map appears, centering on the zip code you provided. I basically am

Capturing data stream of a JS / Leaflet animation as MP4

醉酒当歌 提交于 2020-01-24 00:32:11
问题 How can I capture the datastream of a JS / Leaflet animation and download it to MP4? I am looking for output that looks something like the smooth path traced in these demos: https://github.com/IvanSanchez/Leaflet.Polyline.SnakeAnim Their author appears to have done them in ffcast or some screencasting softare. However, I am looking for an automated solution that can be run as script, ideally one that works on the data stream itself (not the screen), perhaps with a headless browser. I have

How to add text below a marker in leaflet?

泪湿孤枕 提交于 2020-01-23 17:31:29
问题 I created some markers on leaflet map but the only problem is that i dont know how to add a text below each marker and im not talking about popups. What I mean is that the text below the marker has to permanent. For e.g. a text below a marker on India that says "India". I have an example of what Im working on right now: var southWest = L.latLng(-89.98155760646617, -180), northEast = L.latLng(89.99346179538875, 180); var bounds = L.latLngBounds(southWest, northEast); var mymap = L.map('map', {

Trouble reading in geojson/json file into R for plotting on map

半腔热情 提交于 2020-01-23 11:35:48
问题 I'm trying to read in a json file which contains polylines into R for plotting in leaflet or ggmap. The file is in the geojson format. The file can be found at: http://datasets.antwerpen.be/v4/gis/statistischesector.json I've tried: library(rgdal) library(jsonlite) library(leaflet) geojson <- readLines("statistischesector.json", warn = FALSE) %>% paste(collapse = "\n") %>% fromJSON(simplifyVector = FALSE) This actually reads in the file but it seems to be in a wrong format for further

how can I hide tail triangle on popup

馋奶兔 提交于 2020-01-23 02:28:05
问题 image http://pasteio.com/m26f642c81452a5bf67cfc5f0b0f2390c I'm using leaflet to render the mapbox map. There is small triangle on the top of marker; how can I hide it? 回答1: This triangle is controlled by the .leaflet-popup-tip class in css. If you are using standard Leaflet, you should be able to hide the tip by adding the following to your css (after leaflet.css is loaded): .leaflet-popup-tip { width: 0px; height: 0px; } Mapbox actually creates the tip in a slightly different way from

how to add a html title (tooltip) to a leaflet.js polygon?

假装没事ソ 提交于 2020-01-22 07:22:13
问题 I have a leaflet map and I would like to add a html title (tooltip) to my polygon. If I use plain JQuery: $('<title>my tooltip</title>').appendTo() The title gets added to the DOM but is not visible. See here for more details but if I follow that solution, I can no longer use the leaflet features. I also tried the leaflet.label plugin but the label moves around with the mouse pointer. I just want the standard browser title tooltip that appears in one position shortly after on hover) thanks