Questions tagged [leaflet]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
22 views

How can I style polygons with parameters inside the FeatureCollection properties on Leaflet?

I have a GeoJSON file that has both the FeatureCollection and the Feature types inside it. Basically my code is the following (working sample here): L.geoJSON(myJSON, { style: style }).addTo(mymap); ...
0
votes
1answer
3k views

How to make the value showing on a Leaflet heatmap like this one?

I'm attempting to use leaftlet.js, and heatmap.js (github.com/pa7/heatmap.js/) following this example: But I want to show the value on the heat map like this crime page (with two options on: "Crime ...
2
votes
1answer
33 views

Changing layer order of vector tile layer

I am creating a simple web map using vector tiles of type pbf. The vector tiles are created with tippecanoe like: tippecanoe -pC -P -z 19 -Z 15 -e builds --drop-densest-as-needed --extend-zooms-if-...
0
votes
1answer
56 views

geemap doesn't display attributions

Is it normal that geemap doesn't display attributions in my notebook? Is there a way to add them? I'm running : import geemap m = geemap.Map(center=[40,-100], zoom=4) m.add_basemap('CartoDB.Positron')...
1
vote
1answer
621 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 ...
2
votes
1answer
53 views

Remove Leaflet layer at zoom level

I can't remove a Leaflet layer from my map. I have referenced a lot of other SO threads about this very subject. Even so, removeLayer() refuses to work. addLayer() works just fine. Threads I've ...
2
votes
2answers
122 views

Putting different id in different paths on my Leaflet map

I have many polygons to display on map like this: L.geoJSON(polygon, { style: function (feature) { return { stroke: true, fillColor: feature.color, ...
0
votes
0answers
35 views

GeoJSON to SVG and utilize SVG in the same position as GeoJSON (coordinates)? [closed]

Maybe my question is complicated, but I wonder if I can use an SVG that was previously GeoJSON, in the same position in which the coordinates of the GeoJSON were offset? If so, how could I do it? I ...
1
vote
1answer
28 views

Creating a hyperlink within a popup using Leaflet.JS

I have been struggling to use Leaflet (just getting back into coding) and I have done everything I would like to do but add a hyperlink to a pop-up on my map. The current code is: var marker = L....
1
vote
0answers
40 views

Local GeoJSON in Leaflet using leaflet-ajax

My aim is to include a local geojson file in my Leaflet map application using leaflet-ajax , as suggested by this earlier answer. In my root directory, I have: index.html entire contents of Leaflet ...
0
votes
1answer
73 views

Convert a ee.Geometry() into a Leaflet polygon

I'm using the Leaflet and gee API in a Python notebook. In this notebook I'd like to display a featureCollection as a layer on a Leaflet map. #retreive the asset asset_descripsion = 'Glad_' + ...
0
votes
1answer
243 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 ...
3
votes
5answers
8k 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 = ...
1
vote
1answer
68 views

Marker position in Leaflet

I use 2 markers : Icon and Tooltip. The problem is that given the sames Lon & Lat they are not at the same position. The Icon position is right, the tooltip position not. This is my js code for ...
2
votes
1answer
2k views

Changing anchor point for popup without marker using Leaflet

Is it possible to change the position of the anchor point for the popup without using markers? I was testing with this example. This code shows a popup, but I want to adjust the position of the anchor ...
1
vote
1answer
275 views

Leaflet control search clash with map.on zoomend function

I would like to know how to solve the clash between Leaflet control plugin and map.on zoomend function The problem is related to this query: Displaying selected layers depending on zoom in Leaflet ...
-1
votes
0answers
42 views

How to calculate itinerary using OSRM and Leaflet [closed]

How calculate distance and time between two addresses (itinerary/ routine machine) using osrm open source routine machine or any others open source tools. Calculating by foot, car and bicycle. I need ...
-1
votes
0answers
14 views

How to calculate itinerary by foot and car and bicycle using OSRM and leaflet [duplicate]

How calculate distance and time between two addresses (itinerary/ routine machine) using osrm open source routine machine or any others open source tools. Calculating by foot, car and bicycle. I need ...
0
votes
1answer
371 views

Adding time dimension image layers using Leaflet

JavaScript beginner here. I'm working on getting a weather animation done in leaflet. A suitable plugin appears to be leaflet.timedimension but I would be open for other options too. I have 60 PNG ...
0
votes
1answer
33 views

I want to hide WMS layer in Leaflet

I want to hide WMS layer in Leaflet. But in a condition, display again. I tried removelayer. But once It is removed, it can not add again. here is the relevant code (generated with folium): if (zoom &...
2
votes
1answer
775 views

What is leaflet-src.map?

I've download the Leaflet package and there is "leaflet-src.map" What is it exactly? Do I need it to use Leaflet correctly?
1
vote
1answer
277 views

How to send bbox dynamically via wms request in leaflet?

I've created a leaflet map and use L.tileLayer.wms to load my wms layer. I dont want to load all data on my map instead i need to load data based on bbox.I use this line for sending wms request to ...
0
votes
1answer
37 views

Deferred functions, Leaflet with GeoJSON

I'm trying to chain functions, and I make a mistake somewhere, but I can't find where... First, I create a new GeoJSON layer. It works. var dataLayer = L.geoJSON(null).addTo(myMap); Next I add some ...
0
votes
2answers
282 views

TypeError: Invalid parameters given for Point initialization.on Django

I am working on a location based poject and what I all want is to show only those pointfields stored in database which are at certain distance from any clicked region of leaflet map.But when I click ...
0
votes
0answers
27 views

Changing Style of WMS dynamically with a select box in Leaflet?

I have a Leaflet WMS Layer mylayer = new L.tileLayer.wms('https://{s}.url.com/wms?', { mylayers: 'Workspace:mylayer', format: 'image/png', transparent: true, styles: 'sld1', }); ...
0
votes
2answers
407 views

Understanding why LatLng returned from L.GeometryUtil.closest() are not from array being checked over?

I am using this function below from this library Leaflet.GeometryUtil to help find the closest distance between two points. L.GeometryUtil,closest(map, array, latlng) It is returning this object ...
3
votes
3answers
3k 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"...
0
votes
0answers
26 views

Export spatial data from Web Map

I am trying to get the polygon data from the following leaflet web map http://www.cityfibre.com/rollout/. I am not really sure what kind of format I should be looking for (geojson, xml, etc..) but I ...
1
vote
1answer
948 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
58 views

Adding GeoJSON coordinates as popup in Leaflet

I'm trying to add the coordinates from my GeoJSON data as popups when a user clicks on the resulting polyline that I'm plotting onto a map. I'm pretty new to Leaflet and JavaScript and am struggling ...
0
votes
0answers
28 views

Uncaught TypeError: L.control.measure is not a function

I am trying to add a Leaflet control measure my map, but I get an error in the console of browser. The error is in console is: Uncaught TypeError: L.control.measure is not a function I copied the ...
0
votes
0answers
44 views

Creating multiple Choropleth map using Leaflet

I have created a choropleth map including a legend and a div element using a JavaScript object created from GeoJSON layer using the leaflet tutorial. But when I tried to create multiple choropleth ...
0
votes
1answer
442 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 ...
8
votes
3answers
3k views

Great circles in QGIS and export in 3857 web map

My plan is to visualize great circles in a Leaflet web map. So coming from this great postgis article and R version I thought it would work like this in QGIS: create a line from two points, store ...
0
votes
1answer
2k views

Not allowed to load local resources ASP NET MVC

var wmts = L.tileLayer('E:/Mapnik/{z}/{x}/{y}.png', { wmts: true, }); wmts.addTo(map); I am trying to load the map with asp.net mvc, but I get this error. (Not allowed to load local resources ...
12
votes
1answer
7k views

Interactive and dynamic map with wind data in R leaflet?

I have some data like this : longitude latitude speed direction 1 6.10722222 46.23639 4 360 2 6.95416667 43.54694 4 360 3 7....
1
vote
2answers
2k views

Switching leaflet image overlay layers shows white blinks

I am switching between image overlay layers upon user entry (through a slider). Every time users get into this loop, a fast blink (with white background) is displaying, meaning that the old layer is ...
2
votes
2answers
8k views

Leafletjs get latlng center position of polyline

After drawing a polyline, I would like to draw a circle from the center of this line whose radius encompasses the entire line. For polyline's that have more than 2 points I can crudely get the center ...
0
votes
0answers
13 views

How to switch between SLD styles geoserver of one layer [duplicate]

i have one layer published in geoserver and i added 4 styles(sld1, sld2, sld3, sld4) to the same layer, now how could i to switch between 4 styles each style with the legend use leaflet ? this wms of ...
1
vote
1answer
153 views

Leaflet if statement for mouseout function

I have a problem. I would like to set a separate mouseout conditions for one of the geoJson.property value. The sitoation looks as follows: I set function for function style2(feature) { if (feature....
1
vote
1answer
469 views

Filter Leaflet markers by input selectionin R Flexdashboard

I am trying to filter the markers that are drawn on a Leaflet map based on what is selected in a user defined date range. The below codes is returning an error that it is unable to find hfxLoc object. ...
0
votes
0answers
42 views

When using react-leaflet, for Marker it shows <img src=[object Module]>

When using react-leaflet with create-react-app, for Marker it shows <img src=[object Module]> in console after changing the default icon as given in here - https://github.com/PaulLeCam/react-...
1
vote
3answers
2k 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/) ...
1
vote
1answer
112 views

Error while rendering Leaflet map on Shiny

I have been trying to reproduce a Leaflet map on a Shiny webpage. I have made this code so far: library(shiny) library(shinydashboard) library(leaflet) library(rgdal) library(dplyr) library(DT) Map &...
1
vote
1answer
24 views

Force L.control.layers to stay permanently collapsed

I am building a map with Leaflet 1.3.1 containing two layers controls (Control1 and Control2). For some reasons, I want one of them (Control2) to be displayed on the map, and I need it to stay ...
0
votes
0answers
42 views

How to show 3D building with Leaflet

How can I use Leaflet and OpenStreetMap to display 3D buildings for free? I find same scripts but needs API key or access token. Who already has a script to show 3D map Leaflet using open source? i ...
1
vote
0answers
28 views

Adding a Pegman of street view with a Leaflet map

I want to add a Pegman of street view to my Leaflet map. How do I add it for free and open source way to have the possibility to see street view of every place in the map?
3
votes
0answers
47 views

Layer ordering of ST_ASMVT tiles in Leaflet

I am generating MVT tiles for multiple layers in Django using the following query: WITH bounds AS ( SELECT ST_Segmentize(ST_MakeEnvelope(8247861.100083642, 3551570.082242422, 8252753....
0
votes
1answer
274 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", ...
10
votes
2answers
29k views

Leaflet: how to use a custom marker on a geojson layer?

I'm trying to put on a Leaflet map a geojson and all works fine until I use the default blu marker. Now I'd like to use a custom marker (a little .png icon) and I've changed my code in the follow ...

1
2 3 4 5
71