Tag Info

Hot answers tagged

14

You could use PyQGIS for that (not sure is the best solution for it, though). Select (or activate) the layer in the QGIS ToC, open the QGIS Python console, and copy this code snippet: prefix = "'" layer = iface.activeLayer() attr = layer.rendererV2().classAttribute() attrColor = 'color' # Name of the field to store colors fieldIndex = ...


3

You could – along the lines of map.on('zoomend' … insert a conditional statement into layer.on('click' … querying map.getZoom(): layer.on('click', function() { if(map.getZoom() < 10) { map.fitBounds(layer.getBounds()) } });


3

That is true. QGIS2leaf does not support "Scale Dependent Visibility"! QGIS2leaf was developed to extract a qgis project into a leaflet based webmap. It is not designed to "transfer" all qgis possibilities into styling/behaviour of leaflet. It can build the basis for great webmaps but will definitely require you to do some manual coding in the ...


2

Try to call map.invalidateSize() after changing the map div's size/visibility: http://leafletjs.com/reference.html#map-set-methods


2

Apologies that this was such a severe bug in qgis2web 0.14.0. I've fixed it as described by GreyHippo, and pushed qgis2web 0.14.1 as a GitHub release, and also onto the QGIS plugins repo - you should be able to update from within QGIS.


2

not sure if this fits your use case, but you might be able to use pointToLayer when constructing the geojson var papesjson = L.geoJson(someGeojson, { pointToLayer: function (feature, latlng) { if (feature.properties.estado == "BAJA"){ awesomeclase ="fa-circle-o-notch"; } else if (feature.properties.estado == ...


2

help(Snow.deaths) says: The scale of the source map is approx. 1:2000. The ‘(x, y)’ coordinate units are 100 meters, with an arbitrary origin. so I don't know why you think EPSG:3109 is going to help you, that seems to be Jersey transverse mercator... http://epsg.io/3109 To properly georeference these you'll need to find the lat-long of the arbitrary ...


1

I think you will be best off using a tile server, and then your heat map on top. You don't want to be publishing your own OpenStreetMap. Follow this guide here: http://www.qgistutorials.com/en/docs/leaflet_maps_with_qgis2leaf.html Just replace the points dataset with your dataset.


1

If you do (or want to) use the Leaflet 1.0 Beta version, Marker and Path have an interactive option. If false, the marker will not emit mouse events and will act as a part of the underlying map. (from leaflet beta API)


1

When you have a layer that also listens for click then it will pick up the top most layer's event. Check out this fiddle. You can add the shape click handler and see that it picks that up instead of the map's.


1

try .leaflet-popup-content img { margin: 0 auto; display:block; }


1

Problem was that one layer was using a rule-based renderer, which is unsupported. I need to patch the plugin to alert users if their project contains rule-based layers.


1

I'd look here: += 'L.latLng('` What is split_route meant to be? A multi-point array? Can you just construct this as an array and pass this in as waypoints? var split_route = []; for (x = 0; x < route1.length ; x++) { var coords = []; coords.push(route1[x].ordered_locs.displayLatLng.lat, route1[x].ordered_locs.displayLatLng.lng); ...


1

You are not telling us how you get the WMS in Leaflet: are you using the default object or a plugin? I have experiences the "cut" issues with labels too. I suspect that the problem might come from the fact that Leaflet WMS object is a extension of the Tile object and somehow in the request processing somehting ges wrong. The geometric object to which the ...


1

One example using jQuery. You would need to integrate with your existing script; maybe keeping a default timeGap of 5000 (in case the user doesn't enter one), but overwriting that with the input value if the user clicks the submit button. You could also trigger this with the play button, grabbing the value from the input if it exists. <script ...


1

This is the answer. Sometimes you have to go through all the process of asking a question to understand the solution. JavaScript: /** * Converts spherical web mercator to tile pixel X/Y at zoom level 0 * for 256x256 tile size and inverts y coordinates. * * @param {L.point} p Leaflet point in EPSG:3857 * @return {L.point} Leaflet point with tile pixel ...


1

The easy way is to put everything from var geojson = { down to the closing }; into a new file and loading that as JavaScript file in the head of your HTML. For example: geojson_data.js: var geojson = { type: 'LineString', coordinates: [ [28.24, 84.75, 7.6, .45, '04/25/2015', '11:56', 'Gorkha'], [28.41, 85.8, 5.5, .12, '04/25/2015', '12:23', ...


1

Sounds like you may need to clone the Leaflet objects before adding them to the layerGroups, otherwise they are passed by reference to the layerControl, and this turns off all the Albany, NY markers on the map, regardless of what trip they are part of. var trip1 = L.layerGroup(); var albany = L.marker([lat, lng]); // showing one way to clone object in ...


1

There is an error in the code. In maindialog.py on Line 198 should be: outputFile = writeLeaflet(self.iface, folder, 600, 400, 1, layers, visible, "", cluster, "", "", "", "", labels, 0, 0, json, params, popup)


1

I just released qgis2web 0.16.0 which supports scale-dependent visibility in Leaflet output. That should do the job for you.


1

This question had the second rank on Google when I searched for OpenLayers versus Leaflet so I thought I'd mention that there is a basic tutorial that compares the APIs of both OpenLayers 3 and Leaflet by having you build the same thing in both of them. It is written by Astun Technology and the tutorial tasks are: Basic map with OSM tiles OS-GB Map with ...


1

Use turf.js for this, the functions union and erase in particular. Make a union of all your polygons (or at least the ones that are within the current viewport), then erase the result from the polygon that covers the current viewport. The result will be the inverted selection you're looking for.


1

I've been stuck on an issue quite similar to yours by having a custom control with a scrollable div inside. At least a partial solution can be achieved by using lines like this: var elem = L.DomUtil.get('yourelementid'); L.DomEvent.on(elem, 'mousewheel', L.DomEvent.stopPropagation); where elem is the element that's laid out over the map. This prevents ...


1

I think that with 13,000 records you might still get away with a single app loading a GeoJSON or TopoJSON file. Are you interested in sharing the data? I've got a single page web-app that allows you to explore a bunch of data about crashes here. If you use the clustering plugin, you get better performance. And then you can turn the clusters off when you ...



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