Questions tagged [leaflet]

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

Filter by
Sorted by
Tagged with
1 vote
1 answer
13 views

Load WMS service into Mapbox map

I am able to add a WMS layer to a Leaflet map with very simple, readable code: var wmsURL = 'https://opengeo.ncep.noaa.gov/geoserver/klwx/klwx_bref_raw/ows?'; var wdgProductLayer = L.tileLayer.wms(...
user avatar
1 vote
1 answer
23 views

Update marker color or size when is clicked

I'm trying to highlight the current marker. Updating the size or color of the marker when is clicked. Example: https://jsfiddle.net/jodarove/e0mwk4qp This example has an array of positions (lat, long) ...
user avatar
0 votes
0 answers
38 views

Protect my GeoJSON in Leaflet

My GeoJSON map is published by Leaflet, how can prevent download from user who want to steal it? I'd taken long time to prepare GeoJSON and I want to preserve my effort. Any suggestion? Do I need to ...
user avatar
1 vote
0 answers
30 views

Leaflet Javascript: zoom to layer only on load

I have a WFS layer, updated in a loop, and I want the view to be centered on it only the first time the map is loaded; next, when the user moves the map or waits 20 secs, there is a movend function ...
user avatar
0 votes
1 answer
20 views

How to control picture size in qgis2web?

I have created a map and imported geolocated pictures. I have no issues with the map in QGIS it self all works great the pop-ups work great. My issue is when I export the map with qgis2web I get the ...
user avatar
  • 53
0 votes
0 answers
29 views

Adding/subtracting selected raster layers in Leaflet?

I need to visualize some raster images in a WebGIS and I am using Leaflet. Up to here all is good. Now I want to add/subtract selected raster layers in Leaflet. I have a LayerControl, but I don't know ...
user avatar
1 vote
1 answer
33 views

Leaflet.PolylineOffset Polyline drawing issue

I don't have much experience with Leaflet JS and I'm using Leaflet.PolylineOffset in order to draw a polyline around a polygon: L.polygon(coords, { fillColor: 'white', fillOpacity: 0.5, weight: 20, ...
user avatar
  • 197
1 vote
1 answer
57 views

Create custom legend control using L.ExtraMarkers.icon icons in Leaflet?

Is there any way I can add Leaflet Extramarkers to my legend? From what I googled, it seems I'll have to add an image of markers... however I was hoping I could use the ones I created. var Icon = L....
user avatar
  • 310
1 vote
2 answers
53 views

Leaflet.PolylineOffset Polyline with offset is drawn on the inside of a polygon

I'm new in Leaflet JS and I'm using Leaflet.PolylineOffset in order to draw a polyline around my polygon: L.polygon(coords, { fillColor: 'red', fillOpacity: 0.5, weight: 20, color: 'red', opacity: 0.5,...
user avatar
  • 197
2 votes
1 answer
22 views

Search for multiple attributes for single layer with Leaflet Search Control?

Edit: I am working on a project where I want to search through a GeoJSON, based on different attributes. To do this I am using leaflet-search plugin. I want to search through my single GeoJSON. That ...
user avatar
  • 310
1 vote
1 answer
30 views

Displaying French TopoJSON data in Leaflet

I am trying to display a TopoJSON file i took here : https://www.data.gouv.fr/en/datasets/contours-des-communes-de-france-simplifie-avec-regions-et-departement-doutre-mer-rapproches/#resources In ...
user avatar
  • 113
0 votes
0 answers
19 views

OpenStreetMap layers summary map image count

When we use any OpenStreetMap - Google tilelayer, 256*256 map images come. How many images in total are there for the whole of our world, with different zoom degrees?
user avatar
2 votes
1 answer
55 views

Multiple WFS layers in Leaflet, loaded with Ajax with bounding box, do not display correctly

The following example is a code for three WFS layers on Leaflet, loading only inside a Bounding box in order to save resources. Layers can be turned on in the Layer Control as featurelayer1, ...
user avatar
0 votes
0 answers
32 views

Leaflet stops loading tiles

I create a map such as L.TileLayer.CustomUrlLayer = L.TileLayer.extend({ getTileUrl: function(coords) { console.log("COORDINATES", coords); if (coords.x &...
user avatar
0 votes
0 answers
21 views

React Leaflet layer without attribution properties

how to get layer attributes with geojson? I try to get attributes from leaflet layer, but layer does not currently contain data in e.target when i try click to Polygon. import React , { useState, ...
user avatar
0 votes
0 answers
22 views

Leaflet get map coordinates to outside of map click event function

Is there any way to get coordinates values outside of the map click event function? var x_array = []; map.on('click', function (e) { let latlng = map.mouseEventToLatLng(e.originalEvent); var x = ...
user avatar
1 vote
1 answer
35 views

Leaflet js add polygon with offset around another polygon

I am pretty new in working with Leaflet js and I have a polygon var coords = layer.getLatLngs(); L.polygon(coords, { fillColor: 'red', fillOpacity: 0.5, weight: 20, color: 'red', opacity: 0.5, fill: ...
user avatar
  • 197
-2 votes
0 answers
21 views

How to make a transparency bar for vector layers [closed]

I want to make a transparency bar for my polygon vector layer. colores <- c("#4DAF4A" , "#B2FFFC", "#FFFF33") c_zona <- levels(as.factor(cuadrantes$nomb_zona)) ...
user avatar
0 votes
0 answers
21 views

Leaflet WFS: change marker according to kind [closed]

I'm succeeding in showing a marker: var popup = new L.Popup(); var wfstPoly = new L.WFS({ url: 'http://localhost:8080/geoserver/ows', typeNS: 'worldmap', typeName: 'tracks.debra.steps',...
user avatar
1 vote
0 answers
31 views

Isolated marker won't be displayed when filters are applied to be the single one amongst nearby clusters

I have markers all around the world, thousands of them. In some areas more close to each others, in other areas some even have a number of countries between them. Let's take the SINGLE marker in ...
user avatar
  • 11
2 votes
2 answers
31 views

Saving "on mouse click" created markers to be available after reloading the browser in Leaflet?

I have found that when I manually add a marker, the marker stays on the map even after reloading the browser page. Example: var marker = L.marker([51.5, -0.09]).addTo(map); However, all of my markers ...
user avatar
  • 21
1 vote
2 answers
42 views

Leaflet WFST style the markers

I am working on the point data. I have managed to display the data using the WFST leaflet plugin. var univ = new L.WFS({ url: 'http://localhost:8080/geoserver/HEC/wfs', typeNS: 'HEC', ...
user avatar
  • 310
1 vote
0 answers
33 views

Leaflet unit-testing - layer removal (jest)

I want to test if FeatureLayer is removed from the map instance, but somehow instead of expect(removeCallCount).toBe(1) I have 0. What can be the problem? test("FeatureLayer removes itself from ...
user avatar
1 vote
1 answer
34 views

Query GeoServer WFS layer attributes with form

How can I set up a form in HTML to query the attributes in my GeoServer WFS layer? I assume it has something to do with the action attribute but I'm not sure how it will work. Something like <form ...
user avatar
  • 11
1 vote
0 answers
24 views

Leaflet toolTip-display is a function of layer order

My map creates 3 Leaflet GeoJSON layers representing state, county, and town features collections. Each feature (in each layer) is bound to a tooltip by the onEachFeature option. The toolTip displays ...
user avatar
  • 31
0 votes
0 answers
15 views

Leaflet: Illustrate distance along path, like "measure distance" in Google Maps

In a map in a web application, I would like to illustrate distance along a path, like how it is done with the measure distance tool in Google Maps (see attached image). Is there a way to do this in ...
user avatar
0 votes
0 answers
38 views

GeoServer Geofence WKT WFS problem

I have more than 400 users, each has its own layer view area on the map, I was able to implement this using Geofence, I added layers to the layer group in GeoServer, and configured roles in Geofence ...
user avatar
  • 11
1 vote
1 answer
45 views

WMS GetFeatureInfo in Leaflet to get selected polygon

I'm using Leaflet with WMS layers served by GeoServer. The layers are displayed correctly on the map, also over a OSM background. I want to catch the user click on the map and by using the X-Y ...
user avatar
0 votes
1 answer
36 views

Generating a bounding box for leaflet is inaccurate

I am trying to generate a bounding box for an image with Leaflet, based upon 3 criteria: Starting Latitude and Longitude (the center of the bounding box) My value for this is 38.9761, -77.4875 ...
user avatar
0 votes
0 answers
24 views

How/where to add script to enable pan/zoom and information pop-ups to storymap

I haven’t work with HTML/JavaScript and Leaflet maps for at least two years and I am attempting to create a storymap (non-ESRI) using a template that I located on GitHub. It has most of the ...
user avatar
0 votes
1 answer
27 views

Leaflet, L.WFST : show a Popup for the attribute

could you please help me on this ? It's not showing the Attribute in Bindpopup of a map in Leaflet with this Javascript: https://mappingforyou.eu/javascript/leaflet-wfst.src.js function onEachFeature(...
user avatar
0 votes
0 answers
35 views

GeoServer WMS mastermap zoom issue on Leaflet

I have a master map consuming it from the PostGIS database via GeoServer. As per understanding if we create a GeoServer layer from PostGIS db then that layer automatically is treated as WMS. But the ...
user avatar
  • 43
1 vote
0 answers
44 views

Leaflet t.addlayer not a function

I am trying to implement the leaflet-panel-layer plugin and customize the included overlay to my needs. The original code uses a geojson formatted as js and I use a basic js marker list (which I load ...
user avatar
  • 21
1 vote
1 answer
50 views

Apply layer control to custom markers in a Leaflet map

I have a Leaflet map with custom markers. Recently I added Layer Control so that I can make use of a legend to filter the markers. I've managed to add the legend however it appears to recreate all the ...
user avatar
  • 113
1 vote
0 answers
17 views

TypeError in showResult for leaflet-geosearch

I'm using leaflet-geosearch. When I click on an address from the search bar, I get the error: Uncaught (in promise) TypeError: Cannot convert undefined or null to object at Function.keys () at ...
user avatar
1 vote
0 answers
38 views

Custom Layercontrol Overlay Leaflet / React Leaflet [closed]

I am new to React Leaflet and have some experience with Leaflet. Now I am trying to build a custom Overlay to manage the markers in my map, and came accross this example which seems to be perfect for ...
user avatar
  • 21
0 votes
1 answer
38 views

Load Leaflet ImageOverlay with center point instead of corners

I have an image file that I am able to overlay perfectly fine onto my Leaflet map with this code: var initLat = 38.9761; var initLon = -77.4875; var imageUrl = '/weather/nexrad/radar.png'; var ...
user avatar
1 vote
1 answer
37 views

Leaflet.js: draw objects into PostGIS database, through Leaflet.draw, WFS-T plugin, GeoServer

I'm trying to draw objects from Leaflet (Leaflet.draw) into a PostGIS database. From https://www.npmjs.com/package/leaflet-wfst it's the Flexberry one if I'm right I enabled JSONP in GeoServer, I ...
user avatar
2 votes
1 answer
63 views

Place tiles in Leaflet map

I use leafletjs to make a interactive map. I have a fixed list of URLs to use and I can not change the URLs. I want to make a map with those tiles always in the same place and in the place I want them ...
user avatar
1 vote
1 answer
56 views

Changing label position based on circle marker radius in Leaflet?

I have a circle marker var circle = L.circleMarker(latLngCoords, { radius: 5, weight: 1, color: 'black' }).addTo(map); that changes the radius based on the map zoom: map.on('zoomend', function (e) { ...
user avatar
  • 197
0 votes
1 answer
32 views

Is there a limit on the number of polygons shown by GeoJson on Leaflet?

I have 15,811 block groups of Texas converted as GeoJson. I am trying to show them using Leaflet.js. Surprisingly when I use all block groups, I cannot show them on index.html. What I get is the ...
user avatar
  • 28
0 votes
1 answer
26 views

Leaflet Ruler check if the ruler is in use

I don't have much experience with Leaflet and I'm using the ruler from here. I'm trying to find out if it's in use when the map zoom changes. var rulerOptions = { position: 'topright', ...
user avatar
  • 197
0 votes
1 answer
50 views

Using Leaflet.motion plugin on geometry returned by WFS service?

I'm back with my Leaflet.motion service because I'd like to link it to an existing WFS service for easier and live updating. The Javascript plugin for WFS and Leaflet motion are: <script src=&...
user avatar
2 votes
2 answers
86 views

Changing marker icon on click and then back to original state when click elsewhere in Leaflet?

I'm trying to get this function on my custom Leaflet map https://rodadagua.netlify.app/ I've found some very close examples and questions on here but being a complete novice unfortunately I have no ...
user avatar
  • 25
0 votes
2 answers
215 views

Using GeoJSON as input to leaflet.motion plugin in Leaflet

I'm interested by the script Leaflet motion. I tried to update the code to add a custom GeoJSON created from QGIS or any tool. But the current error is : leaflet.motion.min.js:9 Uncaught TypeError: ...
user avatar
1 vote
1 answer
68 views

Adding GeoJSON layer to a Layergroup so that it shows as radio button in layer control?

I want to display both the basemaps and the overlaymaps with radio buttons in my LayerControl. I tried this via Layergroups and ran into some difficulties there. I have two GeoJSON layers that get ...
user avatar
0 votes
0 answers
48 views

Deselecting features when zooming to certain zoom-level in Leaflet

I am currently setting up a Leaflet map. I have a GeoJSON-layer and I filter it at a certain Zoom-level. So when I zoom out all of Europe is showing and when the Zoom-level is greater than 10 some ...
user avatar
1 vote
1 answer
71 views

Adding labels to first and last joint in polyline using Leaflet

I am new to Leaflet, I am currently trying to add two labels, at the first and last joint of my GeoJSON polyline. I tried to open tooltips directly on map and adding markers with coordinates and a ...
user avatar
  • 271
0 votes
0 answers
41 views

Display features OSM buildings

Using Leaflet, I've installed OSMBuildings, yet I'm unable to display buildings features although it's allowed on https://osmbuildings.org/ It seems like there is a latitude and longitude once we ...
user avatar
  • 1
0 votes
1 answer
42 views

Access WMS server error message in Leaflet TileLayer.WMS

I am loading WMS maps using react-leaflet's WMSTileLayer. Depending on the layers loaded, the image appears or not. When the image is not loaded, I have found that Leaflet returns a bunch of tile ...
user avatar
  • 145

1
2 3 4 5
77