Questions tagged [leaflet]

An Open-Source JavaScript Library for Mobile-Friendly Interactive Maps

Filter by
Sorted by
Tagged with
7 votes
3 answers
10k views

getActiveLayers for LeafletJS

I'd like to identify the layers that are currently active (which basemap is currently in view and which overlays are currently turned on). Was hoping to find something akin to getActiveLayers in the ...
sfletche's user avatar
  • 1,216
7 votes
3 answers
7k views

Creating buffer around point in LeafletJS?

I am using LeafletJS. I want to create buffer around point. After Selecting a point buffer radius will be specifed by user in feet. After searching of a while I found this link of JSTS. Does JSTS ...
apaleja's user avatar
  • 405
7 votes
1 answer
14k views

Submit a form from within a leaflet popup?

I want to submit a form from within a leaflet popup simply using javascript and geojson. I am essentially collecting attribute information in the form and then I want to process the information into ...
Stella's user avatar
  • 1,318
7 votes
2 answers
13k views

How to create leaflet legend for points

I have points like this in a leaflet map. The points come originally from a GeoJSON file and I used L.circleMarker to convert them to circles. How can I create a legend for these points? Based on ...
ustroetz's user avatar
  • 7,994
7 votes
3 answers
35k views

Adding Clickable Button on Leaflet Map

I am trying to add a clickable button on Leaflet map. Right now using this: <ion-content padding scrollbar-y-auto> <div id="map" style="width: 100%; height: 100%">&...
rektandpepper's user avatar
7 votes
2 answers
5k views

Adding a linestring by st_read in Shiny/Leaflet

I have a large shapefile. For a better perfomance I try to load data with st_read() from sf package. The official documentation states that it should be very easy to integrate the shapefile into ...
user60856839's user avatar
7 votes
4 answers
4k views

Is there an algorithm to calculate MGRS grid lines?

I am looking for a utility to calculate MGRS grid lines, or at least an algorithm. I would like to draw MGRS grid lines on a google or leaflet map. Seems like most of what I find are shapefiles/...
lostintranslation's user avatar
7 votes
3 answers
14k views

change width of outline for leaflet map depending on zoomlevel

I want to change the outline of a polygon depending on the zoomlevel. I thought it's easy to implement but there must be something wrong. My polygons dissapear when I try it with this code: to get ...
obrob's user avatar
  • 857
7 votes
1 answer
10k views

Changing size of cluster based on number of markers in Leaflet clustermarker

I'm currently using Leaflet's markercluster add-on, which is working really nicely for some of my initial maps. Is there a way to modify the clusters so that the size of the cluster (preferably ...
kylerthecreator's user avatar
7 votes
1 answer
6k views

Adding offset to GeoJSON layer in Leaflet?

Using the example GeoJSON tutorial code at leafletjs.com. Change the myLines variable so that the two lines overlap, but run in opposite directions as follows: var myLines = [{ "type": "...
Brian D's user avatar
  • 375
7 votes
2 answers
27k views

Leaflet export to jpg

Does anybody know if there is a way to export the current view of a Leaflet map to jpg? The setup is as follows: Leaflet is hooked up to an Oracle database. Depending on user interaction, various ...
Josh's user avatar
  • 1,162
7 votes
1 answer
8k views

Offline SLIPPY Map (Tiles) Database for Leaflet

How can create an offline cache of a large number of SLIPPY tile (PNG, 256x256) inside a web browser and then display them from that offline cache. For example, can one use HTML5 IndexedDB as an ...
7 votes
1 answer
7k views

leaflet - divicon - How to hide the default square shadow?

For example, I write this: L.marker([lat, long], {icon: L.divIcon({html:"China"})}).addTo(map); I checked the documentation: By default, it has a 'leaflet-div-icon' CSS class and is styled as a ...
Hull Qin's user avatar
7 votes
1 answer
30k views

Leaflet map draggable marker events

Everytime I click on the map I create a draggable marker with a drag function. It works great, however everytime I release the mouse after I dragged some marker, the click event of the map is ...
dimitris93's user avatar
7 votes
2 answers
5k views

How do you get the nodes of an area in Overpass API in the "right" order?

I use the Overpass API to get the boundary of an OSM relation. I then use the result to display the boundary on a leaflet map. My problem is however, that the nodes are not in the "right order". ...
Misch's user avatar
  • 173
7 votes
2 answers
31k views

Add Legend to Leaflet Map

I have a leaflet map that consists of various wms layers representing different years. I am trying to add a legend to my leaflet map but with my own custom hex colours instead of trying to use a ...
cmca's user avatar
  • 367
7 votes
1 answer
1k views

Leaflet geojson styling leaves gaps between polygon

I'm styling a geojson polygon composed of multiple closely placed vertical segements which doesnot have a gap in between (i've checked the topology). I want to display just the fill and without stroke....
Bishrant's user avatar
  • 346
7 votes
1 answer
13k views

Formating GeoJSON file with Leaflet Ajax-plugin

First of all I apologize for my basic english. I have to say, too, that I'm really a newby in coding. I'm trying to create an interactive map using Leaflet (you can see it here). I was able to show my ...
Jerome's user avatar
  • 71
7 votes
2 answers
14k views

Make sidebar div active on Marker click (and vice versa)?

What's the best way to change an element to active when you click on a marker. For example, when you click on a marker on a Leaflet map, how to make it so the sidebar element that's related to it ...
Kyle Pennell's user avatar
7 votes
2 answers
4k views

LeafletJS: Load Tile Layer based on bounding box

I have a LeafletJS map application with lots of layers. I have a few layers that only have imagery for certain regions across the world. Because everything goes on a world base map. All tile caches ...
Shaunak's user avatar
  • 999
7 votes
1 answer
7k views

Removing specific Circle Markers in Leaflet Shiny

I have a layer of CircleMarkers and I am trying to remove only the markers that have a certain layerId. The id's for these circle markers are in a dataframe. In reality I have millions of id's whose ...
DS501's user avatar
  • 107
7 votes
1 answer
11k views

Display L.marker without icon

Would like to start my leaflet map without any features displayed on start. The feature should not be displayed before a location is found via my search.control. I started with // first "invisible" ...
howard.D's user avatar
  • 473
7 votes
2 answers
5k views

Which plugin can draw topoJson right within Leaflet without conversion?

I already have asked how to reduce file size and increase performance for publishing spatial data on the web using Leaflet, here. A conversion to TopoJSON has reduced the file size by approximately ...
Doruk Karınca's user avatar
7 votes
1 answer
14k views

Leaflet.draw: add attributes and save to file

I want to create a simple web page, where user can create features (with Leaflet.Draw), add attributes (ex. name/description) and save created features to file, ex. geojson. So far creating, adding ...
falqn's user avatar
  • 73
7 votes
1 answer
6k views

Leaflet map loads incorrectly when inside a Bootstrap .collapse element

I'm trying to create a Leaflet map which is hidden when the page loads, and revealed when the user clicks a button. I'm trying to use the Bootstrap collapse functionality to reveal the map on a ...
Stephen Lead's user avatar
  • 21.1k
7 votes
2 answers
1k views

Access GeoJSON from GitHub in Leaflet

I am new to JSON, GitHub, and Leaflet. I am trying to create a simple application which will render my points which are in GeoJSON up on GitHub. From everything I have read this should work. ...
Jennifer Boehnert's user avatar
7 votes
3 answers
17k views

Load a raster file directly in Leaflet

Is it possible to load a raster file (e.g. GeoTIFF or Erdas img) directly into a Leaflet map? If so, can you guide me to the correct documentation or method to do this? I am trying to do this with the ...
geo derek's user avatar
  • 505
7 votes
2 answers
2k views

Is it possible to use a raster::click event within an interactive leaflet map?

Data Download: https://www.dropbox.com/s/f849ra8l6umo9d8/crops.tif?dl=0 I have various raster images of the world that I would ultimately like to plot within an interactive leaflet map; an example is ...
Lauren's user avatar
  • 1,902
7 votes
3 answers
5k views

Big data sets and challenges using the Leaflet client

I am using Leaflet to present around 90.000 data points. My test code is generated using the plugin QGIS2leaf in QGIS 10.10.1. I am using clustering and reviewing the code I can see that this is "...
ragnvald's user avatar
  • 3,191
7 votes
2 answers
2k views

Leaflet: How to enable pan & zoom while GeoJSON still rendering?

I've overlaid a huge GeoJSON geometry on top of my Leaflet map, covering about 20 countries' borderlines (about 1,5 million vertices) using "L.geoJson". Each time I zoom in/out, the computer has to ...
Doruk Karınca's user avatar
7 votes
1 answer
1k views

Enabling hover popup window for feature IDs in Mapview package for R

I've been working with interactive mapping within R for a while now and most of my experience lies in Leaflet (mostly the R package, but also a bit in Javascript). I just recently delved into mapview ...
Lauren's user avatar
  • 1,902
7 votes
1 answer
4k views

Map not rendering at zoom level 18+ using openlayers3 and leaflet

I've configured an OSM map server with mod_tile/renderd/postgres to display a basic map and everything works fine until I try to zoom into level 18 or more. At any zoom level less than 18, I can see ...
thinc's user avatar
  • 71
7 votes
1 answer
2k views

Leaflet Event Craziness: jQuery click events don't propagate to L.DomEvents

I noticed that calling .click() on jQuery selected DOM elements in Leaflet ( such as anchor icons ) will not do anything -- the click event isn't propagated to the events created with L.DomEvents. For ...
stickyBit's user avatar
  • 291
7 votes
1 answer
3k views

Using Tilestache and Leaflet To Display Rasters In Native Projection

I have a collection of old Idaho state highway maps in GeoTiff format. The projection that these maps have been georeferenced in is a transverse mercator projection, called IDTM83 (Idaho Transverse ...
SagebrushGIS's user avatar
7 votes
1 answer
8k views

Leaflet and EPSG 4326 Projections

UPDATE: LEAFLET fixed support for EPSG 4326 (LL84) in the latest betas: https://github.com/Leaflet/Leaflet/issues/1207 Leaflet says it supports EPSG 4326 (Plate Carree, aka ll84) projections. I think ...
Dr.YSG's user avatar
  • 1,367
7 votes
0 answers
2k views

What is the best way to display a large shapefile (with polygons) as a layer on a leaflet map?

I have a leaflet map of the UK with around ~2000 points total points and a bit of metadata loading for each point with two side-panels showing the metadata. These points are drawn from several tables ...
Jeremy Kidwell's user avatar
6 votes
5 answers
8k views

gdal2tiles.py generates wrong tiles / MapTiler the right ones

I'm trying to generate tiles with gdal2tiles.py and the resulting tiles are stored as 18/132639/164219. If I do the same thing with MapTiler (the GUI variant of gdal2tiles) the tile result is 18/...
user avatar
6 votes
3 answers
6k views

How to add a floating "crosshairs" icon above leaflet map?

While reading the article about MapBox's map utility to searching for flight MH370, I noticed that they have a stationary "floating" target (or crosshairs) icon that helps users identify the center of ...
RyanKDalton's user avatar
  • 23.1k
6 votes
2 answers
28k views

Go to the URL when clicked on Leaflet marker

I want to implement marker click event so when user click on marker it goes to url. Url is written inside an array (a[3]). However, this is my code which doesn't work, it always goes to the link of ...
againstflow's user avatar
  • 5,034
6 votes
5 answers
1k views

Is it possible to redesign OpenStreetMap tiles?

We have an application working with OpenLayers and are using OpenStreetmap for the map tiles, however they don't look great. Is there anyway to style these maps? I read something about Mapbox but it ...
Quade's user avatar
  • 223
6 votes
3 answers
20k views

How can I convert an image into map tiles for leafletJS [closed]

I'm trying to make it so that people can upload an image onto my site and have it converted into tiles for leaflet that can be used for a custom interactive map. The images are maps from games, not ...
anthius balaraw Xanthius's user avatar
6 votes
2 answers
1k views

Make polygon of GeoJSON layer unclickable after first click in Leaflet

I have added a GeoJSON file consisting of multiple polygons to a leaflet map. Now after clicking on any of those polygons I don't want Leaflet to accept any subsequent click events for this specific ...
René K's user avatar
  • 187
6 votes
1 answer
3k views

Adding graticules to Folium map [closed]

Are there any chances to add grid on Folium map? Something like on this picture.
TImur Nazarov's user avatar
6 votes
2 answers
8k views

Redraw/Refresh WMS layer in Leaflet

I have a WMS layer in my leaflet map: var wmsLayer = L.tileLayer.wms('http://localhost:8080/geoserver/volonteri/wms?', { layers: "trgovine", transparent: true, ...
Marin Leontenko's user avatar
6 votes
1 answer
3k views

Invalid GeoJSON when inserting data to a CartoDB (PostGIS) table from Leaflet

I've been following along to this tutorial from CartoDB. I create the GeoJSON using: var drawing = "'"+JSON.stringify(layer.toGeoJSON())+"'"; and then inserting using a custom SQL function which ...
raphael's user avatar
  • 3,407
6 votes
2 answers
12k views

Open popups in a fixed position with Leaflet

I have create my map with Leaflet exactly how I want it (with my markers and externals links). I would like to have the popup always fixes in the top right hand corner (for an example). Is there ...
monky's user avatar
  • 179
6 votes
3 answers
10k views

Leaflet routing control change marker icon

I am looking for a way to show different markers for the two waypoint that are initialized by leaflet.routing.control. This is what i tried: var controlWalk = L.Routing.control({ lineOptions: {...
howard.D's user avatar
  • 473
6 votes
1 answer
6k views

Transparent NoData through WMS in Leaflet

I'm trying to create a Leaflet map with an OpenStreetMap as a basemap and a layer from a GeoServer WMS. I use: var wmsLayer = L.tileLayer.wms('http://localhost:8080/geoserver/workspace/wms', { ...
unnic's user avatar
  • 360
6 votes
1 answer
4k views

How to use Igraph with leaflet for R?

I try to draw a graph in map with R code : df<-data.frame("from" = c("Lyon", "Toulouse", "Paris", "Marseille"), "to"= c("Paris", "Paris", "Marseille", "Toulouse")) meta <- data....
zina_GIS's user avatar
  • 763
6 votes
1 answer
3k views

Navigate two leaflet maps

I am looking for an example where there would be multiple map divs containing leaflet maps. When one is panned I want the other one to pan or zoom with it so they are always in sync.
dakotaBear's user avatar

1
3 4
5
6 7
84