I am trying to create a custom button for arrows in the drawing tool of leaflet-geoman. The idea was to work with the copyDrawControl function, and to use Line as a model to make Polylines with arrow tips. I wrote a code mostly inspired from this demonstration https://codesandbox.io/s/394eq?file=/src/index.js and modified it for my goals. Here is the code : When
Tag: leaflet
How to create a button to enable/disable zoom and pan for leaflet in javascript react?
As the title says, I’m searching how to create a button to enable/disable zoom and pan for leaflet in javascript react. Actually creating a button is fine, but getting the effect I want on my map is not. I am working on a react project and trying to implement a leaflet map that swiches between an “edit” mode and a
R Shiny leaflet: how to query a Web Map Service layer with a fake click?
I’m trying to display the information tooltip of a queryable WMS (Web Map Service) layer in a leaflet in Shiny. I need it to be performed in 2 different ways: 1/ clicking 2/ typing in coordinates. With the MWE (R code) at the end of this post, a click anywhere on the WMS displays the tooltip , which is part
Importing leaflet into module from cdn with typescript support
I’m trying to import leaflet into a javascript module with typescript support but can’t get it to work. I’ve installed @types/leaflet and have tried to following: import ‘https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.8.0/leaflet.js’ This works fine in the browser but typescript gives the following error: ‘L’ refers to a UMD global, but the current file is a module. Consider adding an import instead.ts(2686) (I call
How can I use leaflet-polylinedecorator with a vue app
I have a Vue 2 sample project at https://github.com/ericg-vue-questions/leaflet-test This is a simple import issue for my code that I am not sure how to handle. A couple of things I have tried are to modify the code to do: but this results in a build error: To the index.html, I also tried adding: but that results in the runtime
leaflet load markers and pop ups from external file
I am currently building a leaflet map where I will implement a bunch of markers with popups. I want all of my markers and popups stored in an external file to keep the code as clean as possible. My question is, how can I achieve this? Do I create a geojson file with the markers and popups and if so,
How to reset a leaflet map after a case in JS
Hi, i have the following problem: I have a map in leaflet linked to a change function in jquery, depending on the ID that I receive in the “select” of the previous query, the case is entered below in JS: At the moment of choosing another case (Stored in a select in HTML ) the data that the first case
How to modify href property on Leaflet 1.8 Popup?
Is there a way to modify the href property of the close button on a Leaflet 1.8 popup? I can’t find anything in the documentation for it. Answer Unfortunately there is indeed no API in Leaflet for that specifically. However you can easily customize Leaflet behaviour by modifying how its classes behave. In your case, you would override L.Popup._initLayout method.
How can I update a Marker custom option? Javascript and Leaflet
I have a leaflet map with some Markers and I need to update custom option inside Marker option when I make doble click on each Marker. I only can create new Marker with this new info but this will take so much space. Default options in Marker like latitude, longitude or icon have specific setFunction but custom options don’t. Someone
Cypress not properly intercepting leaflet map tile calls
I am testing a react-leaflet based application in cypress. To avoid making tons of real maptile requests, I am trying to intercept calls to the mapbox maptile server, and replace with a dummy tile. I do this in my cypress/support.index.js file: A simple test: I took a look at Mock leaflet resources in Cypress, and this tactic seemed to work