Hot answers tagged

8

Will you add file:/// before the drive letter C: ? <img src="file:///C:/Local/aa.jpg" width="350" />


6

Not sure if there's another way, but this is how I've implemented it. You need these three functions (make sure you import the required QGIS and Qt4 classes before): def createMapTips( self ): """ Create MapTips on the map """ self.timerMapTips = QTimer( self.canvas ) self.mapTip = QgsMapTip() self.connect( self.canvas, SIGNAL( "...


6

Use a table: <table> <th colspan=2><h1>ASSET</h1></th> <tr><td class="bold">NAME:</td><td>[% "First Name" %] [% "Surname" %]</td></tr> <tr><td class="bold">COMPANY NAME:</td><td>[% "Company Na" %]</td></tr> [...] </table>


6

$x and $y takes coordinates directly from your data geometry (your data are in WGS), so it is project-independent. Probably you have set other CRS with on the fly reprojection, which could confuse you. If you want display coordinates from data in other CRS, you have to use transform function like this: <b>X: </b>[% x(transform($geometry,'EPSG:...


5

The width of the map tip box is computed without looking at all the data content and is therefore unlikely to fit. You can however set it to a known good size: <style> h1 {color:red; width:300px;} </style> <h1>[% "MyField" %]</h1>


5

In QGIS 2.16.1 you can use the variable @project_folder. This returns the path of the folder the project is saved in. When the data or datafolder is saved in this project folder as well you can concatenate a relative path. You should ask one question a time, see the tour, as this helps other users find the question and answer. But for the defined width you ...


5

Three things needs to be addessed: 1) as @snaileater said, the path must be quoted 2) the ending </img> tag must not contain spaces, else is will be printed as text 3) a local file URL must start with file:\\ Here is a example displaying a local file: [% concat('<img src=\'file:\\',"path", '\' width="400"></img>') %]


5

The feature you want is called annotation tools, or just "annotations". Specifically, you probably want to use HTML annotations, and possibly also SVG annotations. Annotations are available through the last button on the Attributes toolbar. Here's a link to the relevant section of the QGIS User Manual. The HTML annotation accepts HTML code, so of course ...


4

To display an image on MapTip in a network environment, we can refer the link to the source in a file:///SERVER_NAME: style. If you are in Windows network and need to find the path to the file, please follow: Open file explorer highlight the file and hold [SHIFT] key right-click the mouse button copy as path paste on a text editor


4

@Matthias Kuhn: Following your answer, this image shows my first Virtual Layer to control order of attribute table, with ultimate goal of controlled Map Tips. Layer | Add Layer | Add Virtual Layer [Import] and select existing layer (in my case "household" which corresponds to "household.shp") In [Query] window, typed in SELECT * FROM household ORDER BY ...


4

You could use a virtual layer. With this you can sort and filter the rows without altering the original dataset and tweak it for visualisation. With newer versions of QGIS you could possibly also use aggregate expressions. These are just hints to get you started. Please post a more complete answer based on these hints so future readers can learn from it as ...


4

You can set the size of the map tip frame by including your expression inside of <div> tag in this way: <div style="width:350;height:200"> [% "LIGHT_COND" || '\n' || 'Persons ' || "TOTAL_PERS" %] </div> And it's possible to go further with styling like that: <style> h3 { margin: 0px 0px 10px 10px; } </style> <div ...


3

I am rather new to QGIS as well so there may be a much better way to accomplish map tip suppression for individual layers: Just made a quick test with v2.8.2 on Windows. From the "Display" page of the layer properties, setting the Map Tip to display to be a field filled with NULL values results in no map tip for that layer. I also found if the map tip ...


3

You can use Value Tool plugin which displays the cell value as you hover your mouse over it. Unfortunately the value is shown in another panel, not at the cursor point as you used to see in ArcGIS' Map Tips.


3

Try coalesce() <h1> [%"Local Auth"%] </h1> <h3> Date LAP Adopted</h3> <p> [% coalesce("Local Pl_1", 'No Data Available') %] </p> <h3> Five Year Housing Supply</h3> <p> [% "5 YHLS (#)" %] </p>


3

If your data it truly Null (and not a white space), then use IS NULL to detect it. [%CASE WHEN "Local Pl_1" IS NULL THEN 'No Data Available' end%] If the content of the field Local Pl_1 is to be displayed if it set (i.e. it is not null for some records), you can instruct QGIS to show it: [%CASE WHEN "Local Pl_1" IS NULL THEN 'No Data Available' ELSE "...


3

I think it's a problem with your syntax - Perhaps try not having expression delimiters ([% %]) nested within one another, and instead use one expression and concatenators (||) to join up the HTML text and fields. You might need to escape the single quotation marks in the HTML (e.g. <a href='blah'> ) by using two of them ( <a href=''blah''> ) ...


3

You could have a case statement: <h3> Title Plan</h3> <p>[% case when "Title Plan" is not NULL then '<a href='||"Title Plan"||'>' else '' end case %][% case when "Title Plan" is not NULL then 'Click Me</a>' else 'No title plan available' end case %]</p> If your data is not actually NULL, and just a blank field, you may ...


3

It is possible to set the map tip delay from QGIS 3.2:


3

You can not change it in the GUI, as it is hard-coded. We can see in qgisapp.cpp, createMapTips() // set the interval to 0.850 seconds - timer will be started next time the mouse moves mpMapTipsTimer->setInterval( 850 );


3

You should check the following points: 1) The path string must be quoted in your resulting string which is not the case in the sreenshot you provided. 2) You seem to be attempting to load local file image: your images have to be on a local or remote server. 3) (in any case u forgot it): you must activate maps tip ("Layer/Show Map Tips") 4) Here is a ...


3

You can simply use an if expression and the variable @map_scale to create a map tip with a conditional scale rule. Using the expression [% if( @map_scale <10, 'your text here','')%] the map tip will appear only if the scale is less than 10. If you want to define a range of min/max scales where the map tips will appear, you can use a double ...


2

This is a bit crude but will do the job...I'm sure someone will be able to produce some more efficient Python code. It would obviously be better to wrap at a space rather than the middle of the word but this demonstrates that the concept is possible. def FindLabel ( [Note] ): txt = [Note] txtList = [] txtList.append(txt[:50]) txtList.append(txt[50:...


2

None of your attempts at HTML are actually going to create a link. Try something like: <a href="http://google.com?q=[% "STATE_NAME" %]">[% "STATE_NAME" %]</a> Where you add the field to the URL AND provide some text to link to, in this case the state name field but it could be a simple text string like link.


2

Using your style,only need add: .table tr:nth-child(odd){ background: #b8d1f3; } .table tr:nth-child(even){ background: #dae5f4; } And put your table class when create the table,for example: <style> body { background-color: white!important; font-family: sans-serif; width: 200px; } ...


2

This one worked for me: <div style="width:400;height:320"> <div style="height:20; margin: 0 auto;"> [% "filename" %] </div> <div style="height:300; margin: 0 auto;"> <img style="max-width:400px; max-height:300px;" src="[% "filepath" %]" /> </div> </div>


2

Disclaimer: I do not know, how links in QGIS map tips work. But when we're only talking about the field calculator syntax, the following show be correct: [%CASE WHEN pdf_link3 IS NULL THEN 'No other documents' ELSE '<a href="http://geodocs/pdf/Lokalplan_oevr_dok/'||pdf_link3||'">Click here</a>' END %]


1

You may use field calculator in QGIS to check the condition and prepare the image URL in a new field. The new field can virtual so no need to be saved, then use the virtual field value as you image URL. In functions list choose the fields and values and select the fields to be compared against from your attribute table, then write your condition in the ...


1

In HTML the way of adding a hint to an image is to use an alt attribute on the img tag. Like: <img src="C:\Local\aa.jpg" width="350" alt="Tip on test image" /> It is up to the client that parses the HTML whether or not it displays the text.


1

You could try to use something similar to what Nathan Woodrow describe here : https://nathanw.net/2016/02/04/live-svgs/ to symbolise your point with your picture then use the time manager make the picture appear at the right time.


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