Questions tagged [leaflet]

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

Filter by
Sorted by
Tagged with
8
votes
5answers
11k views

How to get a Leaflet app with a big GeoJSON file to work on mobile devices?

I have a leaflet app which displays a GeoJSON file as a layer. It works fine in the web browser. On the mobile browser it starts up, but quits after panning around on the map. I think the reason for ...
2
votes
2answers
5k views

Leaflet MarkerCluster custom info window instead of spiderfy effect

So I have been experimenting with the Leaflet Marker Cluster and was wondering if there is a way to disable the spiderfy animation and change the event when cluster is clicked on? Instead the clicking ...
2
votes
1answer
6k views

Addig title to marker or shape using Leaflet Draw? [closed]

I am trying to create a participatory mapping site where users can draw pts, lines and polys using Leaflet draw. Is it possible to create a pop window where users can add a title or description of ...
1
vote
1answer
3k views

resize divIcons (svgs) at zoom levels - Leaflet

I am adding a geoJSON to a map using a custom divIcon (from svg) for point markers with Leaflet. The divIcon needs to resize on different zoom levels. Currently I can see the icons and the popup ...
10
votes
1answer
5k views

Calculating Optimal Geohash Precision from Bounding Box

I'm using Elasticsearch's GeoHash grid Aggregation to plot clusters on a map (using Leaflet). I understand that for larger areas a lower precision setting should be used to limit the number of buckets ...
7
votes
2answers
2k views

Leaflet: 4 overlay layers, 1 click, get properties of all intersecting polygons.

I have a leaflet application where I have 4 layers that have many intersecting polygons such as, a counties layer, a school districts layer, a cities layer, and a layer of miscellaneous areas. All ...
6
votes
2answers
4k 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". ...
5
votes
1answer
13k views

How to remove features from a Leaflet GeoJSON layer?

In a Leaflet map, it is possible to add features to a GeoJSON layer using the addData method: L.geoJSON: Creates a GeoJSON layer. Optionally accepts an object in GeoJSON format (you can ...
4
votes
2answers
10k views

Defining which layer (overlay) is displayed on Leaflet map?

I have 7 layers overlay on a base map, i need to define which layer is selected (active,displayed,shown) on the map. var overlays = { "AL HOUDA Espaces_Verts": alhouda6_layer, "...
3
votes
1answer
9k views

Is it possible to cluster polygons in Leaflet?

Is it possible to cluster polygons in Leaflet? In a similar way to the Marker Cluster plugin
3
votes
2answers
5k views

Splitting A polygon into multiple polygon by multiple line strings in Leaflet and turf.js

I have need to split a polygon into multiple polygons based on the line strings drawn on the polygon. I have come across another post that splits a polygon into two based one line string. If a new ...
2
votes
3answers
15k views

How to export to all points within Leaflet polygon?

Is it possible to export all points within a polygon drawn using Leaflet? (http://leaflet.github.io/Leaflet.draw/).
13
votes
5answers
25k views

Changing layer order in Leaflet

I would like to be able to change the order of the layers in Leaflet. I tried implementing two Leaflet plugins in order to change the layer order. First I tried leaflet-control-orderlayers, which ...
11
votes
1answer
11k views

Making leaflet control open by default

I'm using leaflet to display a map. I have a control section that I'd like to be open by default, but I can't find a way to do it through the API. Is there a way to do this?
6
votes
1answer
4k views

Get bounding box of WMS

Is it possible to request the bounding box of a WMS from GeoServer? In my case I have a WMS that I show with L.TileLayer.WMS in a Leaflet map. I like to center and zoom my map to the WMS.
5
votes
6answers
10k views

Ipyleaflet map object doesn't display in Jupyter Notebook but it gets created

When running the code from the example (https://ipyleaflet.readthedocs.io/en/latest/api_reference/map.html#example), no map get displayed. from ipyleaflet import Map, basemaps, basemap_to_tiles m = ...
4
votes
1answer
2k views

How to turn off geojson layers in Leaflet when the site starts?

I have a problem with my geojson layers. When I lunch my site they are all switched on, but I don't want to. Is there any solution to have lunched only one layer when my site starts, not the all one? ...
3
votes
1answer
7k views

Leaflet : filter with condition

I want to insert a condition in a geojson filter. This condition is based in a variable called here varState: <button id='button1'>button1</button> <button id='button2'>button2</...
2
votes
1answer
5k views

Load external geojson file into leaflet map

Have studied How to load external GeoJSON file into Leaflet map but not getting desired result. My index.html looks like this: <!DOCTYPE html> <html> <head> <meta charset=...
1
vote
1answer
6k views

Convert GeoJSON with multiple Polygons and MultiPolygons into single MultiPolygon?

Is this even possible? I have a GeoJSON file with multiple polygons and multipolygons, and I need to set styling on them (in Leaflet.js). I'd like to create a single, large MultiPolygon from the ...
1
vote
2answers
5k views

L.Control.Search: Using looping for searching data on Leaflet

Is there a way to find data from different layers and different propertyNames? I have several GeoJSON data files, with different properties. At this moment I can only search one GeoJSON. For looping ...
1
vote
1answer
2k views

Leaflet Customer Marker Changes Position with Scale

I am using a customer marker to represent metro stops in my leaflet map. The problem is that the markers are changing their position every time I zoom in or out. When I finally zoom in to the last ...
5
votes
2answers
23k views

Show text inside polygon on Leaflet map

When I try to label the polygon on my Leaflet map I always get the error: t is undefined I am trying to do it as shown below: <html> <head> <title>Page Title</title> ...
5
votes
1answer
10k 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 ...
4
votes
2answers
3k views

Leaflet Sidebar - set content depending on clicked GeoJSON feature

My goal is to set the content of the sidebar depending on what GeoJSON feature was clicked on. For example when clicked on polygon A the content of the sidebar is: "This is A" and when clicked on ...
3
votes
2answers
3k views

Using JSONP with Leaflet and GetFeatureInfo request

Is it possible to use JSONP with the GetFeatureInfo request? I'm using a GetFeatureInfo function in Leaflet that works fine with JSON data but I'm really struggling to replicate this with JSONP and ...
3
votes
2answers
711 views

Adding GeoJSON properties when creating marker in Leaflet

I used a manual marker input development under Leaflet found on this website : http://www.gistechsolutions.com/leaflet/DEMO/basic/addmarker.html I have added two properties to the markers: name and ...
3
votes
1answer
2k views

Load GeoJSON polygon time series with Leaflet Time Dimension plug-in?

I have a GeoJSON file with time series data, representing repeating polygons with varying data. I have managed to display the data for one time interval (a subset of the data representing one interval)...
3
votes
1answer
268 views

leaflet GeoJSON value not variable name

I have a GeoJSON file that has fields of the days of the week like "Monday" with values 'Y' or 'N'. So I want to get today's day value, using something like var theDayValue = 'feature.properties + ...
2
votes
1answer
5k views

Geoserver popups in Leaflet

I've got a simple Leaflet map with a basemap and one map-layer coming from my own hosted GeoServer. I made the layers show up nicely in a map. Now I want to add popups on the point layer showing ...
2
votes
2answers
3k views

Viewing map tiles from Maperitive in leaflet or openlayers

I generated tiles in Maperative. Created following html file: <html> <head> <meta charset="utf-8" /> <link rel="stylesheet" href="leaflet/leaflet.css" /> ...
2
votes
1answer
4k views

Unable to use fillColor values from GeoJSON with Leaflet

I have a web page which fetches some remote GeoJSON and displays a combination of marker points, polygons and lines on my map. Within that JSON is the fillColor, fillOpacity, etc that I wish to use ...
2
votes
1answer
650 views

Why my markers move when I resize my map on Leaflet?

I have already get an eye on Google and seen that the solution should be the iconAnchor property. I have set it to the same values that my iconSize. But it fails. When I resize my map the icon ...
2
votes
2answers
2k views

Styling polygons in a map tile PBF file in Leaflet

How can I dynamically add data to a pbf file generated by Maptiler? I created a pbf file with the MapTiler desktop application. I started with a geojson file containing polygon geometries. My file is ...
2
votes
1answer
112 views

BetterWMS script doesn't work with QGIS Server and MapServer WMSs

I have a HTML/Leaflet page utilising BetterWMS script below. The script returns GetFeatureInfo over WMS layer. Unfortunately it is not working with WMSs published by Qgis Server and MapServer, ...
1
vote
1answer
484 views

Highlighting feature by Id with Leaflet

I cannot work out the solution given in Leaflet highlight feature by ID. I have the script below which adds a layer "commercial" and a layer "sector". What I want is that when I ...
1
vote
2answers
531 views

Why the icon can't display with my JSON data on Leaflet

I tried many time, but the icon didn't show on the map. I want to know what the problem on my code. This is my code: <!DOCTYPE html> <html lang="en-US" xmlns="http://www.w3.org/1999/xhtml"&...
1
vote
2answers
1k views

Add popup with GeoJSON data

I want to display popup with the data item, such as: name, coordinates, stationID, Attribute. But my code has some problem that can't run. <html lang="en-US" xmlns="http://www.w3.org/1999/xhtml"&...
1
vote
1answer
842 views

Leaflet Search for GeoJSON creating duplicate, non-functional buttons

I added a plugin for searching a GeoJSON file in leaflet, but now there are multiple search buttons and they do not recognize any input. I suspect that it is initializing for every single instance of ...
1
vote
1answer
940 views

Activating Search Plugin with JS Leaflet

I am attempting to add the following plugin to search a GeoJSON file I have open in Leaflet Javascript: http://labs.easyblog.it/maps/leaflet-search/examples/geojson-layer.html I have brought in the ...
1
vote
1answer
3k views

Transform an image with projection EPSG:4326 to EPSG:3857

I have an image with known boundary and projection EPSG:4326 and want to overlay it to openstreetmap using Leaflet.js. I have tried using function imageoverlay, but the image is not aligned with the ...
1
vote
2answers
3k views

Adding one search box for multiple GeoJSON polygon layers?

Multiple GeoJSON markers can be combined to one group layer then search on a specific attribute but doesn't work for GeoJSON polygons. How to put multiple GeoJSON markers and polygons in one search ...
1
vote
0answers
71 views

Query a region within a larger region with GeoDjango REST API

I have a working Django REST API which can query all the counties in a country. //My model class kenya_counties(models.Model): objectid = models.BigIntegerField() id_field = models.BigIntegerField(...
1
vote
1answer
1k views

Leaflet layer control and legend

I have a layer control with 8 layers in it. I also have a legend control in lower right. A few layers have the legend tall. Now my issue is on smaller monitors the legend control is on top of the ...
1
vote
1answer
4k views

Open the popups of all markers that are visible on the map with a zoom > 10

I need to open all the markers that are visible on the map at Zoom > 10. I am using leaflet.markercluster plugin. Init map: initMap() { this.map = L.map('map', { center: [55.55, 37.61], ...
1
vote
1answer
4k views

Leaflet+GeoJSON: Why are lat-lng coordinates in the wrong order?

I'm coding an app with Phonegap, which requests user's current position. As an overlay I have loaded a geojson layer. I want the app to automatically extract a value of said layer at the exact ...
0
votes
1answer
370 views

Displaying different tracks from one GPX XML file in different colors in Leaflet

I use Leaflet to display tracks described in XML file on OpenStreetMap background. Some of my XML files contains several tracks, example Multi tracks. Is it possible to display each track with a ...
0
votes
1answer
2k views

How to make a WMS GetFeatureInfo request in Leaflet?

I am trying to make a WMS GetFeatureInfo request using Leaflet. I can not find something in the documentation to describe this process. Can you please provide with an example demostraing how to do ...
0
votes
1answer
185 views

Tooltip for polygon disappears when hovering over a marker placed on top of that polygon in Leaflet

This seems like it should be a common enough problem but somehow I cannot find the solution anywhere. I have a layer full of polygons (polygons representing districts of a city), and a layer full of ...
0
votes
1answer
370 views

Exporting label rendering options based on zoom level correctly in QGIS

I am making a webmap using QGIS3. However, I set the text-label to be invisible from a certain zoom-level onward, and visible from another zoom-level. It displays correctly locally in QGIS edit screen ...

1
2
3 4 5
8