Tag Info

New answers tagged

0

the showFeature function that you attached to click event receive a MouseEvent object as argument. To get the layer from a MouseEvent object, you can use its target property. And if the layer was created using geojson,then that layer has a property call feature with the data. try this: function showFeature(e) { var layer = e.target; var feature = ...


2

You just need to change the code a little bit. Look at this function that adds the listeners: function onEachFeature(feature, layer) { layer.on({ mouseover: highlightFeature, //you need to change this mouseout: resetHighlight, click: zoomToFeature }); } geojson = L.geoJson(statesData, { style: style, onEachFeature: ...


1

I think you are approaching the problem the wrong way. You can't load a gigantic dataset and expect fast interactivity. If you've already simplified as much as you want, and it's not fast enough. Try a different technology. If you're not happy with TileJSON, use CartoDB or MapBox to to it for you, or use WMS for viewing and WFS for interactivity. Or load ...


0

I'm not aware of any solutions that render on the client, but you may be interested in geotrellis, which could handle a lot of the required functionality on the server.


0

Leaflet appears to be focused on GeoJSON and tiles. You would need to put your raster data in GeoJSON format along with lon lat information. Depending on the size of your raster data pixel count, one large GeoJSON file with all the weather data could swamp a web browser's memory. You have to have some way of working with a bounding box of the data either ...


0

It is as simple as to add properties field to the Geojson with the simple style specifications "properties": {"fill": "#B10001","fill-opacity": 0.2,"stroke": "#B10001", "stroke-opacity": 1,"stroke-width": 2,"title": "Ãrea del Incendio"}


0

I came back to this a year later and was able to solve it easily. I stored the current markers ID property in an array. Whenever the GeoJSON is requested the L.GeoJSON filter is used to check if the ID property of each incoming marker is in the array, returning true or false depending. When new GeoJSON is added, the markers in a GeoJSON group layer are ...


0

I think what you are after is an overview map. There is a plugin for leaflet that provides this functionality that cab be found here : https://github.com/areichman/leaflet-overview


0

Sublayers are not leaflet layers as you say. CartoDB sends all the layers merged in a single tile so you can't manage them using leaflet controls. You have two solutions here: create your own layer selector (or extend leaflet one) in order to use show/hide for each sublayer use createLayer 4 times creating a single leaflet layer for each sublayer


2

To change point markers, you should use the pointToLayer function. See the example page. var geojsonMarkerOptions = { radius: 8, fillColor: "#ff7800", color: "#000", weight: 1, opacity: 1, fillOpacity: 0.8 }; L.geoJson(someGeojsonFeature, { pointToLayer: function (feature, latlng) { return L.circleMarker(latlng, ...


1

Interrupting a rendering process is not possible in Leaflet since it is performed in a single atomic JS job (AFAIK). The only way to make your app more responsive to user interactions might be to boost the rendering process so that it completes faster. Simplifying the geometries (or using topojson) is an excellent first solution for that. Another one could ...


2

I think that this will not work from your desktop, but needs to be uploaded to a server. These lines in L.Routing.OSRM.js 23 L.Routing.OSRM = L.Class.extend({ 24 options: { 25 serviceUrl: '//router.project-osrm.org/viaroute', 26 geometryPrecision: 6 27 }, are getting file:// appended to the front ...


1

http://leafletjs.com/examples/geojson.html Filter The filter option can be used to control the visibility of GeoJSON features. To accomplish this we pass a function as the filter option. This function gets called for each feature in your GeoJSON layer, and gets passed the feature and the layer. You can then utilise the values in the feature's properties to ...


1

It turns out to be really simple, because TileMill supports scaling features. L.tileLayer('http://example.com:20008/tile/MyMap/{z}/{x}/{y}.png' + (L.Browser.retina ? '&scale=2': ''), { detectRetina:true }).addTo(i); There are three parts: L.Browser.retina tells you there is a retina display, which you use to... request scaled map tiles ...


0

I've written this, still work in progress http://gee.chalo.org.uk/Gee/Eric.html?databaseName=gtfs I have lots of stop icons, which are the little blue squares. If you pan out (assuming you are getting something) you should see black lines, which is the composite route map which takes a while to fetch, with what are obviously stations as they are vertices, ...


1

Solved this by using calculated X & Y instead of using generated from leaflet provided function layerPointToContainerPoint Giving Wrong X & Y var X =map.layerPointToContainerPoint(e.layerPoint).x.toFixed(0); var Y = map.layerPointToContainerPoint(e.layerPoint).y.toFixed(0); Correct X & Y from calculation var bds = map.getBounds(); ...


0

See example Overpass API&MarkerCluster on https://github.com/binaworks/osmtagviz or https://github.com/stork-map/stork-map.github.io (http://stork-map.github.io/#6/48.611/31.674)


0

We face an issue when you have xls/xlsx files in your layer list. A friend of mine found this bug. If you're using the xls to show some points, export the resulting points as a shapefile and add it back to your qgis project. remove the xls document from your layer list. It also works when you uncheck your csv/xls whatever table layer you have, so this will ...


0

This is also an answer - you can use the appendTo function: $("#source") .appendTo("#destination"); I found the answer here on Stackoverflow:


0

I would try to use the tilestache-seed.py script: https://github.com/TileStache/TileStache/blob/master/scripts/tilestache-seed.py You can get the bounds of your parcel (which units depend on the units of your data) and pass it into the script. use the '-x', '--ignore-cached' options to force the tiles to be regenerated. Since your data is coming from ...


0

The reason for the delay was because of the angular $apply digest cycle. Angular basically wasn't aware of the changes to hoveritem. Wrapping it with $scope.$apply did the trick: $scope.$apply(function () { $scope.hoveritem = layer.feature.properties.id; })


0

AFAIK non of the current JS webmap toolkit support cartograms. The heavy load of vector transformation etc. might be a reason. If you need it live/interactive you might choose an heatmap instead. Otherwise you might want to give QGIS/R/... or other renderers a try to calculate/render an WMS layer and embedd it to Leaflet/OpenLayers.


1

There is no ready to use tool available, but I think it's not that difficult to implement you own tool by using any of the three library. For example in OpenLayers, I think you can create a DrawComplexShape control, it can be extend the general DrawFeature Control with draw arc capabilities. The main challenge would be to draw arcs. In terms of that, there ...


1

This isn't covered by the functionality of most webmap toolkits. Instead this is realized by the renderers who create the basemap that is embedded with Leaflet. Thus, you need to setup Mapnik, Maperitive, Mapbox, ... create a mapstyle that you want and deliver it to your endusers. Otherwise you might want to adapt existing style e.g. delivered by Cloudmade, ...


1

Figured it out thanks to some documentation reading. The polygon in leaflet responds to setStyle but the marker can be changed using setIcon Documentation for setIcon


1

Seems like you can't do that because a marker uses an image to render. I think you'd need to grab the icon class of your marker and change the "iconUrl" attribute to whatever new image you want. Source: Leaflet API Reference Hope that helps, DR



Top 50 recent answers are included