Questions tagged [leaflet]

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

866 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
34 votes
0 answers
3k views

Leaflet v1 plugin: layer control for ungrouped, grouped, and nested-grouped layers

I need a Leaflet plugin which extends L.Control.Layers. I have the following requirements: works with Leaflet 1.x handles ungrouped layers alongside grouped ones handles nested layer groups does not ...
Tom Chadwin's user avatar
  • 5,752
8 votes
0 answers
1k views

Using WFST in Leaflet: can not move/delete features

I write a Leaflet app which makes use of two plugins Leaflet.Draw and Leaflet.WFST. The first allows to create/edit/delete features, the second saves changes to my PostGIS database hosted by GeoServer....
Elena Klimenko's user avatar
7 votes
0 answers
1k views

Controlling the visibility of a FeatureGroup in Folium with an HTML checkbox

I'm working on a project in Django where I want to show layers on a map by checking or unchecking boxes which I created using bootstrap. I am aware it is possible to use LayerControl to get these ...
Sigo van der Linde's user avatar
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
0 answers
3k views

Make a grid map in Leaflet

I want to draw a grid map based on the temperature values in Leaflet. Similar to the illustration below. Input data: lat, lon, temperature values, cities' names Parameters: the dimensions of the ...
anonymous's user avatar
6 votes
0 answers
2k views

Can't clear markers from MarkerClusterGroup

i have problems removing all markers befor adding new ones. var L_Emergency_Access_Points = L.markerClusterGroup(); var EapMarkers = L.geoJson(null,merge_options(globalOverlayOptions, ...
wambacher's user avatar
  • 311
5 votes
0 answers
1k views

leaflet returns wrong {x} {y} tiles from arcgis mapserver

I'm trying to add a leaflet map to an Angular 2 project, which shows a layer from an ESRI mapserver as a tileLayer. As such: ngOnInit(): void { let map = L.map('map', { crs: L.CRS....
Ast's user avatar
  • 51
4 votes
0 answers
2k views

Cloud-Optimized GeoTIFF overlay on Leaflet?

I want to load external Cloud-Optimized GeoTIFF files onto a Leaflet map as overlays, and manipulate the colors based on user input. I've found examples online that appear to to this exact thing, but ...
DMack's user avatar
  • 625
4 votes
0 answers
812 views

How to develop responsive layer container in Leaflet?

I'm using leaflet.js to develop a drawing layer tool with the full-page map. Users will draw a group of layers to describe an industrial product's parts. The leaflet map and its layers should be fit ...
salihy's user avatar
  • 535
4 votes
0 answers
2k views

PostGIS - Dynamic Server-Side Clustering based on Zoom level

I'm working on a Ruby on Rails application that is showing road signs on the map(leaflet). So, user can browse map and road signs, great. But, if there are a lot of signs and user wants to zoom out, ...
Mr.Code's user avatar
  • 293
4 votes
0 answers
3k views

Leaflet zoom event direction

Is it possible to find out whether the user zooms in or out when using a Leaflet zoomstart or zoom event? map.on('zoomstart ', function() { console.log('I am zooming, but am I zooming in or out?'...
BritishSteel's user avatar
  • 6,451
4 votes
0 answers
292 views

Calculating Detours based on given blocked roads with Leaflet?

Is it possible to use a given route of "blocked roads" and calculate a route from A to B, considering that the given route is off limits using Leaflet? Where I'm from, there is an annual bicycle ...
ViktorG's user avatar
  • 159
4 votes
0 answers
2k views

Load WFS in Leaflet with BBOX query in non-default projection (i.e. not EPSG:3857)

I've had a look at this question: How to add a bounding box filter to this leaflet WFS request? and have been trying to work out how to get it to work in a different projection system, specifically ...
weiji14's user avatar
  • 1,663
4 votes
0 answers
386 views

Thematic map exported using QGIS2Web is extremely laggy

I have made a world thematic map and added layers of data for creating graduated color scheme on the country level. I need a interactive map as an output which shows values when user hover over any ...
himanshu jain's user avatar
4 votes
0 answers
3k views

How can a leaflet SVG overlay be placed outside of the leaflet-overlay-pane?

I have SVG on top of GeoJSON in my map. How can a leaflet SVG overlay be placed outside of the leaflet-overlay-pane while keeping GeoJSON in place in the leaflet-overlay-pane? (For example, how could ...
user3103373's user avatar
3 votes
1 answer
247 views

Get GeoJSON from a VectorGrid.Protobuf layer on click event

I am trying to get the GeoJSON of a VectorGrid layer on a click event. Something like this: ... var vectorTile = new L.vectorGrid.protobuf(url, options).addTo(map) vectorTile.on('click', e => { ...
D.Franco's user avatar
3 votes
0 answers
83 views

Disabling checkbox in layers list while exporting in qgis2web

Is there a possibility to disable the checkbox on certain layers in the layers list (Leaflet export)? I found something similar already here: qgis2web - show specific layers in layer list but ...
fomofahg's user avatar
3 votes
0 answers
209 views

Layer ordering of ST_ASMVT tiles in Leaflet

I am generating MVT tiles for multiple layers in Django using the following query: WITH bounds AS ( SELECT ST_Segmentize(ST_MakeEnvelope(8247861.100083642, 3551570.082242422, 8252753....
Arsh Doda's user avatar
  • 141
3 votes
1 answer
596 views

Dynamically changing fillColor variables in leaflet

When I want to style a polygon using a property the traditional way is to assign a function that returns a style object. Within that object you assign the fillColor property to a getColor function ...
Andrewchi's user avatar
3 votes
0 answers
866 views

Add a legend to Leaflet map

I am trying to add a legend in Leaflet based on a GeoJSON layer like this: This is my code: L.geoJson(Viales_Transitables).addTo(map); var Viales_TransitablesStyle = { ...
ZoneGIS's user avatar
  • 31
3 votes
1 answer
234 views

GeoJSON file content not display properly in Leaflet

I am new to Leaflet. Am facing one issue when try to display GeoJSON file in Leaflet. Issue: Actually some GeoJSON file only am facing this problem. In my knowledge coordinates are in different ...
Ram prasad's user avatar
3 votes
0 answers
4k views

Large GeoJSON file in Leaflet performance issue

I have a large GeoJSON file (now it is about 22MB with 4K polygons but it is going to contains about 10k polygons) I load the file in Leaflet using L.GeoJSON.AJAX, on each feature I attach two ...
Cenere Blu's user avatar
3 votes
0 answers
239 views

Function fires despite conditional query in leaflet-map

In a map built with Leaflet I created a button to export and download data as geoJSON drawn before by the user with Leaflet.draw. To prevent an empty download, I am querying the existence of data. ...
pascatl's user avatar
  • 899
3 votes
0 answers
6k views

Adding points to map with Leaflet using .forEach function

Trying to add an array of points to a map with a Leaflet with .forEach. I thought this should work, but alas, it does not: var jsonData = [ { "LNG":-75.16472099534634, "LAT":40....
user2740509's user avatar
3 votes
0 answers
744 views

Plug in / API for getting sea routes with leaflet

I am developing a maritime routing application prototype with Leaflet.js for my company Deep Blue Globe and using the windy interface. The problem is since windy uses Leaflet version 0.7.7 there are ...
Ankita.DBG's user avatar
3 votes
0 answers
1k views

How to change the layer selection view from Radio button to Image in Leaflet

I have implemented the below example to show the multiple base layers of map in my application using LeafletJs. Leaflet JS LayerGroup example I'm able to successfully implement the same but I'm ...
The JOKER's user avatar
  • 131
3 votes
0 answers
279 views

Extend / override Mapbox-gl 'baselayer' loadTile

Similar to how Leaflet's guide shows how to override L.TileLayer's getTileUrl method in place of your own (and L.GridLayer's createTile method), I want to know how to extend/override Mapbox-gl's ...
Alex's user avatar
  • 131
3 votes
0 answers
1k views

Markers with customs angle values

I'm trying to make some markers spinnable using this : target = document.getElementById("mapid"); target.ondragover = function(e){ e.preventDefault(); e.dataTransfer.dropEffect = "move"; }; ...
Nylak's user avatar
  • 143
3 votes
0 answers
2k views

Leaflet Draw: edit/delete features of different layers

I use Leaflet Draw and Leaflet WFST plugins to create/edit features and save my edits to PostGIS Database (hosted by GeoServer). I have three layers: points, lines, and polygons. I manage to make new ...
Elena Klimenko's user avatar
3 votes
2 answers
3k views

Basic Authentication in Leaflet

I'm using Leaflet to display map tiles. The map tiles are loaded from a different site using basic authentication. So the url template looks like this: L.tileLayer('https://username:password@example....
xenia's user avatar
  • 31
3 votes
0 answers
3k views

Save Leaflet drawn features with attributes to PostGIS

Goal: In order to have a fully interactive map, I would like to be able to save some drawn features (in a second step with some attributes that may be grabbed through an input mask form or pop-up) on ...
swiss_knight's user avatar
  • 9,373
3 votes
0 answers
1k views

Leaflet map in R Markdown - not rendering when placed after other plots

I have an R markdown document using shiny with 6 or 7 plots. They all display until the 7th plot, which is a leaflet map, which doesn't display - when I 'run document' there is a big empty space at ...
Henry Dark's user avatar
3 votes
0 answers
497 views

Determining map-projected coordinates in custom CRS for Leaflet?

I have some static USA maps in Lambert Conformal projection that I would like to overlay in Leaflet together with geo-reference support. They are centered at 38N, 98W. I have found that the closest ...
kykong's user avatar
  • 93
3 votes
0 answers
2k views

get Layer Id of a specific Marker

I have polygons represented in Leaflet. Then I added some markers over these Polygons. var = customMarker = L.Marker.extend({ options:{ Layer: '' }}); I extended marker to store the ...
zahma's user avatar
  • 141
3 votes
0 answers
251 views

Proj4Leaflet - Defining World Eckert IV

I'm trying to make a Leaflet map with World Eckert IV projection using Proj4Lefalet. From what I understand, I should be able to define my CRS like so: var crs = new L.Proj.CRS('ESRI:54012', '+...
wfgeo's user avatar
  • 3,460
3 votes
0 answers
276 views

Marker click listener jsf2leaf

I am using jsf2leaf library to add a map to a web application using primefaces. The map and the markers(popup message when clicked) are displayed correctly, however I want to display a primefaces ...
DarkSide's user avatar
3 votes
0 answers
1k views

Heatmaps with local maxima, weight, API functionalities

I am looking for a heatmap vizualization on a map, which shows: local maxima: that means that you always see some "red spots" regardless the zoom. See the picture below. enables to set a weight to ...
Adam's user avatar
  • 31
3 votes
0 answers
141 views

Image & limit user access by poly

Wondering how do I clip images to polygon outlines in a web map application based on OpenLayers or Leaflet? How can I limit web map users to see (visualize; qualitative) or query (quantitative) within ...
Arun Govind's user avatar
3 votes
0 answers
329 views

Blending edges of tile overlay

I am working on a web map using Leaflet and am using purchased satellite imagery as the base map. We want to limit the extent of the high resolution image to the area of interest, so I have resampled ...
Syb Ille's user avatar
3 votes
0 answers
236 views

Which Leaflet Basemap with shaded relief should I use for a WebGIS?

I'm having difficulties to show shaded relief in our Basemap. Where can I find a free and clean basemap service, that shows only shaded relief? With no labels, no roads, no rivers, no cities, etc., ...
eduardosteps's user avatar
3 votes
0 answers
2k views

Leaflet.Draw only edit GeoJSON

I am trying to enable editing of a GeoJSON layer in my Leaflet map using Leaflet Draw. I need to allow only a single edit at a time before saving the results back to the database. I tried to implement ...
tjmgis's user avatar
  • 3,260
3 votes
0 answers
917 views

Converting KML coordinates to Leaflet

I am trying to convert a Google Map KML file to a csv, to map the longitude and latitude points on Leaflet. But the coordinates keep mis-projecting and some end up off the land mass. The steps I have ...
Cambs.Insight's user avatar
3 votes
0 answers
410 views

Draw raster on top of a Leaflet map

I want to implement a raster layer on top of a Leaflet map that includes the following functionalities: Digital Elevation Model (DEM) terrain height included in each raster cell GPS-Track (I use this ...
Alexejevitsch's user avatar
3 votes
0 answers
781 views

Mapbox GL Leaflet interaction

I've built a map in Leaflet which has a really large GeoJSON file. Currently the only way I can get it to work is if I severely simplify the GeoJSON file down from 100mb to 25mb. I'm looking at using ...
JoeyJoeJoe's user avatar
3 votes
0 answers
4k views

LeafletJS How to set custom map scale for a flat image map (CRS.Simple)

I've been trying to get a flat image fantasy map working within LeafletJS. I have pretty much everything working well except for the map scale legend where two things are not working: I can't seem to ...
Das123's user avatar
  • 131
3 votes
0 answers
1k views

Leaflet: get the color of a specified pixel on the map

I need to get the color of a specified pixel on the map. How can I do it using the current API of Leaflet?
pedromateo's user avatar
3 votes
0 answers
771 views

Leaflet filtering existing featuregroup

I have a leftleat map and i would like to filter the featuregroup i am displaying. exp_colJSON = new L.geoJson(exp_col,{ onEachFeature: pop_col, pointToLayer: function (feature, latlng) { ...
Egidi's user avatar
  • 3,728
3 votes
0 answers
1k views

Adding an offset to a Leaflet TileLayer on the fly

I'm currently using Leaflet to display 18th century maps of Belgium as a base layer with a vector overlay of the present day road system. Although the maps are absolutely gorgeous (http://www.ngi.be/...
Michilus's user avatar
  • 131
3 votes
0 answers
486 views

TypeError: L.Proj is undefined in leaflet

I am using leaflet 0.7.3. I am trying to load a wms tile: var crs = new L.Proj.CRS('EPSG:2236', '+proj=tmerc +lat_0=24.33333333333333 +lon_0=-81 +k=0.999941177 +x_0=200000.0001016002 +y_0=0 +ellps=...
user3657279's user avatar
3 votes
1 answer
1k views

Send viewparams GeoServer using Leaflet

I need to pass my longitudes and latitudes of origin and destination for a SQL view in GeoServer to get a WMS layer with the route. I've performed in qgis to view and is working perfectly. This is the ...
csf's user avatar
  • 979

1
2 3 4 5
18