leaflet

How do I force leaflet to update the map?

我的未来我决定 提交于 2020-01-13 22:42:41
问题 I'm running into issues as I am using Leaflet together with React, the issue being that Leaflet wants to control the DOM rendering as well, as far as I've researched. Right now, the countries will correctly be colored with the specific color code corresponding with the backend information(range of 1-->100). However, it is updated every minute. Upon update, the country color will not change. It will however if you hover the mouse over a given country, which is a bit weird. Here's my source

mapboxgl.js versus leaflet.js

自闭症网瘾萝莉.ら 提交于 2020-01-13 20:53:47
问题 I am about to start a web application with the main purpose of displaying a mapbox map, toggle layers and display data based on interactions with the map. I'm wondering should I be using mapboxgl.js AND leaflet.js, mapboxgl.js OR leaflet.js. Everyone keeps saying leaflet is amazing but wondering if mapboxgl gives you the same functionality and performance? I keep reading conflicting things on the internet Would really appreciate the help 回答1: A few words to clarify the difference: mapboxgl

Export leaflet map to geojson

穿精又带淫゛_ 提交于 2020-01-13 10:14:10
问题 Is it possible to export geojson from leaflet to save the map state? I want to store the markers, zoom & map center to load it later. There is plenty of ways to load geojson on leaflet, but I can't figure out any option to export the map to geojson... 回答1: There's no "out-of-the-box" option to export all the markers on the map to GeoJSON but it's something you can do easily do yourself. Leaflet's L.Marker has a toGeoJSON method: Returns a GeoJSON representation of the marker (GeoJSON Point

Export leaflet map to geojson

妖精的绣舞 提交于 2020-01-13 10:14:08
问题 Is it possible to export geojson from leaflet to save the map state? I want to store the markers, zoom & map center to load it later. There is plenty of ways to load geojson on leaflet, but I can't figure out any option to export the map to geojson... 回答1: There's no "out-of-the-box" option to export all the markers on the map to GeoJSON but it's something you can do easily do yourself. Leaflet's L.Marker has a toGeoJSON method: Returns a GeoJSON representation of the marker (GeoJSON Point

Adding Leaflet layer control to sidebar

痞子三分冷 提交于 2020-01-13 05:18:06
问题 I'm using the Leaflet sidebar V2 plugin and am wondering if it is possible to put a leaflet layer control menu into the sidebar? Any help is greatly appreciated! Thanks! 回答1: Just use this hint. It removes the L.control element from the map container and adds it to a new parent. You can do this for the sidebar straight forward. HTML: <div id="sidebar" class="sidebar collapsed"> <div class="sidebar-tabs"> <ul role="tablist"> <li>....</li> <li>....</li> </ul> </div> <div class="sidebar-content"

Showing an offline OSM map file. Suggestion: an MB Tiles file with Js.library

不打扰是莪最后的温柔 提交于 2020-01-12 23:51:12
问题 When online access to the internet is not possible, I would like the (offline) HTML5 app show an OSM map via an OSM file. Can you give an example of how I can show in an offline Html5 app OSM tiles that are loaded from an offline OSM map file like Mapsforge / Geofabrik etc? Example: via the openstreetmap.org I first exported a small part of a map. How can I show this downloaded OSM map in the Html5 offline webapp. 回答1: Yes, it's possible to do this in Leaflet, or any other mapping library.

R, GeoJSON and Leaflet

余生颓废 提交于 2020-01-12 08:36:32
问题 I recently learned about leafletjs.com from an R-Bloggers.com post. One such tutorial that I would like to achieve is to create interactive choropleth maps with leaflet (http://leafletjs.com/examples/choropleth.html). I have been using the rjson package for R to create the data.js file to be read by leaflet. Although I have had success with using the provided shape file as a readable JSON file in leaflet, I am unable to repeat the process when trying to merge additional properties from the

R, GeoJSON and Leaflet

♀尐吖头ヾ 提交于 2020-01-12 08:36:31
问题 I recently learned about leafletjs.com from an R-Bloggers.com post. One such tutorial that I would like to achieve is to create interactive choropleth maps with leaflet (http://leafletjs.com/examples/choropleth.html). I have been using the rjson package for R to create the data.js file to be read by leaflet. Although I have had success with using the provided shape file as a readable JSON file in leaflet, I am unable to repeat the process when trying to merge additional properties from the

How to set the radius of a circle marker to be proportional to an attribute value?

天大地大妈咪最大 提交于 2020-01-11 14:31:07
问题 So I am making a Leaflet map. I am using a json which lists countries as Latlng points, and their corresponding attribute (called CTH values). I am trying to use this value to set the radius of circle markers on these Latlng points, but I am struggling to figure out how. This is what I've written function addCTHValueMarkers () { CTHValueLayer = L.geoJSON(CTHValue, { pointToLayer: function (feature, latlng) { return new L.circleMarker(latlng, { fillOpacity: 0.6, radius: setRadius(feature

2nd leaflet map not rendering correctly

狂风中的少年 提交于 2020-01-11 12:59:13
问题 I have 2 tabs, each has a leaflet map. The first map is rendering correctly, but the second map is only displaying 1 tile (the rest grey) and the map is not centered on the correct area. What am I doing wrong? Thanks. var map = L.map('tab-1').setView([latitude, longitude], 5); L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', { attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http:/