New answers tagged

1

Instead of creating a convex hull over a set of points with the same attributes, create a Voronoi tesselation of all points, then merge the Voronoi polygons of those points with the same attributes. There are lots of ways to process the information you may have, and what I just said is one idea on how to do it. Voronoi + merge might create multipolygons, ...


0

According to the answer here, Leaflet doesn't "remember" what and whether a layer was filtered, so you need to reinitialise the layer when your filter changes. Something like this... You'll need to store your data somewhere, and you'll need to call the function from your init function with the default value. (BTW if you're going to have more than two ...


1

This is perfectly explained in the Leaflet API reference for map options.


0

uses this modified method: getFeatureInfoUrl: function (latlng) { // Construct a GetFeatureInfo request URL given a point var point = this._map.latLngToContainerPoint(latlng, this._map.getZoom()), size = this._map.getSize(), crs = this.options.crs || this._map.options.crs, sw = ...


0

Your code contains: &CQL_FILTER=user_id=1 And I will guess that the two =s are messing up the URL. In Leaflet WMS tilelayers, any extra options which are not defined will be passed to the WMS server as parameters in each request URL, so: var layer = L.tileLayer.wms( 'http://my_wms_adress:8080/geoserver/my_location/wms', { ...


1

The Leaflet way: L.map('map', {attributionControl: false, etc...}) A simple $('.leaflet-control-attribution').hide() or non jQuery document.getElementsByClassName( 'leaflet-control-attribution' )[0].style.display = 'none';. Vladimir himself says it's OK to remove it: https://groups.google.com/d/msg/leaflet-js/fA6M7fbchOs/JTNVhqdc7JcJ, but it seems like ...


1

Scale dependent rules need to be applied via min/max scale denominators. https://github.com/mapnik/mapnik/wiki/MinScaleDenominator Converting mapnik scales to map scales requires a conversion. The table below is a good start http://wiki.openstreetmap.org/wiki/MinScaleDenominator My example ended up working with something like below <Rule> ...


1

I know this question is really old now, but if anyone get the same problem as he got, maybe this could be helpful ! Your piece of code seems to be good in theory. As I used arcGIS/Leaflet in exactly the same way. But yea, problem could come from missing spatial reference (or maybe incorrect format (image/png or image/jpeg). For the spatial reference, here ...


1

As per @IvanSanchez' suggestion I'm going g to have web-ready 8-bit rasters with accompanying json metadata files. The metadata files have max and min values from the original 32-bit rasters which we use to interpolate the 0-255 values from the 8bit rasters so we can explore the values in real time.


1

You do realize that your tutorial for "featureOver" makes you superimpose a new layer / feature above your track. Therefore, the latter can no longer be clicked on. You could either implement your "featureClick" listener on the added layer / feature as well, so that it opens your sidebar. Or you could rather change the display properties of the ...


3

You can initialize your Borne geoJson layer without any data but with a styling function specified in the options: var Borne = new L.GeoJSON(false, { style: function (feature) { return {color: feature.properties.color}; } }); This style will be applied to any data you add later with addData.


0

You can use the show() (the sublayer you have clicked on) or hide() (the rest of the sublayers) methods as explained in this tutorial.


1

You can set the line color based on the length value with: layer.setStyle({ color: 'red' }); And you can use a function to determine that color based on then length of the line var determineColor = function(length) { if (length > 4000) { return 'red'; } else if (length > 2500) { return 'orange'; } else if (length > 1500) { ...


0

Clustering can help. See https://github.com/SINTEF-9012/PruneCluster Here a 50000 marker example http://sintef-9012.github.io/PruneCluster/examples/realworld.50000.html


0

You can access Leaflet's internal layer id using L.stamp and set the color of the polyline by changing its .options.color property. To log the properties to the console each time the layer is edited, you will want to listen for the edit event: map.on('draw:created', function(e) { console.log('Layer created: ' + L.stamp(e.layer)); ...


0

Your "missing tiles" are really errors from the server. Normally, when you ask a WMS server for an image, it will reply with an image. But sometimes, if you hit the kartverket servers a tiny bit too quickly, a tiny bit too hard (as you're doing when panning the map too fast), the server will reply with: <?xml version="1.0" encoding="ISO-8859-1" ...


3

Basically you just need a PHP script that acts as a middle man and does the fetching for you, then returns what it gets directly to the client. I converted your JS snippet above into the relevant parts below. Notice that the url in your Leaflet tileLayer example has been changed to a PHP endpoint with URL parameters: ?s={s}&z={z}&x={x}&y={y} ...


3

I've solved ... doing a search on the web I've found that the problem was about the layer's zIndexes and that there is a UNDOCUMENTED (!!???), feature that solve the problem ... Here you're a couple of useful links: http://www.wjst.de/blog/sciencesurf/2015/08/leaflet-js-layer-order-layer-address-and-links/ ...


1

CartoDB.js includes Leaflet already, so it's possible that you have some conflicts there. You can use this URL to get CartoDB.js without Leaflet included: http://libs.cartocdn.com/cartodb.js/v3/3.15/cartodb_noleaflet.js


1

Building your own solution might actually not be as hard as you think. All you would have to do is register a moveend event and then call getBounds() or getBoundsZoom() (in case the zoom level is important). Then you send this extent to your database and query all the points that fall within it. Of course you need a database that understands geospatial ...


0

You can remove the labels with removeLayer(label) when the popup appears and add them to map again when it closes.


1

In your first case, you're adding Marker objects iteratively to your MarkerCluster. In the second case, you are just giving a list of coordinates, but not Marker objects. Convert your locations list first: locations = [folium.Marker(l) for l in locations] This is incorrect advice, see comment and the MarkerCluster source.


2

your sample is working fine for me. if you're having trouble clicking on point features, consider calling tolerance() and passing in a number of screen pixels greater than the default value of 3. that being said, you are not limited to working with L.esri.dynamicMapLayer in order to get a reference to the symbology defined by the service itself. when ...


1

Though all the examples on the Leaflet.Photo plugin page involve getting data via an API, all you really need is an array of objects with the latitude, longitude and URL(s) for each image. For example: var photos = [{ "lat": 34.04555452, "lng": -118.3001509, "thumbnail": "http://www.mydomain.com/photo1_thumb.jpg", "url": ...


0

Here is the updated section of your fiddle. Remove the zoomToFeature function and replace with stateLink. If you have the urls stored with the data, you wouldn't need to do this. Would just assign urlLink to e.target.feature.properties.whateverfieldholdstheURL function stateLink(e) { // console.log(e.target.feature.properties.name); var urlLink; ...


1

It appears that the tiles are not showing up because they do not exist. If you look at the console output or network traffic log, you will see that 403 (Forbidden) errors are being produced for all tiles above zoom level 14 in this area (in other areas, there is data for zoom levels up to 16) as well as any tile that does not contain data. Even on the ...


0

i can reproduce the behavior and this looks to be a bug in leaflet-virtual-grid 1.0.3. based on my own testing, the problem is resolved in the master branch of the library. i'll tag 1.0.4 shortly and ensure that the dependency is rolled into our next release of esri-leaflet on the cdn in the coming days. we already needed to push something out to fix that ...


1

1) The OSM Layer (that is, the one named osm) is added to the map, but because you have added the Mapquest layer (the one named openstreetmap) as well, the osm layer is hidden beneath it. And because you haven't added osm as one of the basemaps in your layer control, you have no way to turn off the other layers and reveal it. 2) The precipitation layer ...


0

Never mind, just discovered the refresh() method. lol #bonehead Edit: This does not work in all my scenarios, however. When I perform a query, the search results are added via a separate layer and zoomed to bounds. If the feature layer is already visible, it works as expected. But if I activate the layer after the search has taken place, the layer does not ...


1

You will have to dump that tiff file (or whatever) into a <canvas> and read the values of whatever pixels you want. Be aware of cross-origin issues. Do read: https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Using_images https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Pixel_manipulation_with_canvas


0

Assuming you have a line like var crs = new L.Proj.CRS("EPSG:27700", ...); and you get the click event's latlng = e.latlng, then you could do: var WIDTH = map.getSize(map.getZoom()).x; var HEIGHT = map.getSize(map.getZoom()).y; var X = map.latLngToContainerPoint(latlng, map.getZoom()).x; var Y = map.latLngToContainerPoint(latlng, map.getZoom()).y; and ...


2

See the list of Leaflet plugins for vector tiles. Note that MapboxVectorTile and hoverboard work only with Leaflet 0.7.x, which will be deprecated by Leaflet 1 "Really Soon™".


1

EDITED to include Leaflet 1.0 example: In Leaflet 0.7x, this is made easy with the Leaflet.MapboxVectorTile plugin. You just need to specify the URL pattern in the url configuration option. The plugin documentation details the other configuration options that are available. To add the Mapillary data, you would use it like this: var config = { url: ...


0

Wanted to make a comment, but I don't have any reputation! Your JsFiddle is great Jürgen but I needed a little more fonctionality, and know I want to share. Added: Better pan (even if not zoomed) Icon changing on div click Marker open on div click and on Icon click Hope that helps somebody: http://jsfiddle.net/BeniBoy/aeas62mh/1/


2

Though I used Leaflet in my webGIS application, OpenLayers has much more advantages over Leaflet. For example if you want to use your application in mobile devices, OpenLayers is a must for the time being. There are lots of resources related with OpenLayers, however I think developing application with Leaflet is easier than OpenLayers (it is easier to read ...


3

I can confirm that, as you've reported, this appears to be a real bug in both 0.7x and 1.0x (on Chrome, at least; I haven't tested it elsewhere). However, there is a workaround that seems to prevent it. If you name your click event listener function, you can turn it off on dragstart, then use setTimeout to turn it back on a short time after dragend: ...


4

The L.GeoJson class has a built in filter option that you can use to filter your data. Just pass it a function that will return true for the features you want to show: var picnic_parks = L.geoJson(myJson, {filter: picnicFilter}).addTo(map); function picnicFilter(feature) { if (feature.properties.Picnic === "Yes") return true } Here is a fiddle with a ...


1

Yes, there is a plugin for that.


2

Follow the map panes tutorial and create an explicit separate pane for the labels.


1

Problem was that for the container to be created, first you have to add the control to the map. var mapbuttons_div = L.DomUtil.create('div', 'mapbuttons leaflet-bar leaflet-control'); var zoom = L.control.zoom( { position: 'topleft' } ); zoom.addTo(map); mapbuttons_div.appendChild(zoom.getContainer()); // works


2

It's free but you will have "only" 50,000 map views / mo, or 50,000 mobile users / mo More infos here: https://www.mapbox.com/pricing/#


1

I'm having a hard time understanding your exact question, but it is certainly possible to mix and match esri-leaflet with other leaflet plugins. you can find an example that mashes up with Leaflet.Elevation here: http://johngravois.com/esri-leaflet-gp/elevation.html https://github.com/jgravois/esri-leaflet-gp/blob/master/elevation.html edit 5/1/2016: it ...


0

The Array.prototype.filter method is really slow. In cases where you can rely on an array being predictably formatted (as is presumably the case with CSV data returned from Papa), you are better off just using a for loop to iterate over it yourself. Here is a function that takes the GeoJSON feature properties, Papa Parse data, and a join field name as ...


0

Google map custom styles do work in leaflet. I would also suggest tangram by mapzen. It's similar to mapbox custom styling.


1

Just to add to Nathan's response, leaflet also doesn't store the tiles, it simply accesses them after it calls the REST imagery metadata service when the map loads to generate a Bing Maps transaction. This is inline with the terms of use of Bing Maps. I have a document that outlines this process here: ...


0

You can remove a layer holding the markers, then you could turn them on again. Is that what you are thinking?update of your fiddle. Just make sure to add each marker to the layer Group, not the map. L.geoJson(geojsonFeature, { pointToLayer: function(feature, latlng){ marker = L.marker(e.latlng, { title: "Resource Location", ...


1

Use L.Control.Layers.addOverlay() and L.Control.Layers.removeLayer().


0

No 'Access-Control-Allow-Origin' header is present Well, there's your problem. You need to enable CORS on GeoServer. CORS is somewhat tricky, and enabling it will depend on your installation of GeoServer, and any HTTP proxies you might be running.


1

Try this: var FilterWMSlayer= L.tileLayer.wms("http://Server.com/geoserver/Workspace/wms", { layers: 'Workspace:Layer', format: 'image/png', transparent: true, CQL_FILTER:'NAME=Leeds' }); EDIT In case you want to query more params: CQL_FILTER:'param=value&param1=value1&...' EDIT 2 I've updated your ...


2

One option is to use Proj4Leaflet to read the projected GeoJSON. If you have a variable called sampleProjected referencing your GeoJSON (and assuming you are using a projection that is defined in Proj4, as EPSG:3857 is), you could just add it like so: L.Proj.geoJson(sampleProjected).addTo(map); Here is an example comparing your projected data (in blue) ...



Top 50 recent answers are included