Hot answers tagged

11

As others have already mentioned, HTML formatting for labels is currently limited to colors. But with a very nice undocumented feature we can build dynamic labels, using label backgrounds with inline SVG expressions. Just as good as HTML formatting and best of all, we can even embed raster images (i.e. PNG) that are stored in a BLOB column (i.e. "image&...


8

To display the photo stored as blob in GPKG or PostgreSQL, one simple solution is to use QGIS HTML Widget. It is a widget to be used in forms. It can be used also for a table without geometries. Add a HTML Widget to the form Go to: Layer Properties → Attributes Form Switch to Drag and Drop Designer Add an HTML Widget to you Form Layout Edit the HTML Form ...


4

A GetFeatureInfo request will return only one feature unless you specify FEATURE_COUNT as a parameter. For example to allow a maximum of 10 features use var url = indialayersource.getFeatureInfoUrl( evt.coordinate, myviewResolution, 'EPSG:3857', {'INFO_FORMAT': 'text/html', 'FEATURE_COUNT': '10'} ) Note too, that even ...


4

You can find it in the expression's code, the easiest way to find an example is to look in your QGIS profile directory (from the Settings->User Profiles menu) and look at one that you like the layout of. and then look in the matching python file: from qgis.core import qgsfunction,QgsExpressionContextUtils,QgsExpression,QgsProject,QgsPoint,QgsGeometry @...


3

As Erik said in comment the attribute table migth suits your needs. The styling option is limited compare to html table but very easy to do it related to your data. In the layout, go to panel report organaizer and select your group. Then check include header and hit Edit button. It opens a new page that will be included before your group of pages. In this ...


2

When you select a result from the search, as it places the marker on the map, the Geocoder will also fire a 'result' event, https://github.com/mapbox/mapbox-gl-geocoder/blob/master/API.md#on which you can listen to with: geocoder.on('result', function(result) { console.log(result) }) I don't think detecting when this is dragged is officially supported yet,...


2

The first problem is with the query string you're sending to the server. If you scroll down on the Feature Layer's endpoint you'll see a Query link, which is the endpoint for requesting data. Set the where clause to 1=1 if you want to return all records, or use a SQL query such as TRL_NAME like 'M%' to find all records starting with "M": Set the ...


2

For a static image, you can try the following. Note that I am using an absolute local path with 3 slashes. <div>Image: <img src = 'file:///D:\temp\50k.png' width='300' height='225' alt='Alias Name'></img></div> For a dynamic image, you need to build the path. In my example the field photo contains a path like D:\temp\50k.png <...


2

You can use the turf function booleanContains: <script src="https://cdn.jsdelivr.net/npm/@turf/turf@5.1.6/turf.min.js"></script> var poly = L.polygon([[22.29227, 114.20847],[32.28227, 110.24847],[42.08227, 114.19847]]).addTo(map) function onLocationFound(e) { var marker = L.marker(e.latlng).addTo(map) var contains = turf....


2

The easiest way is to call .resetStyle() on the GeoJSON Group. This clears the style of all markers. Or you can call .resetStyle(layer) then it resets only the passed layer. I recommand to reset all styles when a marker is clicked and then add the new style: function resetMarkerStyles(){ contentLayer.resetStyle(); infoWindow.update(); } function ...


2

As far as I can see from your description, this won't be possible - to give an answer, even if not a solution. If you use a CMS, you only have limited acceess to the server (by purpose!). You can't (or should not) bypass these restrictions. For a solution of your problem, you should speek to your system administrator to ask what you can/are allowed to do ...


1

As a quick hack, you can copy the description from one standard function and paste it into a custom function using online HTML editors like this one. Here is the HTML code (unfortunately, it is very large and unreadable): <span style=" font-family:'Lato,Open Sans,Lucida Grande,Segoe UI,Arial,sans-serif'; color:#000000;">Returns the area ...


1

As Mike stated in the comments Even when you have a cluster of one you will need to extract the real feature from the cluster this means the return feature; will need to instead be return feature.get('features')[0]; so the code became Omap.on('click', function (evt){ var feature = Omap.forEachFeatureAtPixel(evt.pixel, function (feature,layer) { ...


1

If your KML source is not working with a cluster source it may contain features which are not Point geometry. You can add a geometryFunction to the cluster source options to ensure only point features are used when clustering: var clusterSource = new ol.source.Cluster({ distance: parseInt(distance.value,10), geometryFunction: function (...


1

Since I struggled to find this answer, in your server block, you need something like this: observe({ click = input$map1_click if(is.null(click)) return() text<-paste("Latitude: ", click$lat, ", Longtitude: ", click$lng) text2<-paste("You've selected point ", text) map1_proxy = leafletProxy("...


1

In such cases the only solution is browser debugger, break points and inspection of variable contents. If you would do this and set break point inside filter function, you would see that isCarpChecked and isTenchChecked are never set to true, since checkbox value is string "1", but feature property is numeric 1. Simple solution to this is to ...


1

After eventually making sense of the Leaflet documentation it states the watch option if true, starts continuous watching of location changes (instead of detecting it once) using W3C watchPosition method. You can later stop watching using map.stopLocate() method. I made the changes below removing the watch: true. map.locate({setView: true}) .on('...


1

That URL returns an image so you include it in your web page in the same way as any other image <img src='http://.....?request=getLegendGraphic'/>


1

The QGIS2web doesn't support to display other widgets than "Fields". The HTML widget is in the "Other widgets" group. Notwithstanding in inconvenience, the HTML widget is something, which we can develop on your own both in qgis2web.css and qgis2web.js files. We just need to replicate the CSS code, which we used for our HTML widget ...


1

There is a built-in webbrowser. Since you are displaying HTML, you can create a clickable link <script>document.write("<A HREF='" + expression.evaluate("\"URL\"") + "'>" + expression.evaluate("\"URL\"")) + "</A>";</script>


1

In order for the button to work, the drawChart() function needs to be used in the HTML without any arguments. You must also remove the line: “google.charts.setOnLoadCallback(drawChart)” because this will load the chart before the button can be clicked and used. Make sure to also uncomment the line: “chart = new google.visualization.PieChart(document....


1

There's no "render as html" support for legends in any way (yet). If you want to build a legend with html you need to use a html frame. If you want graphics you could combine a legend without any text with a html frame styled the way you want.


1

I finally resolved the issue. The problem was in two places. The first problem was that I did not create a node network for the roads shapefile in PostgreSQL. Furthermore, I needed to create a network topology specifically after creating the node network for my roads. It would go as: Create node network for Roads. Result roads_noded table created. Create ...


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