Questions tagged [leaflet]

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

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

WMTS in Leaflet - Can't make this code work?

I know this have been touched upon before, but the other posts did not entirely do it for me. I'm trying to make a minimal Leaflet .html page with a map, containing a WMTS map. The code looks like ...
0
votes
1answer
87 views

Using JavaScript created select options as Leaflet map setContent

Working on a creating a custom CRS Leaflet map. On map rightclick, show a popup with select boxes for users interaction. var submit_Loc_popup = L.popup(); map.on('contextmenu', onPopupBoxSubmit); ...
0
votes
1answer
40 views

Update info on a div when map on touchend

I want to update a div with information when I touchend the map on my iPad or iPhone. The information div run correctly with a click version but for a touchend I had to use map.on map.on('touchend', ...
0
votes
0answers
44 views

Make background image visible at all scales in webmap QGIS2web

I'm trying to produce a web map using the QGIS2web plug in and leaflet output, but the background image is not visible when I zoom in beyond some scale. Is there a way to control the scales a ...
2
votes
0answers
102 views

Plotting KML data on Leaflet map

I have 5 different KML files for each subzone of Singapore map. I want to plot the KML data by subzone on a Leaflet map. library(leaflet) library(raster) library(readxl) library(rgdal) setwd("F:\\...
1
vote
0answers
102 views

Leaflet dialog box that contains info on 1 to n layers that were clicked on

I have a Leaflet application where the user can click on a feature and the info for that feature will be updated in dialog box. var info = L.control(); info.onAdd = function (map) { this._div = ...
0
votes
2answers
206 views

Adding a start and end marker to a GeoJSON linestring

I have a GeoJSON route that was created using ORSM which is as follows: var noelev = {"type":"Feature","properties":{},"geometry":{"type":"LineString","coordinates":[[-84.477478,37.988621],[-84....
0
votes
1answer
108 views

Show time series data with non-contiguous times using Leaflet TimeDimension plugin

My data is made up of squares forming a grid where the value of each square changes with time. The times are equally spaced with 1 hour intervals, however, the data is only available for a certain ...
1
vote
1answer
265 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)...
0
votes
0answers
133 views

Adding custom icon doesn't work in Leaflet?

I'm trying to add custom icon to a map. All seems ok but when I click to add markers on my map I get the Leaflet icon by default and not the one I liked to have. Perhaps is in the way I get the ...
2
votes
1answer
99 views

How do I plot spatialpolygon dataframe layer on a leaflet map

I am not sure why this piece of code works library(leaflet) library(raster) adm <- getData('GADM', country='SGP', level=1) popup <- paste0("<strong>Name: </strong>", ...
2
votes
1answer
79 views

Leaflet info box only showing properties from selected layer

I would like to use the info box as shown in the tutorial interactive choropleth map with multiple layers and properties from different layers. The idea is to only show the properties from the ...
0
votes
0answers
29 views

Leaflet info box error on same name properties in multiple layers

Following the 'interactive choropleth map' tutorial, I am able to create my own custom info box in a map with multiple layers. The properties called are within different layers. However, I have to ...
0
votes
0answers
189 views

Pushing features to external GeoJSON file

I am working on a project which uses Leaflet and leaflet.draw to show and draw shapes on the map. I also have a data.json file which I use to display former features generated from geojson.io. What I ...
0
votes
1answer
60 views

Leaflet Easybutton does't show up

I can't figure out why the EasyButton does't work. The following is the result of many modifications but none of them work as expected. Simple Leaflet Map <link rel="stylesheet" ...
0
votes
0answers
58 views

Add dynamic URL to Leaflet iconUrl

I need to custom icon for my app . One icon for a group of markers. I add a URL for each icone and I don't know how to add it dynamically to my iconUrl. It to change for each select. Here is my code :...
0
votes
1answer
150 views

Export selected lines as GPX

I have created an option in my Leaflet.js web map that exports clicked lines as GPX, but it is just exports only the last clicked line. I need to export all clicked/highlighted/selected lines in one ...
0
votes
1answer
318 views

How to change the color of GeoJSON layer?

I want to show my road network in red color. How can I change this default color of the road network. Where should I attach style property? var roadNetwork = new L.LayerGroup(); $.getJSON("{% url '...
0
votes
1answer
300 views

Allowing users to add data to marker that they create on Leaflet map?

I have created a basic web map and implemented leaflet.draw functionality to it. What I would like to do is allow anyone that visits the web map to use the draw tools to add a marker (point) and when ...
0
votes
1answer
305 views

.on(click) for layer groups in leaflet

I have three layer groups. How to use .on (click) for all layer groups without repeating the code? Do I really need to use .on(click) for each layer group? It seems to be unnecessary lots of code. ...
0
votes
2answers
107 views

Zoom to points using d3SvgOverlay

I have an application where a csv file is filtered and the filtered data is displayed on a leaflet map. What I would like to happen is for the map to zoom in to the points. I have tried using ...
0
votes
1answer
136 views

Coordinate mismatch between Google Maps and Leaflet Using ESRI World Imagery

I mark a point on Google maps and get lat, lon values. When I put those values in my code which uses Vue2leaflet and ESRI World Imagery tiles from https://server.arcgisonline.com/ArcGIS/rest/services/...
0
votes
0answers
203 views

Interact with vector tiles from Mapbox in Leaflet.JS

I am trying to add GeoJSON layers on a Leaflet.JS map, but there are GsoJSON files with a very big size that can not be rendered as GeoJSON on the map. So i have added it to the map vector tile ...
0
votes
1answer
188 views

Getting Leaflet.Control.Layer.Tree 'children's' to collapse by default?

I am using the Leaflet layer.control.tree plugin from here : https://github.com/jjimenezshaw/Leaflet.Control.Layers.Tree But I can't figure out how to collapse the branch by default. Now it looks ...
-1
votes
1answer
124 views

Finding precision of polygon in Leaflet? [duplicate]

In order to convert coordinates to geohash I need to know the precision as well but unable to figure how to do so.. Any suggestions? ** EDIT ** What I try to do is to find the precision in leaflet ...
0
votes
1answer
310 views

Leaflet: Canvas Text Labels

I have some text labels in Leaflet which I'm building from JSON data using L.divIcon. They're looking like this: lbl_coord = feature.properties.coord; lbl_text = L.divIcon({ className: /*...*...
0
votes
1answer
152 views

Trigger event on tile layer

Is it possible to make a click event occur only on the tile layer on a Leaflet map? I tried var tiles= L.tileLayer(...).addTo(map); tiles.on('click', function(e) { console.log('ok') }); but it ...
0
votes
1answer
379 views

Uncaught TypeError: L.GeoJSON.AJAX is not a constructor

I want to add my json files to leaflet using leaflet-ajax plugin. But it always says following error: Uncaught TypeError: L.GeoJSON.AJAX is not a constructor Why this error is showing in my code? ...
1
vote
0answers
23 views

vectortiles: change style of basemap instead of data

I'm using Mapbox-GL-Leaflet bindings on Leaflet to style my vector tiles. I'd now allow the user to switch a style using Leaflet control. The easiest way would be to use LayerControl for this. Since ...
0
votes
0answers
14 views

Mapping GeoJSON polygons onto leaflet Eckert IV projection using Proj4leaflet

I am trying to draw polygons (using a collection polygons in a GeoJSON object) on a world map that is projected in the Eckert IV projection in Leaflet. The code I am using is as follows: ekertiv = ...
0
votes
1answer
178 views

Push attributes to GeoJSON in Leaflet

I am trying to add attributes to a layer. I have a select function that finds all points within 10 miles of a feature. If the point is within the radius distance I add it to an array and make another "...
0
votes
0answers
33 views

Attach Textarea to Leaflet Draw Rectangle to drag with rectangle

I am trying to revive some of the code of Leaflet-Illustrate: It uses some Leaflet code that I believe is attaching hooks by using this: statics: { START: L.Draggable.START, END: L....
0
votes
1answer
74 views

How to repeat drawing function in Leaflet

I am trying to create a Leaflet.js web map that gives users the opportunity to draw lines. this line will be sent to mapquest elevation API to be retun to the map as a GeoJSON with elevation data ...
1
vote
2answers
999 views

Using Leaflet inside Bootstrap container?

I have problem rendering leaflet map in a webpage using bootstrap. I have two columns col-4, col-8 in a bootstrap container. the col-4 has some text and col-8 has to render the leaflet map. But the ...
0
votes
1answer
151 views

Using Leaflet Search plugin with GeoJSON layer (L.Control.Search)

I have a map with a single GeoJSON layer that I referenced in my script (using the AJAX plugin). Now I am trying to add search functionality to the map so that the user can search for features by name....
0
votes
0answers
185 views

Converting L.GeoJSON Leaflet to different projection?

so I have some awesome basemap raster layers that use L.TileLayer to load, but the GeoJSON I have for my country polygons is all Web Mercator. My tile map is WGS84 or EPSG4326 (I think). But I ...
1
vote
1answer
105 views

Adding Altitude to a marker in WebGLEarth

Im trying to add an altitude to a marker in WebGLEarth but i cant figure out how to do it. I cannot find anything in documentation either. The idea is that my markers act as satellites so i need the ...
0
votes
1answer
301 views

Turf intersect point with Leaflet GeoJSON error

Leaflet and Turf. I am trying find all the layers on a Leaflet map that intersect a point when the user clicks on the map. I am using the turf library to test for this. In the console when I click on ...
2
votes
1answer
65 views

Adding dialog plugin QGIS2Web

I am kind of a beginner. I have exported my webmap using QGIS2Web and while playing with it, I was able to change the settings of the items already present on the map (for example position, language, ...
1
vote
1answer
115 views

R leaflet plot with ETRS89

I am new to GIS and R leaflet, and I am trying to plot the starting points of protected rivers in Spain. Example of coordinates from the original file: Nombre.de.los.cauces.principales Coordenada.X....
2
votes
2answers
82 views

Leaflet: Detect failed zoom attempt

I would like to detect whenever a user tries zooming but fails due to reaching minZoom/maxZoom of the map. From what I understand, zoom/ zoomstart/zoomend will not be fired as there is no actual ...
0
votes
1answer
44 views

Leaflet z-index above everything else [duplicate]

I have a problem with leaflet : the control layers are always above everything else in my webpage. Does anyone know how to fix this ? My code creating the map var src_str = component.get('v.srcPath')...
0
votes
0answers
51 views

White sides ar marker popup

I like Leaflet a lot. But I want to ask how to remove white sides in the popup ? I manage to turn of padding but it only removed top and bottom, but sides still stand. I will insert a image and it ...
0
votes
2answers
306 views

JavaScript remove Leaflet layer when checkbox is unchecked

I have an JS object where the 1st value of each key is the checkbox id, 2nd is the API where the data is and the 3rd is the color var layers={childcares: ["#childcares",'http://127.0.0.1:8000/...
0
votes
1answer
57 views

Text in layer toggler in Leaflet is really faint - why?

I have added a layer toggler using Leaflet and geojson but the text of layer names is too light to see in the toggler - how do I style the text in a darker colour? It's on a wordpress site, if that ...
0
votes
0answers
93 views

Editing attributes of a GeoJSON in Leaflet

I have a map in which I'm trying to create the capabilities of adding new features and editing attributes of new and existing features. I have managed to make the feature editable but I want people to ...
0
votes
0answers
15 views

Which tool to use in order to create map? [duplicate]

What I am trying to do is to build a website with some maps for areas for a certain PC game. I just don't know where to start. How does one create a map? Do I need first to acquire a background ...
0
votes
0answers
11 views

When I click on the Temporal Slider Buttons, I dont see a significant different in the symbol size

I have created a Time Series Proportional Symbol map in Leaflet JS. My data is: States population from 2010 - 2018, and there isn't a big difference in the population of every two years. So now when I ...
1
vote
2answers
381 views

Leaflet extension: “this.callInitHooks is not a function”

I am trying to develop a leaflet function but I am getting this error which I am having trouble understanding. This is my plugin code thus far: L.Spotlight = L.Class.extend({ options: { ...
2
votes
0answers
83 views

Use leaflet-draw-toolbar with angular 2

Is it possible to use leaflet-draw-toolbar with angular 2 and ngx-leaflet-draw? I do not see, and I am not versed in Angular 2, enough, to incorporate the JS library for leaflet-draw-toolbar into my ...