Questions tagged [leaflet]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
39 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 ...
0
votes
1answer
64 views

GeoJSON search box for multiple layers

I am wondering how to make the GeoJSON search more efficient. I would like to get the search result from more than 1 layer in GeoJSON. My code is (I attached one of two GeoJSON examples): var test = ...
3
votes
1answer
61 views

Zoom marker text when zooming map

I am trying to have multiple labels on a non-geographic map (image), but when I zoom in and out, I would like the text to grow and shrink in size corresponding to the zooming. Here is what I have: ...
1
vote
1answer
55 views

Load polygon JSON to Leaflet

I want my JSON data with URL can load on the map, and it is a polygon data. I don't know what the problem with my code. This is my code: <html lang="en-US" xmlns="http://www.w3.org/1999/xhtml">...
9
votes
2answers
11k views

How to change layer order in leaflet.js

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 ...
2
votes
2answers
626 views

Layering WMS or ArcGIS Rest on MapBox IOS SDK

We have some customer's who have facility data they are publishing through their own WMS or ArcGIS/REST services. We're exploring the idea of building an IOS app that can display their facilities ...
0
votes
1answer
385 views

Edit a shapefile with Leaflet.pm

I am new to Leaflet but so far so good. I managed to add the plugins I needed and they work. Except the shapefile editing. I am using leaflet.pm to draw, snap, cut polygons (only polygons). I also ...
1
vote
0answers
36 views

Adding WMS legend to see or remove layers in relation to the layer control? [closed]

This is the code, the problem is that always print the same png legend even if you select another layer. function addLeyenda(layer){ if( layer instanceof L.TileLayer.WMS ){ ...
1
vote
1answer
689 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 ...
1
vote
1answer
30 views

Polyline is not pointing to correct langitude.latitude data in Leaflet [duplicate]

I am trying to add polyline in my existing leaflet map. But unfortunately its not overlapping the correct coordinates. this.testd = [ [26.946345158021394, 45.30658810117468], [31....
0
votes
1answer
50 views

Loading GeoJSON file into map in Leaflet

I put my GeoJSON file on my desktop, I don't know why my file can't load to the map. My code: <html lang="en-US" xmlns="http://www.w3.org/1999/xhtml"> <head profile="http://gmpg.org/xfn/...
0
votes
2answers
33 views

Leaflet GeoJSON popup marker customization

I would like to customize leaflet .bindPoPup geoJSON marker. I found some solutions, although I would like to use my existing one. Basically the operation leads to merge two functions as per below: ...
1
vote
1answer
61 views

Use self-defined Leaflet identifiers to work with jsTree checkboxes

I have some hierachic structured point-layers in a GeoJSON file using jsTree (ajax) with checkboxes to add them to the map. As I have about 20.000 points structured in 2.000 nodes representing the ...
6
votes
2answers
5k 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 ...
1
vote
2answers
38 views

Leaflet GEOJson marker pins are not a Layer?

I currently have the following code which is used to display a series of GEOJson marker pins on a LeafletJS 1.5.1 map and it also displays a KML layer which can be toggled on and off using a checkbox. ...
1
vote
1answer
89 views

Cutting holes in custom polygon made with Leaflet.Draw

I would like to be able to create holes in polygons made with Leaflet.Draw plugin. For example, I currently have code like this: https://jsfiddle.net/4gkrfu5b/ If you draw a polygon on top of another ...
2
votes
1answer
155 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....
7
votes
1answer
8k views

Multiple instance of leaflet on page?

I have a series of tabs running down the left hand of my page and on each page I have a leaflet map. Each map is based on the choropleth example but I'm running into problems. Only one of the three ...
2
votes
0answers
52 views

Cutting off polygons outside of border in Leaflet?

I have an application where I create polygons based on values I calculate from points on a map. The polygons are then overlayed on top of a city using a single leaflet FeatureGroup. Another one is ...
1
vote
0answers
53 views

Search for bookmarks with realtime-leaflet

I'm using Leaflet with realtime-leaflet to show real-time bookmarks, but I need to add the search control on the bookmarks that are real time, I'm using an AJAX request and I doubled the bookmarks on ...
0
votes
0answers
30 views

Adding load file feature into web application with Leaflet

I'm creating a web application with Leaflet and add file load feature like the image below. However, it didn't work and didn't show the icon either. <!DOCTYPE html> <html lang="en"&...
0
votes
1answer
175 views

Calculating gained elevation on GeoJSON

I need to calculate gained elevation on Multilines GeoJSON files in a Leaflet.js map. Is there is any plug-in to do that? My GeoJSON files contains Z/elevation data in geometry.
0
votes
1answer
45 views

Leaflet.Draw save coordinates

I'd like to save the polyline coordinates. I'm creating it with Leaflet.Draw. The problem is that the coordinates are stored twice. 49.907018,16.324997,49.907018,16.324997,49.818936,16.340103,49....
1
vote
2answers
112 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"&...
0
votes
2answers
93 views

Getting Leaflet map to work offline?

I am interested in how to create a base map for Leaflet offline with XAMPP. Is this just a picture of what you draw from the Internet and then specifies the path with L.tileLayer? I'm still a bit ...
0
votes
1answer
260 views

Getting width of road segment given its end points using Leaflet?

I want to highlight a road segment on a Leaflet Map. I have the coordinates of the end point of the road segment, so could plot it as a linestring. But the problem is how can I get the width of the ...
0
votes
0answers
94 views

Calculate volume of a polygon using leaflet

I have a polygon and a Digital terrain model, I need to find a way to calculate the 3d volume of the area inside the polygon on leaflet. Is it possible to achieve it using some sort of formula or do I ...
3
votes
3answers
3k views

Prevent Leaflet from requesting non-existing custom tiles

I have created custom tiles using TileMill. extracted tiles as png images and adding them on base layer. using following code var venu_map = new L.tileLayer('static/b18/{z}/{x}/{y}.png', { ...
0
votes
1answer
175 views

Select a feature by property

I have a GeoJSON layer with continents info (got it from here), and I want to select a feature(continent) based on its name value or "CONTINENT" in this case. I did some research and ended up with ...
0
votes
3answers
977 views

Filtering interactive leaflet-map with dropdown-menu?

I try to set up a filterable "shot chart" like http://graphics.latimes.com/kobe-every-shot-ever/ with leaflet. I've a geojson file thats stores all the shots data, I've them showing up in a layer. ...
0
votes
0answers
38 views

Why GeoJSON is gotten by Leaflet, but does not display?

I WFS request from Leaflet to GeoServer is successful (200). But no features have been displayed. Response of request is big GeoJSON with features. What is the problem and what is wrong with my code (...
-1
votes
1answer
2k views

Changing map styling in mapbox using mapbox.js?

I am using mapbox.js for this. i am working on the project which requires to change the styling of map, eg: area,land and water colors on click of certain button. one possible way is, i use ...
3
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 ...
1
vote
2answers
2k views

CQL filter not displaying in leaflet.js

I have a CQL filter that only displays a certain number of points, however when I try to apply the CQL to my existing leaflet map through the options for a layer nothing displays. No errors are thrown ...
0
votes
1answer
270 views

React-Leaflet: Marker has wrong position after zoom out

When I show a marker in the center of the map it is OK. But when I zoom out, the marker is like staying at the same place. Finally its position is very wrong. Why is it not moving together with the ...
0
votes
0answers
69 views

GeoJSON from react-leaflet doesn't render the layer over the map [duplicate]

I have a GeoServer running on my localhost also I have a react app which consumes a WFS service to get a GeoJSON data to render as a layer over the map. These are my dependencies on my package.json "...
2
votes
2answers
1k views

Display GeoJSON on Leaflet web map with GeoDjango

I have to display my geometry data in my Leaflet based web map and I use GeoDjango to display it, I have loaded GeoJSON data and front map but I can't put my geometry data on my web map. How can we ...
2
votes
1answer
21 views

Summarize Leaflet controlLayers

I cobbled together a code where I can print the features as a popup and wanted to make the objects on and off var baseMaps = { "Wikimedia-Map": Wikimedia, "GrayCanvas-Map": Esri_WorldGrayCanvas, ...
5
votes
1answer
643 views

Is it possible to hatch format railroads in leaflet?

Within mapbox tilemill it is possible to make make rail-roads like this: (source: mapbox.com) To achieve this you need to write the following code: Source #railroads { ::line, ::hatch { line-...
2
votes
2answers
73 views

Leaflet Basemap: Changing sources of basemap options in runtime?

I'm using Leaflet v 1.4.0. In LL, using L.control.layer, the basemap (and overlay) is assigned as follows: $.fn.initBaseMaps = function (selectedIndexProjectionOption) { lyrNASAGIBSBlueMarble = L....
1
vote
2answers
65 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"&...
3
votes
1answer
243 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
80 views

Import more than one GeoJSON into Leaflet map?

I've searched far and wide and tried a number of different options but I cannot get more than one GeoJSON into my Leaflet web app. I can get one, and once I try anything else, the map itself will go ...
10
votes
4answers
33k views

Dynamically set zoom level based on a bounding box

I have a leaflet map whose size depends on the size of the browser window. I would like the zoom level to be dynamically chosen so that it is as zoomed in as possible while showing the entirety of the ...
1
vote
1answer
45 views

L.esri.Cluster.featureLayer does not call style function

Using the L.esri.Cluster.featureLayer plugin for Leaflet to cluster features from Esri does not call the style method despite the documentation stating that this is the way to style vector layers. ...
0
votes
0answers
39 views

Cannot read property 'decode' of undefined in lrm-google

I am following this doc Lrm-google to use google direction api with leaflet routing machine. I haven't changed much of my code except replacing geocoder: L.Control.Geocoder.nominatim(), with router: L....
1
vote
1answer
102 views

With leaflet-routing-machine, how to bring a route on top?

On a simple Leaflet map, with leafleat-routing-machine, if two routes pass by the same place, only the top one is visible. I can live with this if I can choose which route is on top, (for example by ...
2
votes
1answer
327 views

How to change the CRS for a Leaflet map at runtime?

I have different layers with different CRS requirements. Since you cannot set CRS per-layer, but only per-map, I need to change the CRS for my map at runtime, depending on which layer is selected. How ...
0
votes
2answers
879 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
87 views

Overlaying satellite image tileLayer over OpenStreetMap in LeafletJS?

I am currently creating a web app for visualizing disaster impact via satellite imagery. I have satellite images (.tif) which I need to overlay over OpenStreetMap. Since .tif file is very large, I ...