Questions tagged [leaflet]

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

Filter by
Sorted by
Tagged with
1
vote
0answers
121 views

.svg image is not loaded into webview in android

I'm using leaflet and trying to load .svg image on webview. `//Create the bounds and image to add. var imageUrl = mapData.plan.image; var imageBounds = [[mapData.plan.size_x, 0], [0, ...
0
votes
2answers
141 views

Extract timestamp not defined using Leaflet Time Slider?

I am new to coding, so there may be many things wrong with my code. I am trying to build a Leaflet time slider for some point data. The geojson data is of sites where water was sampled for mercury ...
0
votes
0answers
137 views

Creating Leaflet Heatmap using LinsString GeoJSON

I need to create heatmap based on length property from a LineString GeoJSON file. I have tried to use Leaflet.heat plug-in, but this tool accepts points not lines. here is my code: $.getJSON("data/...
0
votes
0answers
224 views

Visualize big data HTML file created with Folium

I have written a Folium map of a French city with the possibility of visualizing attributes informations on click for each of its polygon which makes a huge file after 2 hours of calculation with the ...
0
votes
0answers
124 views

Use clickEvents in shiny with tmap

You can use clickEvents for the tmap package in shiny as in this example for leaflet in shiny. However, I don't know how to acces the click events. On each click an Id is given, but where is this id ...
0
votes
1answer
285 views

Change Leaflet Marker Icon(.png) color programatically [closed]

I have a list of markers. I am assigning an icon to each marker and creating that icon from a black .png circle. I want to change color of that marker based on input value from user. I have searched ...
0
votes
1answer
230 views

Converting JSON response into a GeoJSON layer in my Leaflet map

I need to convert a JSON response from Mapquest elevation API into a GeoJSON layer in my Leaflet map. var ele = $.getJSON('http://open.mapquestapi.com/elevation/v1/profile?key=<API_KEY>&...
0
votes
0answers
44 views

Leaflet.browser.print remove print options

How to disable print options and leave only one option. Or how to make it possible to click directly on the button and the list did not appear. One-click printing I still see all possibilities ...
0
votes
0answers
80 views

Calculating elevations using Mapquest elevation API?

I have a Leaflet map that contains options for users to draw lines, i need to enrich the drawn lines with elevation data from Mapquest elevation API. here is my code: drawData = drawnItems....
0
votes
0answers
84 views

How to create a map-based survey with drag-drop capability?

I am an urban planning master student. I need to create a map-based survey for my research. The survey should allow users to drag some different points from the toolbar to the map showing next to it. ...
1
vote
1answer
116 views

Leaflet: Different custom information popups for each GeoJSON polygon

I'm really new to this and I'm trying to create popups for 2 polygons which will each contain a paragraph of written information. The function I have so far differentiates between the 2 polygons by ...
0
votes
0answers
84 views

Create a SVG layer for Leaflet from GeoJSON

I had a large GeoJSON and I display it with vectorgrid plugin for Leaflet. I want to add another layer based on the main GeoJSON with only the name of the building and display it in vector format (not ...
0
votes
0answers
98 views

Merge shapefile data within the same spatialpolygonsdataframe in R, when not all data have the merge column populated?

I have a 156Mb shapefile of New Zealand polygons down to the individual suburb level. There are 7,369 polygons. Each polygon has a unique ID (1...7369) in an ID column. There is a Suburb column ...
0
votes
1answer
259 views

Leaflet add data to GeoJSON without showing on map

I am adding using GeoJSON data pulled from a service. I want to load the GeoJSON layer but I don't want to display the data on map. This code is adding myLayer with the default blue color to the map. ...
0
votes
1answer
90 views

Zoom to selected feature extent using Carto and Leaflet

I am trying to use the getBounds and setBounds functions to zoom to the extent of a selected polyline feature in Carto. The feature has been selected using an SQL query. I want to zoom to the extent ...
0
votes
0answers
52 views

Toggling off/on heatlayer using geojson file

I created a heatlayer using a geojson file. However, I am having trouble with toggling it on and off with a checkbox. Since the toggleHeatlayer function is within another function, it becomes ...
0
votes
1answer
203 views

Changing marker shape to circles in Leaflet

I was wondering how to change the default marker shape in a Leaflet map to circles $.ajax("data/StatesPopulation.geojson", { dataType: "json", success: function(response){ ...
0
votes
0answers
65 views

ODK Aggregate PostGIS and MapServer WFS with attached images

I am using ODK Collect to collect ground data. The data collected are stored into a PostgreSQL/PostGIS database then I publish them as WFS through MapServer and read them with Leaflet (Leaflet-WFST ...
1
vote
1answer
193 views

qgis2web leaflet: change position of layers control box [duplicate]

I exported a leaflet-webmap with qgis2web. On the top-left, there are the controls (like zooming, serching etc.). On the top-right, there is the layers control box (checking/unchecking the layers of ...
0
votes
0answers
67 views

Basemap layer is over the WMS layers

I have the problem that the WMS layers are hidden from the basemap, I try to solve the problem with the zIndex but it does not work. Any other ideas? WMS Layer var two = L.tileLayer.wms('http://...
1
vote
2answers
484 views

Calling OpenWeatherMap API in Leaflet.js map

How to get weather data from OpenWeatherMap API in a popup by clicking any location on the map? i am still new at calling APIs in my map, API return JSON files but i don't know how to call the API in ...
3
votes
1answer
173 views

Add Line Layer from PostGIS to Leaflet

I have a line layer in PostGIS that I would like to add to a Leaflet map. I have the PHP setup, but I can't seem to get the Javascript correct. I know my issue is converting the line to geoJSON. The ...
0
votes
0answers
114 views

Leaflet custom icons and popups showing GeoJSON properties with external data?

How can both custom icons and geojson properties be implemented with external geojson in Leaflet? Using methods described in answers to two other questions, both using inline geoJSON: Using custom ...
1
vote
2answers
112 views

Executing functions after multiple data sources have been loaded in Leaflet AJAX

I have a leaflet map that takes in data from multiple sources via the LeafLet Ajax plugin. I want to execute certain functions only after ALL the data has been loaded, not just one layer. The data ...
1
vote
1answer
302 views

Leaflet: get layer in GeoJSON with pixel coordinates instead of lat long coordinates

In my Angular 7 project with ngx-leaflet and leaflet 1.4.0 and leaflet-draw 0.4.14 I want to export each drawn rectangle (and circle,...) to GeoJSON. That works fine using public onDrawCreated(e: ...
0
votes
0answers
176 views

R : How to build heat-map based on ratios with leaflet package

I'm just starting to try out some things in the GIS arena and perhaps this question is a concept mistake. I've read the post R : How to build heatmap with the leaflet package and the fantastic answer ...
1
vote
0answers
236 views

Disable map dragging ONLY when touch - sliding transparency slider [closed]

I am wondering if anyone knows how to replicate this, but specifically with touchscreens in mind: //disable dragging when cursor is over the element opacitySlider.getContainer().addEventListener('...
0
votes
1answer
154 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.
1
vote
2answers
100 views

Reduce complexity of KML file

I have a 6mb KML file I am using with the Leaflet API/Ominvore plugin. It is just a centerline of a long distance trail. What would be the best way to make it smaller? Reduce complexity etc.
1
vote
2answers
71 views

Getting hightest and lowest points

I have GeoJSON files that contains altitude values. I have used these GeoJSON files to be shown on leaflet.js web map. I need to show values of highest and lowest point in two divs when I clicking on ...
0
votes
2answers
97 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
3answers
816 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
1answer
169 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 ...
1
vote
1answer
76 views

How can I get GeoJSON from Esri software to load in Leaflet?

So I am trying to take a GeoJSON file that I have generated from an Esri shapefile in ArcGIS Pro, but it is not rendering on the map for some reason... The GeoJSON that was created from ArcGIS Pro is ...
0
votes
0answers
69 views

Example for request GetCapabilities to get bounding box of WMS layer [duplicate]

Please share an example in which a getcapabilities request is fired on the geoserver for bbox of a specific layer? Note:- I have seen answers in which method is given but no example of a request is ...
-5
votes
2answers
187 views

Leaflet-JS Not sure what is wrong with my script below

I have posted a screenshot of my index.html and JavaScript file. The problem is that It doesn't display any webmap. the only thing I can see is the head(h1 from my html. Any thoughts on this?
2
votes
1answer
155 views

Creating a rectangle using leaflet / turf.js

I have written some code which creates a rectangle at the position of the user's cursor. There does not seem to be any method to do this in turf.js itself. And of course using the latlong-based ...
1
vote
1answer
289 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 ...
1
vote
1answer
169 views

Using Leaflet elevation profiles with multiple GeoJSON features?

I have a GeoJson file that contains many routes, i need to show each route on an elevation profile via Leaflet.elevation plugin, in need to when i click on a route it's profile show on the elevation ...
0
votes
2answers
60 views

Changing a markers location at set intervals

I am trying to plot coordinates of a marker using a GeoJSON feature. I am able to plot my points fine but my issue is, when the interval happens the old marker stays on my leaflet map rather than ...
0
votes
0answers
41 views

Leaflet WMS layer label disappears on zoom [duplicate]

I am populating a tileWMS layer on my map (also created through Leaflet) through Leaflet from GeoServer which is working fine but the issue I am facing is with visibility of labels. On various zoom ...
0
votes
2answers
178 views

Displaying GeoJSON using Ajax and Leaflet?

I have been trying for days to load a GeoJSON file using Ajax and Leaflet. I can get the map & index.html to load using an Apache server and such but the GeoJSON itself does not show up. Here is ...
1
vote
0answers
142 views

Draw a polyline around a route to act as geofence with leaflet routing machine [closed]

I am using leaflet routine machine to get a route between 2 points. I want to be able to draw an invisible polyline around the route and use this as a geofence and if the user goes out of the bounds ...
3
votes
0answers
65 views

Function fires despite conditional query in leaflet-map

In a map built with Leaflet I created a button to export and download data as geoJSON drawn before by the user with Leaflet.draw. To prevent an empty download, I am querying the existence of data. ...
2
votes
2answers
234 views

Making button clickable to perform function in Leaflet?

I am trying to create buttons that will initiate a flyTo. I can click the buttons on the page but they do nothing action functions: <script> function Action(){ map.flyto([43.372000,...
3
votes
1answer
213 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
3answers
802 views

I'm trying to add my local GeoJSON files to my Leaflet web page

I'm quite new to JavaScript and I have been trying to add my GeoJSON files to a web page. I can't seem to figure out how to get the GeoJSON to actually load. I've checked it using GeoJson.io and it ...
3
votes
1answer
73 views

Leaflet access dynamic layers globally

I am adding layers to my map dynamically based on whats available in the MapServer. I am looping over them so I can add them in the LayerControl. My issue is that I dont have access to the layers ...
0
votes
1answer
47 views

Esri Leaflet identify() only on added layer from MapService

I try to identify features only from the wastepit layer. In this example I am adding two layers: wells and wastepit. I am only calling the identify function on the wastepit layer but I still get ...
2
votes
1answer
138 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....