Mouseover
Dernière mise à jour
Dernière mise à jour
K2 Geospatial 2022
Mouseover bubbles are meant to display information about the elements they are pointing to. This information includes text, attribute values, hyperlinks, images, etc. The JMap administrator determines what information is displayed in the bubbles of each layer.
The content of mouseover bubbles can be formatted using HTML tags. Mouseover bubbles can also contain JavaScript programs.
To configure mouseover for a layer, click on Mouseover in the details section of the layer.
Mouseover | |
Mouseover | Enter the content of the mouseover bubble. See sections below for an explanation of the syntax. |
Background color | Select the background color of the mouseover bubble. |
Prevent text duplication | Select this option to prevent the same text from being repeated many times within the same bubble. This can happen when pointing to many map elements on the same layer that have the same mouseover content (e.g. street segments at an intersection). |
Minimum scale | Activate this option and enter the minimum scale from which the mouseover bubble must be displayed. |
Maximum scale | Activate this option and enter the maximum scale from which the mouseover bubble must be displayed. |
You must provide the text that will be used as the content of the bubble. This text can be comprised of static parts (displayed as is), variable parts (replaced at display time by another value), simple JavaScript programs, and HTML tags. For instance, the elementValue(city) function will be replaced at display time by the value of the city attribute for the pointed element.
The mouseover syntax is comprised of various functions that will determine the content of the bubbles. Functions and their parameters are generally not case sensitive. For instance, ev(city)
is equal to Ev(CITY)
.
The following table explains the various available functions:
Function | Description |
elementValue(attrib) or ev(attrib) attrib: the name of an attribute | Replaced by the value of the bound attribute whose name is passed as a parameter for the pointed element.
For example, |
elementId() | Replaced by the element identifier. |
polygonArea() | Replaced by the area of a pointed polygon type element. |
lineLength() | Replaced by the length of a pointed line type element. |
centroid() | Replaced by the coordinates of the geometric centroid of the element's geometry. |
format(attrib, format) attrib: the name of a date or numerical attribute format: the desired date format | Replaced by a number or date that was formatted according to a specific format.
Example
|
ifNull(attrib, value) attrib: the name of the attribute to test value: the value to display if attrib is null | Replaced by the value value only if the value of the attrib attribute is null.
If the attribute value is not null, nothing is displayed.
Example
|
ifNotNull(attrib, value) attrib: the name of the attribute to test value: the value to display if attrib is not null | Replaced by the value only if the value of the attrib attribute is not null.
If the attribute value is null, nothing is displayed.
Example
|
subString(attrib, startIx, endIx) attrib: the name of the attribute for which a part must be extracted. startIx: starting position in the character string. endIx: ending position in the character string. | Replaced by a portion of the value (as a character string) of the attrib attribute, between the startIx position and endIx position.
Example
|
encode(attrib, encoding) attrib: the name of the attribute to code encoding: the name of the encoding | Replaced by the value of the attrib attribute once it is encoded with the specified character encoding (UTF-8, CP437, ISO 8859-1, etc).
Example
|
<script> code JavaScript</script> | Runs the JavaScript code found between the tags. In JavaScript, the attribute values of the elements are accessible through the |
<a href="download:file URL">some text</a> | JMap supports a special hyperlink syntax that allows a user to download a file by clicking on the link.
The file to download can come from a http: or a file: URL.
Example
|
photosAsThumbnails() | Replaced by smaller versions of the images attached to the element. The user can click on a thumbnail to open the full size image.
|
projectName() | Replaced by the name of the current project. |
userName() | Replaced by the user code of the user that is currently connected. |
sessionId() | Replaced by the identifier of the current session. |
host() | Replaced by the name of the host or address of the JMap Server instance to which the application is connected. |
port() | Replaced by the port number (http or direct) of the JMap Server instance to which the application is connected. |
date() | Replaced by the current date and time. |
The content of the bubble can be formatted using simple HTML tags. Mouseover bubbles do not support CSS or advanced tags such as <DIV>
. The following HTML tags are supported and frequently used in mouseover:
<B>, <I>, <U>, <A>, <IMG>, <TABLE>, <BR>
You can insert hyperlinks in mouseover bubbles. These hyperlinks can be clicked, and they allow users to open HTML pages or to open or download files.
Mouseover content | Display |
| |
| |
| |
| |
| |
|
Mouseover supports a function to locate map coordinates or elements using a special URL syntax. A hyperlink is displayed in the bubble, and when it is clicked, the map locates the specified element(s) or region. This function is only available in JMap Pro.
Mouseover locate example | Description |
| Displays a Locate hyperlink. When clicked, locates the region defined by x=-73, y = 45, width = 5, height = 5 in the same map. This is expressed in the map's units. |
| Displays a Locate hyperlink. When clicked, locates the elements on the subway layer that have their attribute name equal to atwater in the same map. |
| Displays a Locate hyperlink. When clicked, locates the elements on the subway layer that have their attribute name starting with letter a in the same map. |
| Displays a Locate hyperlink. When clicked, locates the elements on the subway layer that have their attribute name equal to atwater in the same map. The resulting map has a scale of 1 : 1000. |
| Displays a Locate hyperlink. When clicked, locates, in a new map called Result, the elements on the subway layer that have their attribute name equal to atwater. If a map called Result already exists, it is reused. If the name of the map was new, a new map (with an automatically generated name) would be created each time. |
You can specify a URL that opens an HTML page to display in the mouseover bubble (only supported in JMap Pro). The HTML page will occupy 100% of the bubble. The syntax is as follows:
$URL{http://awebsite.com}
The specified URL can be static or it can come from an attribute. It can also use attribute values as parameters, as shown below:
$URL{http://awebsite.com?param1=ev(ATTRIB_A)¶m2=ev(ATTRIB_B)}
/