All Questions
30
questions
45
votes
9
answers
50k
views
leaflet map shows up grey
I'm starting leaflet.js with the quickstart but my map shows as grey... is there something I'm missing?
script.js:
var leafletMap = L.map('leafletMap').setView([51.505, -0.09], 13);
L.tileLayer('...
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 ...
24
votes
2
answers
22k
views
How to add markers bulk in leaflet?
I have an array with ~30k elements and I need to create map with markers for each of them. I use markerclusters and trying to optimize adding moment.
for (var i = 0; i < myItems.length; i++) {
...
4
votes
1
answer
5k
views
Global map tiles disappear past zoom level 19
I use OpenStreetMap with Leaflet.js.
I have a map with an indoor picture on it. The problem is when I zoom in, streets disapears. Do you know anything that can solve this plz? Tricks or tips!
EDIT:
...
55
votes
1
answer
48k
views
Get address from co-ordinates using OpenStreetMap [closed]
I'm looking for a solution which gives an address based on co-ordinates (Latitude & Longitude) which I got from html5 geolocation api. I'm using OpenStreetMap.
14
votes
2
answers
38k
views
How to add only one marker in leaflet map
I am adding marker on map on user click.
Problem is that I want only one marker but now whenever I click on map new marker is added.
I am trying to remove it but nothing happens:
var marker;
map....
11
votes
1
answer
11k
views
Show only United States when using Leaflet.js and OSM
I'm using leaflet.js and OSM tiles to create a map, but I'd only like the continental United States to be viewable, not the entire world. Is that possible?
I'm loading the map like this:
var map = L....
5
votes
2
answers
9k
views
How to add two geoJSON feature collections in to two layer groups
I have two geoJSON feature collections that I need to add to the map, and I also want them to be toggled on and off via the layer visibility controllers as shown in http://leafletjs.com/examples/...
5
votes
1
answer
4k
views
OpenStreetMap often sends Gateway Timeout error
I am using a leaflet map in program with the following code:
<style>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" integrity="sha512-...
5
votes
1
answer
2k
views
How to use leaflet slider along with markercluster in Javascript?
i am making a map that uses a slider to show or hide markers, and i want to add clustering functionality, each one alone works perfectly, but i want the slider to show the markers, and in case of ...
1
vote
4
answers
1k
views
Color certain grid tiles based on coordinates
I would like to color certain grid tiles based on their coordinates.
I created the following grid:
<!DOCTYPE html>
<html>
<head>
<title>Color Tiles</title>
&...
-1
votes
3
answers
8k
views
reverse entries in (multi-dimensional) array in javascript
I'm using leafletjs to display some polygons on an openstretmap.
I have an external data ressource which gives me the coordinates for the polygons. Unfortunately this array has the wrong order for ...
9
votes
2
answers
10k
views
Showing an offline OSM map file. Suggestion: an MB Tiles file with Js.library
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 ...
8
votes
2
answers
21k
views
Leaflet custom marker icon scale to zoom
I use Leaflet to draw an OpenStreetMap and attach it with a custom icon marker
var mymap = L.map('mapid').setView([x, y], 13);
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?...
8
votes
4
answers
11k
views
Render 2500 geoJSON polygons onto a leaflet map
I've been searching but cannot seem to find a solution.
I have a GeoJSON file which is 170mb in size. It contains about 2500 polygons. Somehow I need to render it to a leaflet map. Evidently at that ...