Hot answers tagged

3

It seems like some kind of a bug. I didn't go into details why this happens, just found a workaround with modifying style. Instead of stroke weight 0, it gets weight 1. Since polygons overlap, this gives undesired effect at borders if opacity is 0.5. So opacity is set to one, but the whole GeoJSON layer opacity is set to 0.5 with the help of separate map ...


3

I'm gonna go with an approach based on Leaflet.GLMarkers, adapted from some of its demos with time-dependent symbols. It would involve the following vertex shader: attribute vec2 aCRSCoords; attribute vec2 aExtrudeCoords; uniform mat4 uTransformMatrix; uniform vec2 uPixelSize; varying vec2 vPixel; void main(void) { // Copy the input extrude coords to ...


2

If you would have looked in the contents of the response, you would see the following: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE ServiceExceptionReport SYSTEM "http://schemas.opengis.net/wms/1.1.1/exception_1_1_1.dtd"> <ServiceExceptionReport version="1.1.1"> <ServiceException code="...


2

What you want to do is called tooltip, which is displayed upon mouse enter and hidden upon mouse leave. Just use .bindTooltip method instead of .bindPopup. If you want tooltip to appear at the same place as popup (above marker): use tooltipAnchor: [0, -20] option when defining marker icon, use tooltip option {direction: 'top'} when defining tooltip. ...


2

L.WFS is extension of Leaflet L.FeatureGroup and so has no .redraw() method. A look at plugin source revealed .loadFeatures(filter) method that seems to work. And one more thing. Besides zoomend event you have to catch also moveend event for map panning. And since moveend event is fired also at each zoom in/out, there is no need for catching zoomend event. ...


1

There are two ways to achieve the behavior you want. One is to edit Leaflet.markercluster plugin code. The other way is to reopen popup after it's undesirably closed. Drawback of this method is that popup blinks and the whole method is a bit hackish, but it can be done relatively simply. That's how it goes: With the help of clustermouseover and ...


1

Instead of dragstart event, which is fired too late to prevent dragging, you can use mousedown event, which is fired early enough, so that .dragging.disable() method can be used to prevent dragging. Code could then look something like this: marker.on('mousedown', function(evt){ if (dragDisabled) evt.target.dragging.disable(); }); marker.on('mouseup', ...


1

The two plugins can be combined by using the same points source for both. Since you didn't describe the format/structure of your data, the example below uses [lat, lng, alt] structure for point. Code could then look something like this: var map = L.map('map').setView([46.2, 14.5], 8); var points = [[46.0, 14.0, 700], [46.3, 14.2, 950], [46.2, 14.4, 1250], [...


1

I try with this, but i don't know if update const getShapesLayerGroupRealTime = (idCliente) => { const shapesLayerGroup = new L.LayerGroup(); const realtimeReference = L.realtime( { url: ENDPOINT_DATA_GEOSERVICIOS, method: 'POST', body: JSON.stringify({ solicitud: 'shpCliente', idCliente: idCliente, ...


1

Problem is that while resizing window, resize events are continuously fired and new map.fitBounds requests interfere with the ones being executed. Solution is to use setTimeout to delay execution of map.fitBounds a bit and cancel execution if new request is issued while waiting. Relevant code could then look something like this: var timeoutId = null; window....


1

Leaflet and React, assuming nothing terrible happened, are pretty fast. I'd use the simulated 3G/mobile testing tools in Chrome or Firefox's dev tools to see if I could figure out where the bottleneck is. One general tip for apps like this is to make sure you've optimized the GeoJSON within an inch of its life. Use mapshaper.org to squeeze it down. You won'...


1

Leaflet controls ordering of layers with so called map panes, which are DOM elements, each having it's own zIndex. There are several default map panes where different layers go by default (see https://leafletjs.com/reference-1.7.1.html#map-pane). All markers go to markerPane which has zIndex value of 600. Since all markers go to one pane, marker add later ...


1

If I understand correctly, you want to: have the map set to fixed extent rather than panning and zooming to each selected polygon not having the selected group disappear when the user selects a different choice Please next time time provide a fully reproducible example (including data, e.g. the nc dataset that comes with the sf package); I'll assume your ...


1

Alternatively, you can use the geoman.io which works at the same basis as geojson.io.


1

Remove one of the layers from your map options var map = L.map('map',{layers: [l1]}).setView(center, 3); Leaftlet - Control.Layers Creation Note that all base layers should be passed in the base layers object, but only one should be added to the map during map instantiation


1

You can use the option bounds to filter. If set, tiles will only be loaded inside the set LatLngBounds. L.TileLayer and L.TileLayer.WMS are both extending L.GridLayer, so the same options can used: https://leafletjs.com/reference-1.7.1.html#gridlayer-bounds var nexrad = L.tileLayer.wms("URL.COM", { layers: 'LAYER_NAME', format: 'image/png'...


Only top voted, non community-wiki answers of a minimum length are eligible