leaflet

SVG icons in Leaflet.js map

我的未来我决定 提交于 2020-05-27 04:56:27
问题 I have a working Leaflet map but cannot pass in SVG icons using encodeURI (have not tried encodeURIComponent because I'm not sure that is the issue). The gist I'm using shows how to pass in SVG rectangles and this works: <svg xmlns='http://www.w3.org/2000/svg'> <rect> x='0' y='0' width='20' height='10' fill='#000000' </rect> </svg> However, I cannot pass in a circle or a path successfully, even though the code is valid, optimized in SVGOMG, and appearing properly on SVG linters such as SVG

How to prevent Leaflet map resizing on zoom in Vue/Vuetify app

江枫思渺然 提交于 2020-05-26 08:21:31
问题 I'm having a problem with a Leaflet map in a Vue.js application using the Vuetify framework. I'm trying to get the map to occupy the full screen (except for the top nav bar) but the map resizes/repositions itself vertically within the page when I click on the zoom buttons. Here are two screenshots of the same problem from a JSFiddle, showing before: and after (note the upwards shift of the map, hiding part of the zoom buttons below the navbar): As far as I can tell, the problem is occurring

How to prevent Leaflet map resizing on zoom in Vue/Vuetify app

主宰稳场 提交于 2020-05-26 08:20:44
问题 I'm having a problem with a Leaflet map in a Vue.js application using the Vuetify framework. I'm trying to get the map to occupy the full screen (except for the top nav bar) but the map resizes/repositions itself vertically within the page when I click on the zoom buttons. Here are two screenshots of the same problem from a JSFiddle, showing before: and after (note the upwards shift of the map, hiding part of the zoom buttons below the navbar): As far as I can tell, the problem is occurring

How do you call fitBounds() when using leaflet-react?

我与影子孤独终老i 提交于 2020-05-21 20:11:06
问题 I cannot figure out how to call fitBounds() on the Leaflet map. If I was just using vanilla leaflet, this solution would work perfectly: Zoom to fit all markers in Mapbox or Leaflet Unfortunately, I am using react-leaflet. Here is the solution if I was just using leaflet by itself. var leafletMap = new L.featureGroup([marker1, marker2, marker3]); map.fitBounds(leafletMap.getBounds()); I think this code (my code) this.mapRef.current.leafletElement is equivalent to var leafletMap = new L

Is there a way to make a leaflet popup responsive using react-leaflet library?

*爱你&永不变心* 提交于 2020-05-17 09:04:06
问题 I've been researching and I know leafletjs has the plugin https://github.com/yafred/leaflet-responsive-popup but I need a workaround for the library I'm using react-leaflet. The react-leaflet has a lot of third-party plugins but I don't see anything that works for me. If someone knows how or has done something like this it would be cool if you could share it. I'm having a hard time with this. Thanks. 回答1: Install the library, import js, css get a map reference and then render the marker:

Conflict when generating addPolylines on the map made by Leaflet

泄露秘密 提交于 2020-05-17 07:45:11
问题 Friends, could you help me with the following question: I am having a conflict when inserting the addPolylines function to generate my second leaflet map. In general, Map 1 involves showing all clusters and Map 2 involves a specific cluster. For this specific cluster I inserted a feature to adhere the same colors as the clusters formed on the map1. The first code is doing the above descriptions correctly. However, I also inserted the second code that refers to addPolylines for the second map.

Leafletjs - Struggling to get markers to merge at world view

我的梦境 提交于 2020-05-17 06:05:19
问题 I am working on a visualisation that utilises a mapbox choropleth map and leafletjs markers. At the moment, I am struggling on getting the markers to merge together on zoom out at country level. I have tried reading the my code through but I have not been able to find a way to solve this issue. Attached is my code for my map. (function() { window.petMap = { map: '', mapCenter: [36.19109202182454, -95.99853515625001], tileUrl: 'https://api.mapbox.com/styles/v1/sourcetop

Why is Leaflet so slow at pan and zoom inside React?

我只是一个虾纸丫 提交于 2020-05-17 06:01:30
问题 I have a fairly simple application that renders around 3000 points using leaflet.js. It renders fairly quickly but pan and zoom are terribly slow. Looking at the performance tools in chrome, it looks like most of the time is spend in recalculate styles, but that hasn't been helpful. <LeafletMap center={[50, 10]} zoom={6} maxZoom={10} preferCanvas={true} > <TileLayer url='http://{s}.tile.osm.org/{z}/{x}/{y}.png' /> {this.state.locations.map( (location, index) => { return ( <Marker position={

Extract attributes for markers in leaflet, onClick event

爱⌒轻易说出口 提交于 2020-05-16 20:35:12
问题 I'm using a JSON file to plot the markers in Leaflet: [{ "id": 1, "date": "1/1/2015", "Title": "Trinity College", "Latitude": 41.745167, "Longitude": -72.69263}, { "id": 2, "date": "1/2/2015", "Title": "Wesleyan University", "Latitude": 41.55709, "Longitude": -72.65691 },{...}] What I'm doing is the following: var markers = new L.markerClusterGroup(); //clustering function var markerList = []; for (var i = 0; i < jsonDataObject.length; i++) { var marker = L.marker(L.latLng(parseFloat

Color problem in a map made by leaflet in shiny

♀尐吖头ヾ 提交于 2020-05-16 04:28:11
问题 Friends, could you help me with the following question: I have a little problem with the colors of the second map made using leaflet. Regardless of which cluster I choose, the color of the cluster turns blue, however I would like the colors to be the same as the respective cluster shown on first map. For example, Cluster 1 is red on the first map, however when I select cluster 1 to generate the second map, it appears blue, not red. I inserted an image below to illustrate. Any help is