Questions tagged [leaflet]

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

Filter by
Sorted by
Tagged with
6
votes
3answers
14k views

Leaflet: Resize markers in layer when zoom in

May I ask how to resize markers in layer when zoom in? var map = L.map('map', { center: [23.364739, 115.187951], zoom: 11, minZoom: 11, maxZoom: 18, }); var ar_icon = L.Icon....
0
votes
0answers
13 views

Big polyline with Leaflet

I'm using Leaflet for a project where I track the path of an entity along the map in realtime. I made a buffer with the last 1000 points but it is visible only through a big zooming cause the points ...
2
votes
0answers
11 views

Adding polygons to Leaflet inset map in R

I've created a map using the Leaflet package in R and added an inset locator map using addMiniMap(). I would like to add polygons features to said inset map. I've already added the polygons to the ...
0
votes
0answers
15 views

Setting GeoJSON style based on property value in Leaflet?

Knowing the thing with leaflet chloropleth: Styling individual features in a GeoJSON layer https://leafletjs.com/examples/choropleth/ we can distinguish the range of values by colour. I would like ...
0
votes
1answer
27 views

Leaflet distinguishing sublayers within one GeoJSON layer

I would like to have more than one layer within one existing GeoJSON layer. I found some example here: http://www.gistechsolutions.com/leaflet/DEMO/sports/sports.html which refers to one .json file ...
1
vote
1answer
29 views

While dragging a map in Leaflet it marks a point for the feature [on hold]

In my Leaflet application, When I draw a feature (Line/Polygon) and if I need to drag the base map to mark a point outside the visibility of the map then Leaflet marks additional point where I tap on ...
1
vote
2answers
1k views

Using Google Maps static tiles with Leaflet?

I am trying to use tiles generated with the Google static API with Leaflet and I am facing issues because the generated tile seems to be displayed "off-centred". My original question has been posted ...
0
votes
0answers
23 views

Fixing QGIS generated SLD to avoid repeating polygon labelling [duplicate]

I have generated SLD's in QGIS that I use in GeoServer. Although the labeling shows fine when previewing the layer in GeoServer, when bringing the WMS in Leaflet then labeling repetition occurs. How ...
1
vote
0answers
28 views

Display only markers which are near user's current location in Leaflet? [on hold]

I am using Leaflet js to detect current user location from the browser. I have bunch of markers being displayed in a given area. I would like to show only markers that are closest to the user's ...
0
votes
1answer
37 views

Displaying selected layers depending on zoom in Leaflet

It looks like I found the problem between the document.querySelector and map.on('zoomend') function. I was going to set the zoom level for switching off some layers, what has been raised here: ...
0
votes
0answers
21 views

Leaflet Map is not loaded correctly

In my application I need coordinates. I would like to make it possible for a user to choose the coordinates using a map and a marker or to calculate them via an address. That works fine too. But ...
1
vote
1answer
18 views

Mouseover highlight label in Leaflet

I would like to see the geoJSON placemark label once hover it. I found a few examples, but they refer mostly to providing a pop-up only: Showing popup on mouse-over, not on click using Leaflet? ...
2
votes
0answers
28 views

How to extract GeoJSON database column as geometry layer? (column as layer)

Have a one table of country with multiple categories for states. Table as below: Country table:(converted shapefile to GeoJSON for use in Leaflet choropleth map) So kind of table converted from ...
1
vote
1answer
25 views

Leaflet only one placemark visible at exact location, whereas is more than 1 there

I have a problem, because sometimes on my GeoJSON layer plotted into the Leaflet map more than 1 placemarks has been assigned to one exact location (by postcode). The problem is, that only one of ...
0
votes
0answers
8 views

Leaflet NA values at boundaries R

I am using leaflet to visualize rasters. The output shows NA values around the border areas for discrete classifications. I read another post that said this might be due to the differences in ...
1
vote
1answer
25 views

R leaflet creates geometric striations in some maps but not others

I have been creating leaflet maps from raster files with discrete values. Leaflet creates smooth maps form some of the rasters, but in other there is a strange pattern of geometric striations across ...
2
votes
1answer
28 views

SAS Planet cached tiles for use in Leaflet map

I downloaded some tiles from ArcGIS.Imagery with SAS Planet The tiles is in folders like ArcGIS.Imagery/z2/0/x1/0/y2.jpg ArcGIS.Imagery/z13/2/x2624/1/y1750.jpg And I use this TileLayer to display ...
11
votes
2answers
27k views

Leaflet: How to move the layer-control menu?

This might be a silly question, but I could not find a documented way to achieve this. I'd like to freely position the layer-control menu, probably to the top left near the default zoom-in/out button....
0
votes
0answers
33 views

Loading JSON/GeoJSON multipolygon data from the external domain onto Leaflet map

I'm making my own map for the personal use only and at the moment my code looks like this <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=...
1
vote
0answers
16 views

Leaflet plot map.on(zoomend) function into addEventListener(function)

Continuing the previous query: Leaflet set zoom for clickable layers on the map I would like to fix my zoom feature, which doesn't work correctly as per in the picture below: for this purpose I ...
1
vote
2answers
52 views

Dynamic map sidebar with info from marker upon click

I am new to Leaflet, HTML, CSS and Java. I am using leaflets maps and I want to create a sidebar that is active when a marker is clicked or active when a clicked in the sidebar, so far I have had no ...
0
votes
2answers
72 views

Add more than one layer of GeoJSON data to Leaflet?

This is my code for loading one layer of .geojson data to Leaflet. The data is basically in the form of markers and it's demonstrating different location in Saudi Arabia. It's saved as "saudi_location....
1
vote
0answers
23 views

Attempted to load an infinite number of tiles while using proj4leaflet and EPSG:32614 [closed]

I get error "Attempted to load an infinite number of tiles" while using proj4leaflet and EPSG:32614. crs = new L.Proj.CRS('EPSG:32614', '+proj=utm +zone=14N +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +...
0
votes
1answer
19 views

Mousehover placemark in Leaflet

Good afternoon, I am trying to make my geoJSON placemark hovered in leaflet. Basically the pop up exist and I don't want to change it. What I would achieve is only change it color, when hovered by ...
0
votes
1answer
59 views

List of overlapping WMS layers [closed]

How do I get a list of layers by clicking on overlapping WMS layers in the Leaflet map? The best solution is to have the list in a single popup on the map. <!DOCTYPE html> <html> <...
2
votes
2answers
35 views

Converting GeoJSON to projected coordinates in Leaflet?

We are migrating existing angular app from OL to Leaflet. In OL we were able to get the geoJSON in UTM with EPSG:3857 on draw finish However when we complete a draw in leaflet and try to get the ...
0
votes
1answer
51 views

How to add ONE dynamic legend for 16 WMS layers in Leaflet from GeoServer [closed]

Can anyone explain me how I can include one dynamic legend within a Leaflet map for 16 individual WMS layers? Is it possible to create ONE legend with the WMS service for multiple layers? My code to ...
0
votes
0answers
56 views

Get data from GeoJSON to create chart within pop-up

I'm working on getting a pie chart to display within a pop-up on a Leaflet map, visualizing the data from the GeoJSON within the pie chart. mygeojson.on('popupopen', function (e) { var data = {...
0
votes
2answers
1k views

Download tile layers for use offline

I would like to download tile layers in this form: {atlas_name}/{z}/{x}/{y}.png Because I want to use them offline with my leaflet map. However, I can't find what are the approaches to download ...
1
vote
1answer
25 views

Update map tiles in Leaflet only when map panning ends? [closed]

Currently when the map is dragged a few hundred API requests are sent due to many layers. I would like the requests to only be sent when the map comes to a stop. How can I achieve this?
5
votes
2answers
17k views

How to give color to polygon border in leaflet map

I am using geojson-vt for genreating polygon on leaflet map.polygon which is genreated is having some color...here i want to give different color to polygon border ...below is my geojson { "type": "...
1
vote
0answers
27 views

Leaflet Zoom on WMS-Layers - Error: Attempted to load an infinite number of tiles GridLayer.js [closed]

I use Leaflet 1.5.1 for showing WMS layers on a GeoServer 2.15.1. I can only zoom up to zoom level 14. If I continue to zoom into the map, I see the following error message. Error: Attempted to load ...
1
vote
0answers
22 views

TopoJSON coordinates are off with actual coordinate using Leaflet

I have this TopoJSON file that I have been working on quite sometime now. and recently I tried plotting it using Leaflet but the polygons are off with the actual area it surrounds. Here's the image. ...
1
vote
1answer
12 views

Changing values of Leaflet MiniMap after creation

I want to change the values of Leaflet MiniMap object after it is already created. e.g. miniMap.options.width: var miniMap = new L.Control.MiniMap( tileLayer01, { centerFixed: new L.LatLng(50.0, ...
1
vote
0answers
26 views

Adding markers to Leaflet MiniMap? [closed]

I am using Leaflet with the MiniMap plugin: https://github.com/Norkart/Leaflet-MiniMap Often, the zoom level difference between main map and mini map is so big that the bounding box shown in the ...
0
votes
2answers
34 views

Leaflet making features gone when zoom out

I am wondering about an option to make all or at least majority of placemarks (depends on their internal zoom settings) invisible when zooming out. It can be something alternative to the leaflet ...
1
vote
1answer
15 views

Invalid GeoJSON object, converted from ArcGIS JSON

I queried some ArcGIS JSON from "Global Forest Watch API", then converted it to GeoJSON using a web service. When I try to add it to my Leaflet map I get "Invalid geojson object". The GeoJSON looks ...
1
vote
2answers
41 views

Default Leaflet icon is not showing

I want to use default icon provided by leaflet instead of using something else. But unfortunately i am not seeing anything, not even error. var myIcon = L.icon({ iconUrl: 'my-icon.png', ...
1
vote
1answer
45 views

Speed up GeoJSON clustering and rendering?

I am rendering 10,000 points with Leaflet's markercluster library. I fetch these 10k points from our server. This takes about 700ms. It takes Leaflet about 3 seconds to cluster these points and ...
2
votes
0answers
36 views

Slope and Aspect calculations giving wildly different results based on zoom using Leaflet

I asked Accessing slope and aspect data using Leaflet? last week about getting slope and aspect as a function of lat and lng in leaflet, and I am in the process of trying to code out a good answer. ...
1
vote
0answers
40 views

Accessing slope and aspect data using Leaflet?

I am building an application in leaflet, and I need to be able to access slope and aspect as a function of latitude and longitude. Currently I am able to get elevation data from the mapbox elevation ...
0
votes
1answer
67 views

Overlapping two line problem

I want to check if 2 linestrings intersects (or overlaps) or no. I use turf.js overlap. Here are the results I want to get: CodePen 1- If only first or last points of line 1 intersects with first ...
1
vote
1answer
35 views

How to change background color of modified group layer control in Leaflet?

I've used jQuery append relocate a L.control.layers into an HTML containing. I've also modified them to look a little more like buttons. var crsh_group_buttons = L.control.layers(crash_grouping, ...
1
vote
2answers
47 views

Unable to remove WMS layer from Leaflet map

I am using Leaflet. In my application, I am adding layers from GeoServer, through checkboxes. The user selects a checkbox, the map is displayed. Can be seen in the image below. Now, when the ...
0
votes
1answer
247 views

Leaflet Routing Machine show option doesn't work

I am adding route to the map and I want to hide instruction (turn left, turn right etc.) but I want to show them later. As I can see there is parameter show for that. If I set show: false I see white ...
2
votes
1answer
54 views

Leaflet combination chloropleth and Leaflet.TimeDimension

Following up the post from Change the colors of polygons on a choropleth map with leaflet I'm wondering if it is possible to combine a Leaflet chloropleth with the Leaflet.TimeDimension so that the ...
0
votes
1answer
61 views

Can't close custom popup at fixed position

I created this custom popup at a fixed position. When clicking a marker a popup opens, I'm able to close the popup and open another one clicking a different marker, then I'm not able to close the ...
2
votes
2answers
400 views

Joining CSV to KML/GeoJSON in Leaflet webmap and showing joined data in popups?

I'm trying to create a Leaflet/Mapbox webmap with line layer (GeoJSON or KML) with some IDs and data coming from the .csv (after joining through this ID) file located on the same path as the index....
1
vote
1answer
3k views

how to customise toolbar in Leaflet.Draw plugin?

I downloaded the Draw.js and one ccs file to use the Leaflet.Draw plugin, but now I need to customise the toolbar (i.e want only polygon and marker).
0
votes
1answer
44 views

How do I adapt existing responsive web site to display Leaflet maps?

My website works well on different devices but it seems that only works with images, although I would like to show other media, like Leaflet maps and videos. Just about all pages are laid out on a ...