Questions tagged [leaflet]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
40 views

Search box for GeoJSON in Leaflet

I have been struggling with adding a search box for GeoJSON stuff, similar to COntrol.geocoder in Leaflet. I used the advice under this post: Adding one search box for multiple GeoJSON polygon layers?...
0
votes
2answers
144 views

Search control on Leaflet

I would like to have search control for Leaflet, with suggestions to street addresses, like on this image from Google Maps: Some of the plugins I tried (https://labs.easyblog.it/maps/leaflet-search/) ...
8
votes
1answer
2k views

Correct way to determine the type of Leaflet layer?

What is the correct (or recommended) approach to identifying a layer "type" in Leaflet/Javascript? I am able to successfully use layer instanceof, but that only works when you know the type at design ...
2
votes
1answer
190 views

Generate tiles from leaflet polygons

I have a set of shapes drawn in Leaflet (using Leaflet.draw). I need to rasterize these into a tileset and export it because I need to use the images elsewhere. My initial idea was to go through ...
1
vote
1answer
39 views

Appending data from Google spreadsheet into Leaflet LineString feature properties?

How would I add several properties into a set of leaflet LineStrings from google spreadsheet via Tabletop? I've created LineStrings from the google spreadsheet linked above and need to add the data ...
0
votes
0answers
25 views

Resize divIcon HTML on zoom in Leaflet [duplicate]

I am displaying zip code geometry on the map and also a marker with divIcon at the centroid of zip code. The divIcon with HTML looks like a label, for instance 23929. I would like to change the size ...
1
vote
2answers
36 views

Reading JSON features from a Google spreadsheet using Tabletop into Leaflet web map?

I'd like to read a table of JSON formatted cells into a Leaflet map using the Tabletop extension of leaflet. However, my script only reads the first object. Any advice on how to create an array of ...
0
votes
1answer
30 views

Leaflet: flyToBounds location of bounding box returned by PostGIS

I want to simply center my map on the search result of a polygon using leaflet. I thought to return the bounding box, as this is closer to what I actually need. I want to use flyTo() I see a ...
12
votes
3answers
15k views

Changing popup position on Leaflet marker?

I want open a popup on bottom of my marker icon in Leaflet. my code: var mymap = L.map('mapid').setView([51.505, -0.09], 13); L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?...
1
vote
1answer
36 views

Highlighting GeoJSON components based on common feature properties

I have a GeoJSON map. It's a map of a country, which is made up of states, which are in turn made up of sub-state regions. I can create a Leaflet map where I can highlight (in this case 'orange') the ...
2
votes
2answers
739 views

Leaflet polygon (multi polygon) to CQL equivelent

I am using leaflet with geoserver. I want to set up a CQL filter to do an intersect but having an issue with getting the geometry from leaflet polygon to cql polygon. For instance, the feature has ...
1
vote
0answers
26 views

Load KML to GeoJSON [closed]

I want to let Marker to other style. This is my code: <script> var url = 'leaflet/WGS84.kml'; doSomething(url); function doSomething(url) { var runlayer = omnivore.kml(...
0
votes
1answer
2k views

Unable to dynamically locate map boundary coordinates in OSM/Leaflet

I have been trying for the past hour to take the coordinates of the map edge in a OSM/leaflet application I am making. While I can get the coordinates of the center, and I can get the coordinates of ...
0
votes
1answer
49 views

Web Application using Leaflet

I'm trying to make a web application mainly with Leaflet. This is my code. I can download a file, but when you first open this web application, no layers are shown on the map. However, once I loaded ...
1
vote
1answer
416 views

Preventing map panning to last drawn marker using Leaflet?

I have a basic Leaflet map where I need to draw several markers and lines on. How do I prevent the map from panning to the last drawn object? I've read about setting autopan : False for popups from ...
1
vote
0answers
27 views

Leaflet catch window position

This is what I want to do: When loading the map, it will first grab the window coordinates of the current screen, and then load the data points of the current screen. The next screen is as ...
1
vote
0answers
22 views

Change maxZoom level on Leaflet Marker Cluster Group?

Our leaflet web app allows users to switch between tile layers. The tile layers sometimes have different max zoom implemented by the tile provider or local config. We have another layer with ...
0
votes
1answer
442 views

Use of leaflet to display raster layers in django

I'm using django to create a webserver that can gather user inputs, produce simulations and output the results with leaflet. So far I can produce simulations in Farsite using prepared inputs, however ...
1
vote
1answer
23 views

Leaflet side by side plugin is not working with imageOverlay

I'm trying to use the side by side plugin. I already check in the issues and change the getContainter() with getPane() in the .js file. this._divider.style.left = dividerX + 'px' this.fire('...
0
votes
0answers
28 views

Leaflet function to track point coords on map move

New to the forum. I also posted this question on Stackoverflow, not sure it is the same forum. I am trying to build a Vt of 360 degree panopictures with OSM map using Leaflet. I would need a ...
2
votes
2answers
731 views

Toggling Leaflet map on click?

I have created a Leaflet map on my web page and I would like to show/hide it when I click on a button. When I first load the page, I'd like the map to be hidden. HTML code: <div class="dropdown" ...
1
vote
0answers
18 views

Remove a Drawn Polyline from LeafLet Map

How can I simply just remove this polyline from the map? var pointA = L.latLng(From.lat, From.lng); var pointB = L.latLng(To.lat, To.lng); var pointList ...
1
vote
0answers
18 views

Get min/max of Lat and Long leaflet map getBounds [closed]

I have the bounding box of a map in leaflet with map.getBounds() which returns the NorthEast LatLng and SouthWest LatLng. How do I get the minimum and maximum of bothLat and Lng from this bounding box....
0
votes
1answer
179 views

Filter getInfo request

Following this example and according to Leaflet WMS documentation I extended L.WMS.Source class and overwrote hooks (e.g. showFeatureInfo). My example can be found here. When I use the code as ...
0
votes
3answers
1k views

Using Leaflet, PostGIS and pgRouting for web mapping? [closed]

I am new to Open Source GIS. I have already created a web mapping using custom tiles and leaflet. I have used my my own database. Tilemill was used to create the tiles and leaflet was used to ...
0
votes
1answer
32 views

Get L.marker individual attributes

I am using this code to draw points on the map: coordsArray.push(lat); coordsArray.push(lng); marker = L.marker(coordsArray, { icon: myIcon, clickable: true, draggable: 'false', title:...
0
votes
2answers
57 views

GeoServer layers not visible in layer switchers

I added both WFS and WMS layer from GeoServer. I need to have the layer switchers for these layers. But the layers are not visible in layer switchers. <!DOCTYPE html> <html> <head>...
1
vote
2answers
2k views

Using MiniMap addin in Leaflet?

I am trying to get a webmap working with leaflet.js. I found the beautiful addon of a MiniMap. But I do not get how it works. It works, if I only have one baselayer; MiniMaps shows up correctly. If I ...
2
votes
2answers
111 views

Open popup with click on tooltip in Leaflet

I'm trying to open a popup when clicking on a tooltip of a layer. I try following code: function add_layer_rescue_spot() { rescue_spot_layer = new L.GeoJSON.AJAX(rescue_spot_path, { ...
8
votes
1answer
3k views

Handling Popups in Leaflet with Overlapping Features?

I am new to Leaflet as well as Javascript. Currently, I am trying to create a spatial index of library holdings for old topographic maps that people can access and download online. The source of the ...
0
votes
1answer
3k views

Moving marker along path/polyline using Leaflet API?

Trying to migrate from Googlemaps to Leaflet, some errors return in following functions. Number.prototype.toRad = function() { return this * Math.PI / 180; } // Number.prototype.toDeg = function() {...
1
vote
1answer
564 views

Embedding static Google Earth Engine JavaScript in web page?

I have made a couple informational views in Google Earth Engine code editor and would like to put the resulting static map in a webpage. I am a novice at html, but have experience embedding mapbox ...
2
votes
1answer
316 views

Toggling data source in Chloropeth map with Leaflet

I'm starting with the Choropleth map example from Leaflet. (http://leafletjs.com/examples/choropleth/) I have a very large geoJSON file (all US counties), containing data points over time. To match ...
2
votes
2answers
61 views

Scaling tiles for missing zoom levels in Leaflet?

I have two sets of tiles. One for zoom level 10 and one for zoom level 14. However, I want to be able to see tiles on my map at zoom levels 9 through 15. For the nonexistent sets of tiles I want to ...
0
votes
1answer
27 views

Overlay with the feature collection properties

I have the GeoJSON: [{"type":"FeatureCollection", "features":[ {"type":"Feature","properties":{"id":27,"name":"F001"},"geometry":{"type":"LineString","coordinates":[[-100.231018,47....
0
votes
1answer
138 views

Leaflet layer tree plugin - overlays unvisible after base layer switch

having the same problem as Leaflet layer tree plugin - order layers, i installed the solution but that does not work for me: added zIndex:10 to the base layers code: "base", ...
-2
votes
1answer
29 views

Are Leaflet extensions plugins compatible with TomTom web SDK? [closed]

TomTom in their developer site says: Does this mean that Leaflet extensions and plugins are also compatible with their SDK?
1
vote
2answers
302 views

Overriding default popup anchor in Leaflet GeoJSON polygon?

By default popups open wherever you click within the boundaries of polygons in Leaflet geojson layers. Here's an example: JsFiddle I would like to anchor the popup either: so it opens in a specific ...
1
vote
1answer
341 views

Displaying animated GeoJSON path in Leaflet

I want to do something similar to this example: http://jsfiddle.net/3v7hd2vx/36/ But instead of creating a polyline between the two points, I want to display already digitalised routes all stored in ...
1
vote
1answer
46 views

Leaflet JS - open popup on button click

New to JavaScript, coming from Python background. Created a custom control and have added buttons inside the _div using a for loop and innerHTML. I want to zoom to and open the popup of a layer of ...
0
votes
0answers
21 views

Searching with Leaflet search control in layers added with Layers control?

How do I notify the search control about the layers that are added to the map? This is my web viewer: Actually, i can search only one layer, cannot search in the layers added from leaflet control ...
0
votes
2answers
107 views

Integrate JSON file inputs (specifically latlng) in Leaflet with JS

It's my first time using Leaflet and I wanted to simply put two markers based from my inputs. I managed to connect my JSON file with the JavaScript and the only problem I have is how to dynamically ...
0
votes
1answer
25 views

Connect GeoServer WMS data to Leaflet.js

I have WMS Layer in GeoServer, I've made it following the walk through tutorial in https://www.e-education.psu.edu/geog585/node/701 I'm confused on how to connect my WMS to leaflet.js.
1
vote
1answer
364 views

Leaflet search and popup at other position

In leaflet I want the popup on another position then the standard. So I created a div in which the popup-information is opens. countryLayer = L.geoJson(countryLayer, { onEachFeature: ...
0
votes
1answer
54 views

Handling popups with overlapping layers in Leaflet

I have two polygon layers (polygons) that overlap. I've created a leaflet map using qgis2web. The issues is that, if I click on the overlapping area, the popup only shows information for the topmost ...
1
vote
1answer
758 views

L.control.layers: Uncaught TypeError: Cannot read property 'minZoom' of undefined

I am trying to add my geojson urls which I loaded from my gist as L.LayerGroup for L.control.layers but I have encountered error "Uncaught TypeError: Cannot read property 'minZoom' of undefined" on L....
1
vote
2answers
192 views

Leaflet: Change displayed column on click

I have a GeoJSON layer in a Leaflet map showing buildings. The columns of the buildings layer contain electricity usage info by date (eg., the column 12052015 contains electricity usage on Dec 5, 2015)...
1
vote
1answer
26 views

Passing multiple arguments to callback function in Leaflet layer method bindTooltip()

I have a few GeoJSON layers on a Leaflet map that I am using the bindTooltip method on. Specifically, I am trying to use a function as the argument to bindTooltip so that I can produce some custom ...
0
votes
0answers
24 views

Leaflet: Unable to filter GeoJSON beyond the `properties` element level

I have the following code which displays a Layer in my Leaflet map from some remote GeoJSON: // Create Layer: Airspace var featuresUTMAirspace= L.geoJson(dataGuardianUTM, { filter: FuncAirspace, ...
0
votes
1answer
511 views

Icon inside Leaflet control layer does not display?

I created a leaflet control layer to switch between two base maps (Bing and OpenCycleMap), Yet I don't see the icon inside the layer control: var baseMaps = { "Bing": bingLayer, ...