Skip to main content

All Questions

29 votes
6 answers
27k views

How to identify Leaflet's Marker during a `popupopen` event?

when a marker is clicked, I need to execute some code that finds the id corresponding to the marker being clicked , retrieves data from backend API, then adds the newly retrieved data to the content ...
Nyxynyx's user avatar
  • 62.8k
9 votes
1 answer
4k views

Single Event Handler for Multiple Events in Leaflet

Is it possible to create a trigger for multiple events in this manner? map.on('click, dragstart, zoomstart', eventHandler); If not what will be the next best way to trigger the same event handler ...
Nyxynyx's user avatar
  • 62.8k
4 votes
1 answer
8k views

Unable to use Custom Icons in Leaflet

Continuing with the map navigation application I am trying to create, I have encountered the following error: I parse the OSM tile and get a list of all the Points of Interest. This is successful. I ...
Spyros's user avatar
  • 197
4 votes
1 answer
2k views

Why isn't my map completely showing?

I am using Leaflet to display a map. I just changed my HTML to use jQuery Mobile and Leaflet. I read the documentation for jQuery Mobile, which says I have to add jQuery 1.11. <script src="http://...
martin10's user avatar
  • 199
4 votes
1 answer
3k views

Leaflet map marker dragging is not working properly on mobiles when disabling scrolling

I added an OpenStreetMap map on my project using Leaflet. I wanted to disable scrolling on mobiles and wheel scroll on desktops. I used the following options found here and managed to achieve this. ...
Giannis Lps's user avatar
3 votes
1 answer
2k views

Leaflet Markerclusterer with Leaflet.Label

Question: Is it possible to use Leaflet.label on Leaflet.markercluster? Problem: I am trying to have a HTML div appear when the cursor hovers over a cluster icon. For a normal Marker, you can use ...
Nyxynyx's user avatar
  • 62.8k
2 votes
1 answer
1k views

How does one specify an "active" region of a leaflet map?

Please consider: http://jsfiddle.net/msNs5/3/ I have a map div that expands to full size on page load, and another semi-transparent div that covers the bottom of it. Aesthetically, I really like how ...
user avatar
2 votes
1 answer
66 views

Sending a variable from a function in JS

I have a JS script with a map, which works well: var lat = 0; var lng = 0; function onLocationFound(e) { var radius = e.accuracy / 2; lat = e.latlng.lat; lng = e.latlng.lng; console.log(e....
trakis's user avatar
  • 45
2 votes
1 answer
650 views

Centering the map in the place where the user is located in OpenStreetMap

I am beginner webmaster. I have map with 2 markers and round. I have this code: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>...
trakis's user avatar
  • 45
2 votes
0 answers
406 views

Load large GeoJson files on demand on a leaflet map (checkboxes)

I have heavy Geojson files to display on a leaflet map. Because they are heavy, I would like them to be loaded only if the user checks a specific box on the map related to each of these Geojson files. ...
Paul Noon's user avatar
  • 686
1 vote
2 answers
13k views

Add new marker when I click on the map (OpenStreetMap, Leaflet JS)

I want to add a new marker on the map when I right click, function InitialiserCarte() { var map = L.map('map').setView([48.866667, 2.333333], 17); // create the tile layer with correct attribution ...
Nassim El Hormi's user avatar
1 vote
2 answers
2k views

Generate 10,000 markers with good performance with layer group leaflet

Hello I need help I have an application that I need to generate 10k of markers and I can't use the cluster after the client wants all the points on the map, I even used a library: https://github.com/...
FireWallSP's user avatar
1 vote
1 answer
997 views

How can I reverse geocode to get country name of a given state/regione or city name?

I am trying to find the country name of a given location, for example lets say I know pennsylvania how do I find out automatically United States of America? I found a couple of links for reverse ...
rob.m's user avatar
  • 10.4k
1 vote
1 answer
76 views

How to prevent click on outside of polygons in Leaflet map js?

We have multiple arrays of lat long, ( here 3 arrays are stored in success_content_mapareas ) Accordingly, we have created the map and it looks like this, which seems okay in the image below. We need ...
Mark Tendly's user avatar
1 vote
3 answers
3k views

Leaflet map not showing properly on mobile

I have a page with filters on top and a toggle between tile view or map view. Every time a filter is changed I perform a search with AJAX and change the view using Mustache. On mobile the default ...
Dennis's user avatar
  • 3,520

15 30 50 per page