Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Page Properties
hiddentrue
idKB


ThemeMapping
Type

Data Manipulation

Available from 


In this exercise we are going to use OS Open Roads dataset as the basis of our layerLayer. This dataset is available from the Ordnance Survey directly or, for ADS customers, available through Astun. In this scenario we have the OS Open Roads roadnode dataset loaded in a local Postgresql PostgreSQL database as 'osdata.ords_roadnode'.

After migrating the roadnode dataset to Postgresql you PostgreSQL you will probably want to delete nodes outside of the area of interest.

...

Now we need to add a column and populate it with the necessary html to create a link to Google StreetView. The link makes use of a named target so StreetView appears in a new tab rather than leaving the iShare application.

Code Block
languagesql
ALTER TABLE osdata.ords_roadnode ADD COLUMN html text;
UPDATE osdata.ords_roadnode SET html = '<a href="https://www.google.com/maps?cbll=' || round(ST_Y(ST_Transform(wkb_geometry, 4326))::numeric,5)::text || ',' || round(ST_X(ST_Transform(wkb_geometry, 4326))::numeric,5)::text || '&cbp=12,0,0,0,5&layer=c" target=\"_new\">Google StreetView</a>';

Now we just need to define our layerLayer. In this case we are using a classic mapserver layer Classic MapServer Layer definition as we may wish to use it My House.

Code Block
languagebash
LAYER
	NAME google_streetview
	INCLUDE "isharedata.inc"
	DATA "wkb_geometry from (select *, html as html_raw from osdata.ords_roadnode) as foo using srid=27700 using unique ogc_fid"
	METADATA
		"qstring_validation_pattern" "."
	END
	STATUS OFF
	TYPE POINT
	UNITS METERS
	CLASS
		NAME ""
		STYLE
			SYMBOL "circle"
			COLOR 251 251 251
			SIZE 10
		END
		STYLE
			SYMBOL "circle"
			COLOR 192 192 192
			SIZE 9
		END
	END
END

Expose the 'When you define the Layer in Studio you need to expose the html_raw' field as the visible field, turn off the display Display field name option and save Save. E.g.

Image Added

Here is the result.

 Image Added