New answers tagged leaflet
0
votes
Leaflet js add polygon with offset around another polygon
One possible way to solve this is to actually use Leaflet.PolylineOffset plugin, with slight modification of plugin code (only one line):
.
.
.
joinLineSegments: function(segments, offset) {
var ...
0
votes
Accepted
Leaflet WFST style the markers
Additionally, in case this helps someone else too, you can add this line right after the "case Public" and "case Private" lines:
default: return L.marker(latlng,{icon: L....
2
votes
Saving "on mouse click" created markers to be available after reloading the browser in Leaflet?
As @Keagan Allan pointed out in his answer you have to somehow save info about newly created markers to be available during page reload/refresh. You can use browser session storage for that, using ...
0
votes
Saving "on mouse click" created markers to be available after reloading the browser in Leaflet?
My understanding of Leaflet and Javascript is limited, but you will will need to store the map clicks for the markers in a local datastore, such as a GeoJSON file and load that GeoJSON every time you ...
0
votes
WMS GetFeatureInfo in Leaflet to get selected polygon
I was finally able to achieve the desired result, using a different approach.
Instead of using the geometry data given back from the WMS GetFeatureInfo call to build up a layer using the L.GeoJSON() ...
2
votes
Leaflet WFST style the markers
So I solved it. For the L.WFST point feature, you need to pass two arguments: the options and a GeoJSON which you can use to style the marker. So the code now looks like this:
var univ = new L.WFST(
...
2
votes
Accepted
Leaflet, L.WFST : show a Popup for the attribute
L.WFST layer fires a click event. Use that to create a popup. The code should look something like this:
var popup = new L.Popup();
var wfstPoly = new L.WFST({
url: 'https://mappingforyou.eu/...
0
votes
Query GeoServer WFS layer attributes with form
I think the best way is to send the form is through JavaScript, something like below,
$("#formElement").on("click", function () {
var wfsLayer = L.Geoserver.wfs("http://...
1
vote
Accepted
Apply layer control to custom markers in a Leaflet map
Since you are adding your markers to groupA, groupB and groupC layers and also to GeoJSON layer that uses the same data from mygeojson GeoJSON object and all these layers are added to the map, it's ...
1
vote
Generating a bounding box for leaflet is inaccurate
Looking at geolib you can use built-in function:
var startPoint = { latitude: 38.9761, longitude: -77.4875 };
var distanceMeters = 460000;
// Returns an array with the southwestern and northeastern ...
0
votes
How to create leaflet legend for points
In case if still kielni solution wont work, then change stylesheet at following:
.legend .circle{
border-radius: 50%;
width: 10px;
height: 10px;
margin-top: 8px;
display: inline-block; // ...
0
votes
Load Leaflet ImageOverlay with center point instead of corners
I think I have found a solution for now. I have tried many things, including some math to find the correct bounding box, I have tried turf.js, all to no avail.
I eventually had the idea to set the ...
1
vote
Accepted
Leaflet.js: draw objects into PostGIS database, through Leaflet.draw, WFS-T plugin, GeoServer
At this point of the research, what was necessary was to
globally allow WFS transactions in Geoserver for all workspaces
and then in
Security > Data Security , allow only ADMIN to write in the ...
3
votes
Accepted
Place tiles in Leaflet map
Reading the Leaflet tutorial on extending L.TileLayers will teach you how to hook custom functions to get the tile URL from the tile coordinates, so please do so (if you haven't already).
For your ...
0
votes
Accepted
Is there a limit on the number of polygons shown by GeoJson on Leaflet?
Well, I believe I found a solution. The only thing I could think of was the fact that my layer in ArcPro had a symbology! I removed the symbology which specifically was coming from a cluster analysis ...
0
votes
Accepted
Changing label position based on circle marker radius in Leaflet?
Simple way of achieving what you want would be using permanent marker tooltip for marker label, with horizontal offset equal to marker radius. Upon zoomend marker tooltip is redefined with new offset.
...
1
vote
Accepted
Using Leaflet.motion plugin on geometry returned by WFS service?
L.Geoserver.wfs is async method, so any data in wfsLayer is accessible only after layer is loaded. L.Geoserver.wfs is extension of L.FeatureGroup which means it fires layeradd event after layer is ...
0
votes
Accepted
Leaflet Ruler check if the ruler is in use
Looking at the internals of the leaflet-ruler plugin, there is property ._choice set to true when control is active. Property ._polylineLayer points to feature group containing already drawn measuring ...
1
vote
Accepted
Changing marker icon on click and then back to original state when click elsewhere in Leaflet?
Solution below is based on assumption that each marker will have a popup that opens upon marker click.
Logic goes as follows:
when marker is clicked, popup opens and marker icon is changed;
when ...
0
votes
Accepted
Adding GeoJSON layer to a Layergroup so that it shows as radio button in layer control?
Leaflet control L.control.layers has no option/possibility to have radio buttons for overlays, but you can listen to map's overlayadd and overlayremove events and hide currently selected overlay when ...
0
votes
Changing marker icon on click and then back to original state when click elsewhere in Leaflet?
You could have a script that changes all markers back to default and call that before you change your clicked marker.
map.eachLayer(function(layer) {
if( layer instanceof L.Marker ) {
layer....
0
votes
How to update a popup content from its marker?
marker5.bindPopup(html).openPopup();
var html = `
<div class="popup-box">
<div class="title">`+title+`</div&...
3
votes
Accepted
Using GeoJSON as input to leaflet.motion plugin in Leaflet
All you have to do is extract line string coordinates from geoJsonData and store them in some array, let's say dataCoords, and flip coordinates while doing that, since Leaflet expects [lat, lng] ...
2
votes
Using GeoJSON as input to leaflet.motion plugin in Leaflet
remove the following line.
var Json2 = JSON.parse(geoJsonData)
JSON.parse extracts a dictionary from a string. Thus you do not need it here.
Edit:
To your new inquiry here's another approach. (Tested)
...
0
votes
Accepted
Adding labels to first and last joint in polyline using Leaflet
Your tooltips and markers are shown, but at the wrong location. Zooming out enough you would see them. Reason for this is that Leaflet for the input to it's methods/functions expects [lat, lng] order, ...
Top 50 recent answers are included
Related Tags
leaflet × 3835javascript × 866
geojson × 700
geoserver × 233
wms × 186
markers × 186
mapbox × 167
popup × 154
web-mapping × 145
openstreetmap × 129
leaflet-draw × 121
r × 112
coordinate-system × 111
layers × 101
postgis × 100
html × 98
qgis × 96
esri-leaflet × 89
tiles × 86
jquery × 81
json × 79
carto × 77
polygon × 70
clustering × 66
wfs × 64