Hot answers tagged

4

The tiger-ny group contains a layer called giant_polygon which is coloured grey to make the background look "nice". If you want it to be transparent leave that layer out of your request.


3

When you store geometry in 'Multi' postgis types, geoserver also expects this 'Multi' in transaction query. Leaflet-WFST plugin can create Multi-geometry requests on simple geometries by option 'forceMulti', this option available since v2.0.1-beta.18 var wfstPoly = new L.WFST({ ... forceMulti: true ... }).addTo(map);


2

I achieved this animation using only CSS. See the following tutorial: https://css-tricks.com/svg-line-animation-works/#article-header-id-7 (Note: the tutorial covers other interesting line animations as well!) First of all add the class .animate to the routing line: var control = L.Routing.control({ waypoints: [ L.latLng(57.74, 11.94), ...


2

The way you figured it out, it is not possible. If you have the same overlay twice in Leaflet layer control, Leaflet does not distinguish between those two layers despite having different labels. There are several possible solutions to achieve what you want. One is to have two separate overlays, each with it's own style, but I know from your past questions ...


2

When Leaflet map is displayed in it's <div> element, map's size is calculated on the basis of the <div> element size at the moment the map is added. If element is hidden, as it is the case of Boostrap tab above, <div> element has no size and consequently map has no size when tab is displayed. Leaflet map has invalidateSize() method just ...


2

The file names of the cached tiles inside the GeoWebCache cache directories is not the usual z/y/x scheme. Tiles are spread along more directories (possibly in an effort to work nicer with the underlying filesystem). The file naming algorithm has been already implemented in several places, for example in https://github.com/kcl-ddh/leaflet-geowebcache-plugin/...


2

When you click, you call the function chart. Within this function you get the data from clicked feature e.g var feature = d.feature; var data = feature.properties.data; Then you set the div to prepare height and width for the chart and instanciate a svg element The code with var x = ... helps to calculate the width of each bar in the diagram by ...


1

Apperently I just used the wrong layer. I tried to do the same thing with a other layer and that one was png. I thought I could change the grey background to a transparrent background but I was wrong I changed my code From this: var wmsLayer= L.tileLayer.wms("http://localhost:8080/geoserver/nyc_roads/wms", { layers: 'nyc_roads:tiger-ny', ...


1

The CSV parser from omnivore expects by default comma separated fields with headers. These headers should contains columns named longitude and latitude. You may need to set the options to correctly read the CSV depending of the CSV source like below. omnivore.csv('data/lieux_culture_nantes.csv', { latfield: 'mylatitudefield', lonfield: '...


1

There's a missing "}" that is causing the error message, your initMap() function is not properly closed.


1

This is a javascript problem regarding object property accessors. So when you're doing this... popupContent += feature.properties + '.' + headers[h]; What you want is to access e.g. feature.properties.iata when headers[h] has the value "iata". And it's failing, because the code is doing string concatenation instead. The approach here is to read and re-...


1

You can use map's project method to get map pixel coordinate for the current map CRS at desired zoom. Then calculate diagonal bounding box points by offsetting projected overlay center coordinate, unproject those point back to lat,lng coordinates with map's unproject method and get bounding box with L.latLngBounds method. Code could then look something like ...


1

If you want to change fill color of L.circleMarker dynamically, you can use the setStyle method, inherited from the L.Path class. To change marker fill color to green: marker.setStyle({fillColor: 'green'}); The example you are referring to is for regular L.marker marker with user defined icon. It's also not politically correct since it uses internal ...


1

The only problem in your code is that you mixed up Leaflet version and OpenLayers version of sidebar-v2 plugin https://github.com/Turbo87/sidebar-v2. Documentation you are referring to has only example for OpenLayers, but not for Leaflet. Have a look at Leaflet example https://turbo87.github.io/sidebar-v2/examples/index.html. You have to remove references ...


1

As @nmtoken wrote in his comment, Leaflet uses [lat, lng] order for coordinate input, which is obvious even from method names, for example L.latLng. On the other side, standard GeoJSON has [lng, lat] order for coordinates (see https://tools.ietf.org/html/rfc7946#section-3.1.1). When you use Leaflet methods that are aware of GeoJSON input, Leaflet treats ...


1

When displaying map, Leaflet works with projected coordinates, but input parameters to it's methods and functions are always in unprojected coordinates, and this cannot be changed. If you want to use projected coordinates, you have to convert them to projected coordinates when passing them to Leaflet methods and functions. This can be done with crs ...


1

There are a couple of simple mistakes here and there. First, you're missing a comma in the data array, at the next-to-last line: [52.36962374757598, 4.877988696098328, "1047"], [52.379754808237486, 4.893186092376709, "690"] // ← Missing comma here [52.384764624206305, 4.883208274841309, "1567"] ]; Second, you're making a call to Array.prototype.map1 but ...


1

Leaflet.VectorGrid does not have out-of-the-box support for MapBox stylesheets as of today. There was some preliminary work done on that front, but never finished. The set of technologies that Leaflet.VectorGrid uses internally (an implementation over `L.renderer) is wildly different from the set of technologies that Mapbox.GL uses (creating GLSL shaders ...


1

I don't think this is possible (yet). GetFeatureInfo requests have not been integrated in r leaflet. This was an issue in the leaflet.extras package, but not (yet) implemented. See https://github.com/bhaskarvk/leaflet.extras/issues/84


1

I was having the same issue and I tried the fixZOrder() method, but sadly it did not order the Leaf markers for me as it doesn't seem to affect zindex of Leaflet markers. Seems like .bringToFront() works only on vector shapes which support this method, on the contrary to the Leaf markers I deployed rendering this solution unworkable, not to mention other ...


1

You can also float a crosshair image or character over your map using HTML and CSS. I'm using a plus sign in this example but you can swap that out for an image. calc(50% - 10px) works out to be 1/2 of the map div, minus 1/2 of the crosshair div. CSS: #crosshair { left: calc(50% - 10px); top: calc(50% - 10px); position: absolute; width: ...


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