Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [leaflet]

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

2
votes
2answers
105 views

Import local GeoJSON file into Leaflet

I just used a leaflet. From the geoJSON demo page I saw if you want to include data you have to use <script src="data/us-states.geojson"></script> and if you open the files looks like ...
0
votes
1answer
78 views

Spatial functions with MySQL, XAMPP, and Wordpress

I am trying to figure out how to using the ST_AsGeoJSON function in MySQL, but I keep getting an error that says that this function does not exist. I have found in the MySQL documentation that this ...
0
votes
1answer
59 views

Display markers and autohide them after few seconds using data of nested JSON object from an API in Leaflet Map

I'm trying to load 4 markers at a time and timeout should be 5 secs for them and then new markers should come up and old one's should be hidden automatically. I have written this code and unable to ...
0
votes
1answer
202 views

input data coordinates to database from input data inside leaflet js

i have a problem with my update data coordinates form leaflet popup. i just want to make edit form inside leaflet popup. if i click marker in a map it shown coordinate with input form, if the building ...
1
vote
2answers
2k views

leaflet remove a specific type of features from featuregroup

Is there any way in leaflet to delete a specific type of features from a feature group (mixed content: markers, polygons, polylines)? I know this code that work: map.removeLayer(drawnItems); but it ...
0
votes
1answer
237 views

“L.Proj is undefined” error when using Proj4leaflet in angular 5

I am facing the error "ERROR TypeError: Cannot read property 'CRS' of undefined" caused by L.Proj being undefined. Here what I did : I added Leaflet, Proj4 and Proj4leaflet packages using npm ...
1
vote
2answers
1k views

Using Leaflet, PostGIS and pgRouting for web mapping?

I am newbie at Open Source GIS. I have already create 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 ...
1
vote
0answers
345 views

Automatically filling contours by different type of hatching?

I applied a question a few days ago here Filling contour levels with grain (texture) using Leaflet, I still found no answer I try to well exposed the problem here again in another way. if we have a ...
0
votes
0answers
16 views

Determine if markers are inside of the circles array?

I have a problem in determining if markers are inside of the circle array or not. The code that I have provided manages to know the markers only for one to two circles while the rest does not know. ...
1
vote
1answer
283 views

Leaflet-Search plugin error

I try to connect Leaflet search plugin to my map with GeoJSON data. But i get error( When I enter a search query in browser inspector i get error: layer.getBounds is not a function in leaflet-search....
1
vote
0answers
51 views

Convert coordinates with Proj4Leaflet from EPSG:25832 to leaflet 3857

I have a wmts server, and try to add this tiles to leaflet with proj4leaflet. My code is here //this one is fine var main = L.tileLayer( 'http://****&zoom={z}&x={x}&y={y}',...
0
votes
1answer
149 views

Leaflet.TextPath: how to set zoom level from which text would be displayed

I am using the Leaflet.TextPath plugin for labeling polylines. It works fine into my Leaflet map, but I want to set the zoom level (scale-based visibility) from which labels would be displayed on the ...
0
votes
1answer
104 views

GeoDjango raster field display on Leaflet

In the new Django version support raster field and I follow this manual for GeoDjango raster field and this question for add raster I have built a simple demo. here the code : settings.py postgis ...
0
votes
1answer
16 views

Get tiles to appear after fitBounds call on one marker on mobile only

I am making a Leaflet 1.3.4 map. When I added fitBounds to the code, I experience a problem when viewing the map on my iPhone XS. Map displays fine on the desktop but regardless of browser (I have ...
0
votes
1answer
27 views

Display leaflet layerswitcher on click event

I would like to click on a sidebar/menu icon, and when I do the layerswitcher Icon should appear. Right now the layerswitcher is always displayed. I know how to make it disappear with the command ...
0
votes
1answer
1k 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 ...
0
votes
2answers
159 views

Leaflet - map.fitBounds() / map.getBoundsZoom() BROKEN after resizing map?

https://jsfiddle.net/MaxHeadroom/s6h40xrn/ If you resize the map size, the zoom level should be adapted to always show the orange rectangle at maximum possible size. But fitBounds seems to be broken ...
3
votes
1answer
819 views

Put LeafletJS geoJSON's into a MySQL database through PHP

I'm doing a project that will let users manipulate a map through LeafletJS, creating circles and polygons on top of the map. I need to gather these inputs for later analysis, using a MySQL database ...
44
votes
5answers
84k views

Loading external GeoJSON file into Leaflet map?

I would like to load a geoJSON (polygon) file into my leaflet map. I have seen examples where geoJSON is embedded into the javascript code but I can't find any examples showing how it is done with an ...
0
votes
1answer
38 views

FitBounds after L.GeoJSON.AJAX has loaded

I am making a Leaflet 1.3.4 map that will show members based on category. I have a php file "cs.php" that queries a MySQL and returns an option menu of distinct categories. When a category is selected ...
0
votes
1answer
256 views

layer.addData - circle marker style pointToLayer

So, my problem resides when creating a layer. then adding data to it later. but the style feature not taking control. and it adding default style. Here is some code that I have. That creates a layer. ...
0
votes
0answers
24 views

Reorder WMS Layers Using an Interface on Leaflet/Openlayers

As simple as it sounds, WMS layers from Geoserver rendered on client side via Leaflet/Openlayers have their Z-index predefined in the code itself; I was hoping to use an interface of sorts to reorder ...
0
votes
0answers
30 views

Webmap plugin in QGIS 2.18

I am having big trouble using the 'Webmap' plugin. It worked very beautifully until something happened with the encoding of characters. As of now QGIS just hangs up. This is the error message I get ...
0
votes
1answer
170 views

Printing multiple maps in the same pdf

Im using leaflet, Is there a plugin that allows it to print more than one map in the same pdf like this example .
1
vote
1answer
75 views

refreshClusters on esri.Cluster.featureLayer

I am trying to 'refresh' a cluster layer which is created by L.esri.Cluster.featureLayer and a feature url. I have tried to remove and re-add the layer (with no succees). But the refreshClusters is ...
1
vote
1answer
81 views

Showing all features by real-time API with Leaflet Map

I want to show all URL parameters or features onto a map. I have made the variable with ajax query as well as inside the loop data is printing with variable but I want to show this data with map into ...
0
votes
0answers
20 views

Highlighting map areas through map legend using Leaflet?

I would like to highlight different areas on a choropleth map when the mouse over the legend using Leaflet, but my code is not working: <head> <meta charset="UTF-8" /> <meta ...
0
votes
1answer
417 views

cannot get properties of multipolygon - mapbox/leaflet

I'm currently using mapbox with natural earth and geojson to populate a map with multipoygons and custom markers. Each of these has a set of properties and information that I need to display on click -...
0
votes
1answer
12 views

Removing leaflet Tooltip from L.geoJSON layer

I'm aware that there is unbindTooltip(). But I am not sure if that will work in my case. The first problem may be the fact that I need to convert it out leaflets geojson format? The second problem ...
1
vote
0answers
18 views

How to change the layer selection view from Radio button to Image in Leaflet

I have implemented the below example to show the multiple base layers of map in my application using LeafletJs. Leaflet JS LayerGroup example I'm able to successfully implement the same but I'm ...
2
votes
1answer
39 views

List table names within PostGIS bounding box

So I have a bounding box drawn by the user on Leaflet from which i can get features of specific table as follows SELECT * FROM $table WHERE $table.geom && ST_MakeEnvelope($test, 4326) where $...
0
votes
1answer
307 views

Displaying geojson polygon in leaflet imported with ajax

I'm having difficulty displaying a simple polygon in leaflet. I'm unsure if my syntax is bad or if I'm importing the geojson incorrectly. I'm using the ajax plugin from calvinmetcalf and add the js ...
1
vote
0answers
1k views

Reason for “L.Control.Draw is not a constructor” error?

Below is my code: <!DOCTYPE html> <html> <head> <title>Simple Leaflet Map</title> <meta charset="utf-8" /> <link rel="stylesheet" ...
0
votes
1answer
1k views

Transparent custom legend with mapbox/leaflet.js

I am building a map with mapbox.js. I have created a custom legend and want to make it partially transparent, but can't figure out the right CSS. Here is my legend html snippet: <div id='...
3
votes
3answers
2k views

Zoom map to a scale in Leaflet

I am preparing a printable map in leaflet. For this purpose I would like to make a map zoom to a particular scale eg. 1:500 or 1:1000. But Leaflet zooms a map based on the extend and zoom level only. ...
3
votes
1answer
192 views

How to get the number of clusters and its markers with Leaflet?

I would like to know the number of clusters and its markers as soon as I open the map without zoom-in. I'm using: Leaflet 1.2.0 Leaflet.MarkerCluster 1.2.0 Firefox 57.0.1 OS/Platform On the image ...
1
vote
1answer
55 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 ...
0
votes
1answer
64 views

qgis2web open file

I am using the qgis2web plugin and everything works fine. I created few point objects in a shapefile layer on the map in QGIS. What I want now is to add the possibility to open a (Excel) file when I ...
0
votes
1answer
20 views

Different Icon per feature with Leaflet Ajax

How can I have a circle marker or one of a selection of icons depending on a feature's properties using LeafletAjax? https://github.com/calvinmetcalf/leaflet-ajax function pointToLayer(feature, ...
1
vote
1answer
27 views

Toggling leaflet controls ON and OFF?

I want to toggle the Leaflet layer control when the user clicks in a button. var layerControl = L.control.layers( { '<i class="fas fa-map-marked"></i>': OSM, '<i class="fas ...
1
vote
1answer
45 views

Geting fitBounds and removeLayers to work in Leaflet

I am making a Leaflet map that gets its marker and popup information from a database. I have a dropdown that allows me to retrieve a subset of the entire database based on category. The drop-down and ...
1
vote
1answer
34 views

Icon inside the 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, ...
2
votes
1answer
11 views

Unable to pull a bts.dot.gov MapLayer using Leaflet in R

I'm trying to get the noise pollution layer from the following bts.dot.gov ESRI MapServer to render in R: https://maps.bts.dot.gov/services/rest/services/Noise/CONUS_road_and_aviation_noise/MapServer ...
0
votes
0answers
18 views

How do I call point marker icons from geojson data in leaflet

I am trying to make a map for school with unique icons for each point which I have stored in my geoJSON under "iconURL" as .png. I don't exactly know how to add them to my map. The following code ...
1
vote
2answers
71 views

Passing only coordinates on click “.ie. remove text” using Leaflet?

Below is my map script, everything is working pretty fantastic! However, when I click and it sends the e.latlng to the form it is sending LatLng(38.47939, -105.86426) for example. I would prefer ...
1
vote
0answers
39 views

Adding a position.watch and update feature to live map with leaflet.js?

I have an app working in node.js that locates a user and plots their location on a leaflet map. When others connect it shows them too. It keeps their marker live as long as they move the mouse. I ...
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 ...
1
vote
1answer
66 views

OpenCageData geocoder: automatically update place name on marker drag

I am using the combination of: OpenStreetMaps Leaflet.js Leaflet Routing Machine + lrm-tomtom plugin (routing done using TomTom API) and now I have decided to switch from Nominatim geocoder (which ...
3
votes
1answer
187 views

Why hybrid GIS application gets GPS position only from Google & not from the device

I have built a GIS application using Leaflet on the web, after I put this web application to run on Android as a hybrid GIS application I made the application work with offline basemap (offline usage ...
0
votes
1answer
22 views

Add a popup to leaflet but only on click

is there a way to add a popup to a marker but only show it when it is clicked? As it seems to be default to show it when one is loaded? This is no good when markers are getting updated? Currently ...