Questions tagged [leaflet]

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

519 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
18
votes
0answers
1k 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 ...
5
votes
0answers
285 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....
5
votes
0answers
720 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 ...
4
votes
1answer
2k views

Get the lat/lng values of lines, polygons drawn by Leaflet drawing tools

I am new to JavaScript and Leaflet too. I made a basic map in Leaflet. I have also floated one sample geojson file in it. Now I also want leaflet for sourcing(co-ordinates) to my PHP file. So I need ...
4
votes
0answers
727 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 ...
4
votes
0answers
250 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 ...
3
votes
1answer
154 views

Add Line Layer from PostGIS to Leaflet

I have a line layer in PostGIS that I would like to add to a Leaflet map. I have the PHP setup, but I can't seem to get the Javascript correct. I know my issue is converting the line to geoJSON. The ...
3
votes
0answers
59 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. ...
3
votes
0answers
127 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 ...
3
votes
1answer
406 views

Changing Leaflet Projection?

I am new to leaflet. I am trying to change Leaflet project to EPSG:32624 but it is not working. The map is not showing neither the marker. var crs = new L.Proj.CRS('EPSG:32634', '+proj=utm +...
3
votes
0answers
301 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"; }; ...
3
votes
0answers
638 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 ...
3
votes
1answer
329 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....
3
votes
1answer
440 views

How to get the number of clusters and its markers with Leaflet?

I would like to know the number of clusters and its markers as soon as I open the map without zoom-in. I'm using: Leaflet 1.2.0 Leaflet.MarkerCluster 1.2.0 Firefox 57.0.1 OS/Platform On the image ...
3
votes
0answers
424 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 ...
3
votes
0answers
144 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 ...
3
votes
0answers
248 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 ...
3
votes
0answers
715 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, ...
3
votes
0answers
124 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', '+...
3
votes
0answers
631 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....
3
votes
0answers
2k views

How to use GeoJSON from Geoserver in Leaflet?

Is it possible to consume the GeoJSON from Geoserver as a 'dynamic' service in a Leaflet application? So far I have only seen how to consume a static GeoJSON file. Being able to construct GeoJSON ...
3
votes
0answers
607 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 ...
3
votes
0answers
118 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 ...
3
votes
0answers
144 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 ...
3
votes
0answers
1k 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 ...
3
votes
0answers
567 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 ...
3
votes
0answers
2k views

Leaflet filter on geoJson properties : multiple criteria

I'm using Leaflet filter on geoJson data. I'm able to apply it with a simple criteria : filter: function(feature, layer) { return feature.properties.field1 == "yes"; } I can also apply two ...
3
votes
0answers
573 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 ...
3
votes
0answers
1k views

Display GeoJSON data on map using django-leaflet?

I want to display GeoJSON data on map in geodjango. When I use the below code only GeoJSON data like: { "type": "FeatureCollection", "features": [{ "type": "Feature", "properties"...
3
votes
0answers
718 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?
3
votes
0answers
626 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) { ...
3
votes
0answers
735 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/...
3
votes
1answer
404 views

Receiving data from php script for geoJSON TileLayer?

I want to get geo data as geojson for geojson tile layer requests in leaflet. I set up a geojson layer like this: https://github.com/glenrobertson/leaflet-tilelayer-geojson/ A php script answers ...
3
votes
0answers
2k 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 ...
3
votes
0answers
697 views

Raster Over Layer in Leaflet from GeoServer

I want to add a raster over layer onto the base layer and the raster layer is published by a Geoserver WMS. I set the raster layer's geographic coordinate system as the same as the cloudmate tiles. ...
3
votes
0answers
449 views

How do I format tilelayer.wms url properties such that I add an overlay iteratively to my base map in leaflet

My base map was created using hard-coded template variables. I am using the leaflet tilelayer.wms constructor and including the url like so: url: "http://localhost:8080/geoserver/sf/wmsservice=WMS&...
3
votes
0answers
3k views

How to serve OpenStreetMap Tiles locally using ArcGIS Server 10?

We want to serve OpenStreetMap Tiles locally using ArcGis Server 10 to use as base maps in our ESRI Silverlight and Flex GIS clients. We've downloaded our regions OSM file and created PNGs using ...
3
votes
0answers
678 views

How do I pass a LatLng Bounds from Leaflet to Mapfish Print?

I successfully fired up a MapFish print server on Elastic Beanstalk, and it prints out the sample spec files fine, but I'm trying to pass bounds from my Leaflet frontend now, and encountering a lot of ...
3
votes
0answers
2k views

Overlaying a mbtiles tile layer produced with tilemill over another layer maintaining transperency

So using leaflet, I'm overlaying my base tile layer as google satellite imagery. I want to overlay another layer (Mbtiles layer) produced with tilemill over this satellite layer. I was successful in ...
2
votes
0answers
33 views

How to force caching of image layers in Leaftlet?

I'm working on a weather map project with Leaflet. I have several weather parameters as PNG overlays. For each parameter there's 60 PNG files, representing different points in time. I have implemented ...
2
votes
0answers
77 views

Plotting KML data on Leaflet map

I have 5 different KML files for each subzone of Singapore map. I want to plot the KML data by subzone on a Leaflet map. library(leaflet) library(raster) library(readxl) library(rgdal) setwd("F:\\...
2
votes
1answer
66 views

Leaflet info box only showing properties from selected layer

I would like to use the info box as shown in the tutorial interactive choropleth map with multiple layers and properties from different layers. The idea is to only show the properties from the ...
2
votes
0answers
69 views

Use leaflet-draw-toolbar with angular 2

Is it possible to use leaflet-draw-toolbar with angular 2 and ngx-leaflet-draw? I do not see, and I am not versed in Angular 2, enough, to incorporate the JS library for leaflet-draw-toolbar into my ...
2
votes
1answer
154 views

Different icon of the nearest marker to current location in Leaflet

I'm working with Leaflet and JavaScript for the first time, so I feel a bit lost here. I have an app that displays user's location and a couple of points of interest from a GeoJSON on a map. The ...
2
votes
1answer
119 views

Hiding leaflet tooltip on mobile device?

I would only display a tooltip on a device without a touchscreen. A popup and a tooltip will be displayed on your mobile by clicking on the point. I would like to see only popup var ubytovaci = L....
2
votes
0answers
512 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....
2
votes
0answers
47 views

Leaflet layerGroup in ListMarkers

I am using the Leaflet List Markers Plugin for showing all features currently visible in the map in a list. Adding a single L.geoJson layer is no problem and works fine. Now I am using multiple ...
2
votes
0answers
89 views

GeoJSON - Obtain linestrings inside a given bounding box

I have two layers in an Argentinian railroad-related project: one is for train stations and the other is for railroad lines. The first one has about 1100 points and the second, about 250 finely-...
2
votes
0answers
252 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, ...
2
votes
0answers
90 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 ...