Theme

Mapping

Type

Linking

Available from

Overview

In this example we create some HTML code, which will open a URL in a new window, as a Layer’s attribute value.

Normally we would select the Link field in Studio and check the checkbox to generate a hyperlink for the field. Studio currently doesn’t support the creation of a hyperlink for a new tab/window directly but it does provide an opportunity to see how html can be stored in a layer’s field.

The following steps presume that you're using a table in PostgreSQL but this can work for other sources such as a Shape file or MapInfo tab file.

ALTER TABLE mytable ADD COLUMN myhtml text;
UPDATE mytable SET myhtml = '<p><a href="http://www.google.co.uk" target="_blank" >Here is Google in a new window</a></p>';
LAYER 
 NAME "mylayer" 
 STATUS OFF 
 TYPE POINT 
 INCLUDE "datashare.inc" 
 DATA "wkb_geometry from (select *, myhtml as myhtml_raw from public.mytable) as foo using unique ogc_fid using srid=27700" 
 TOLERANCE PIXELS 
 CLASS 
   NAME "" 
   STYLE 
     SYMBOL "circle" 
     SIZE 14 
   END 
 END 
END

Make sure you include the http:// in the myhtml column - failing to so will result in the browser attempting to load the page as a local resource.