Configuring Local Datasets

This article is only relevant for Pozi Enterprise clients who are hosting datasets within their own network for internal use only.

Introduction

Datasets which are hosted internally are usually made available to Pozi as shape files, tab files, or directly out of an internal database such as SQL Server.

While it is common for Pozi to directly apply styling to these layers within the site configuration, it is also possible for the client to have some control over the styling through the use of VRT files.

In essence, the VRT file reads the dataset and applies some styling, and Pozi reads from the VRT file (rather than from the underlying dataset).  

The VRT File

In its simplest form, a VRT file will look something like this:

<OGRVRTDataSource> 
  <OGRVRTLayer name="StreetTrees"> 
    <SrcDataSource>MSSQL:server=GISServer;database=GISDatabase</SrcDataSource> 
    <SrcLayer>vw_ASSET_StreetTrees</SrcLayer> 
  </OGRVRTLayer> 
</OGRVRTDataSource>
In this example, the VRT file is reading a database view directly from a SQL Server database.  It is not modifying anything so in this case the output from the VRT file will be the same as the original dataset.
In the next example there is a <SrcSQL> tag with a select statement, which selects all the attributes from the dataset   pozi.assetic_trees, but also adds a new attribute which it has called "marker-color", and which has been assigned the value #00FF00.
The outcome is that when Pozi reads this VRT file it will recognise the attribute "marker-color" and will be able to use it for styling.
<OGRVRTDataSource>
  <OGRVRTWarpedLayer>
    <OGRVRTLayer name="assetic_trees">
      <SrcDataSource>MSSQL:server=GISServer;database=GISServer</SrcDataSource>
      <SrcSQL>
        select
          *,
          '#00FF00' as "marker-color"
        from pozi.assetic_trees
      </SrcSQL>
    </OGRVRTLayer>
    <TargetSRS>EPSG:4326</TargetSRS>
  </OGRVRTWarpedLayer>
</OGRVRTDataSource>
	
The net outcome in this example is that the client has been able to specify the marker colour of a point dataset, and has also specified the output projection (EPSG:4326).  This was possible without needing to contact Groundtruth.

Styling Options

This is a list of supported field names for vector styling:

Point style

  • "marker-color": eg #0000FF (default) 
  • "marker-size": eg 1,2,3,etc,small,large 
  • "marker-symbol": circle (default)|diamond|triangle|hexagon|star|heptagon 

Line style

  • "stroke": eg #0000FF (default) 
  • "stroke-opacity": eg 1 (default) 
  • "stroke-width": eg 2 (default) 

Polygon style

  • "stroke": eg #0000FF (default) 
  • "stroke-opacity": eg 1 (default) 
  • "stroke-width": eg 2 (default) 
  • "fill": eg #0000FF (default) 
  • "fill-opacity": eg 0.25 (default) 

Note: field aliases such as "fill-opacity" should be enclosed in double quotes (") to avoid syntax errors, especially for field names containing dashes.

Summary

The fundamental idea behind using VRT files is to provide the client with more direct control over the way their internal datasets are exposed to Pozi.

Footnote: Although this article has focused on using VRT files to provide some styling control for Pozi clients, VRT files can also be used more extensively to create dynamically manipulated dataset combinations such as, for example, to extract data from multiple database tables via table joins constructed within the VRT file.

For more information about the VRT file format, see  https://www.gdal.org/drv_vrt.html.