Skip to main content

Questions tagged [leaflet]

Leaflet is an open-source JavaScript library for mobile-friendly, cross-browser, interactive maps. For the R leaflet package, please use the r-leaflet tag.

leaflet
1 vote
0 answers
10 views

One Json file, 2 values to filter, followed by inclusion in the Leaflet Menu Control

I have been on Leaflet maps for a few weeks. We are switching from Google maps to Leaflet. I work with a non-profit organization providing support for citizen water quality samplers. I do not mind ...
0 votes
0 answers
16 views

setZoom not working in Chrome but is working in other browsers

I am unable to get setZoom or any of the zoom features to work on my leaflet map in Chrome. It works fine in Firefox and Edge but I need it to work in Chrome also and cannot find anything on this. Any ...
1 vote
4 answers
1k views

How change size of Map in Leaflet v3 React (Inmutable properties)

I´ve been reading the changelog in v3 and I see several changes. The Map component is replaced by MapContainer, behaving differently, among other things that props are immutable I would like to create ...
0 votes
1 answer
47 views

Connecting R Leaflet to esri vector tile service

I'm building a Shiny leaflet application that I want to use a ESRI vector tile map from my organization for. I can see that leaflet connects to it as the attribution is accurate. However the tiles ...
0 votes
0 answers
20 views

How can i pass in coords to draw the correct shape on an IMAGE?

can I pass actual x / y cords to Leaflet.js to draw a shape? - I have tried using actual cords and the shape is nothing like I expect - also SetView cords can I pass them here too ? Code: var map = L....
4 votes
2 answers
2k views

Calculating Mercator d3 scaling to match Leaflet zoom level

Given a Leaflet zoom level (0..22), how would I calculate D3 scaling value for geoMercator projection? At zoom=0, the whole world fits within a single tile (256x256). In tiles, the world size is 2^...
0 votes
0 answers
32 views

Why are my leaflet points stuck to the map edge?

I try to plot transit stops on a leaflet map, indicating local clustering ("LISA"), based on Moran's I. The map is embedded in an R markdown file. I've successfully done that with polygon ...
0 votes
1 answer
34 views

WMS service basic authentication

I am building a leaflet map on a server without root access. I'd like to add a WMS service which is secured by basic authentication(username and password). There is a simple method in leaflet adding ...
0 votes
1 answer
23 views

Is it possible to count the occurrence number of a custom icon in Leaflet? If yes, how to do it?

Firstly, I'm a beginner, I've learned a lot from you. I have 5 custom icons defined: //Awesome icons var LeafIcon = L.Icon.extend({ options: { shadowUrl: "markers-shadow.png", ...
6 votes
3 answers
5k views

Coordinates of current mouse position on leaflet map with shiny

I want to access the current mouse position in a leaflet map in shiny. When using shiny you can get the current coordinates of a click event using input$MAPID_click, which contains latitude and ...
0 votes
3 answers
768 views

Update/Reload specific tile in leaflet dynamicly

If my server tells the clients when and what tile to reload/update, how can reload/update the tile sent from the server? I'm using the L.CRS.Simple CRS. And I have no zoom levels on a custom game map. ...
1 vote
1 answer
728 views

Do I need to extend Leaflet's marker class to add properties?

It's something that I have very rarely done - adding properties to a Leaflet marker. I was reading this page which says that we should customMarker = L.Marker.extend({ options: { name: '', ...
1 vote
1 answer
564 views

how to keep class attribute stored for Leaflet.js markers

I have a set of markers each stored in different Layers... lets say: let earth= { layer:{ ... Markers:{...} } } let mars= { layer:{ ... Markers:{...} } }...
121 votes
20 answers
235k views

Leaflet changing Marker color

Is there a way to randomly change marker-colors in native Leaflet? I'm using svg elements which could be styled. I know that it is possible with mapbox.js To clarify what I intend to do: If you add ...
0 votes
0 answers
41 views

How can I improve React Leaflet performance when rapidly updating a marker position?

I'm working on a page which reads GPX files (a series of lat/lon GPS points) and plots the route using React Leaflet as well as showing an elevation profile using react-chartjs-2. When hovering over ...

15 30 50 per page
1
2 3 4 5
933