Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

As of Weave 2.5 there is a built in map engine that is able to generate map images based on spatial data that has been registered using a Spatial Engine.

The configuration for the Weave map engine consists of two parts, the first part defines what data will be made available to be drawn by the map engine, and the second part determines how that data will be drawn.

Currently all of the data that's drawn by a Weave map engine must come from the same spatial engine, but you can have multiple Weave map engines configured.

And the map engine also only supports vector data, it does not support raster data.

The namespace used for the Weave map engine is com.cohga.server.map.weave.

Example Weave map engine
<?xml version="1.0" encoding="UTF-8"?>

<config xmlns="urn:com.cohga.server.config#1.0" xmlns:weave="urn:com.cohga.server.map.weave#1.0">

	<weave:mapengine id="vector">
		<spatialengine>gis</spatialengine>
		<format>image/png32</format>
		<layers>
			<layer id="contours01" label="Contours 1m" layer="GIS.CONTOURS_01M" style="contour"/>
			<layer id="contours02" label="Contours 2m" layer="GIS.CONTOURS_02M" style="contour"/>
			<layer id="contours05" label="Contours 5m" layer="GIS.CONTOURS_05M" style="contour"/>
			<layer id="contours10" label="Contours 10m" layer="GIS.CONTOURS_10M" style="contour"/>
		</layers>
		<styles>
			<style id="contour">
				<type>line</type>
				<stroke-color>#853111</stroke-color>
				<stroke-width>2</stroke-width>
			</style>
		</styles>
	</weave:mapengine>

</config>

The above example creates a map engine with four layers that all use the same simple rendering.

Note that to use this map engine in a client you still need to create a Table Of Contents and add it as a map engine to the Map View. This map engine is treated exactly the same as the other map engines (e.g. ArcIMS, WMS, ArcGIS Server, etc)

You can specify one or more filters for each layer that can be used to refine what data is retrieved from the underlying table, e.g.

Filtering data using CQL
<layer id="active_incidents" label="Active Incidents" layer="GIS.INCIDENTS" style="incidents">
	<filter>STATUS = 'ACTIVE'</filter>
</layer>
<layer id="inactive_incidents" label="Inactive Incidents" layer="GIS.INCIDENTS" style="incidents">
	<filter><![CDATA[STATUS <> 'ACTIVE']]></filter>
</layer>

Here we've split a single spatial table into two layers, note the use of the <![CDATA[...]]> to enclose the second filter, because it contains special XML characters (< and >).

You can use multiple filter tags for each layer, and they will be combined using an AND, that is the data must satisfy all filters to be displayed.

The filters are specified using the CQL query language, which is similar to SQL.


The styles section can define multiple named styles, which are then referenced using the style attribute of the individual layer in the layers section.

The example above uses a simple inline style definition that uses CSS like attributes to define how the vector data should be drawn. It's also possible to use an external SLD (Styled Layer Descriptor) file to describe how the layer should be displayed, if you require more advanced styling. In this case you can just reference the SLD file using the layer style attribute, e.g.

Using an external SLD file to style a layer
			<layer id="contours01" label="Contours 1m" layer="GIS.CONTOURS_01M" style="sld\contours.sld"/>

In this example there should be a file located at weave\platform\workspace\sld\contours.sld that contains the XML definition for the style.

Example SLD file
<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc"
  xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
  <NamedLayer>
    <Name>Contour</Name>
    <UserStyle>
      <Title>Contour</Title>
      <FeatureTypeStyle>
        <Rule>
          <LineSymbolizer>
            <Stroke>
              <CssParameter name="stroke">#853111</CssParameter>
              <CssParameter name="stroke-width">2</CssParameter>
            </Stroke>
          </LineSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

This SLD file does not do much more that the inline style shown in the first example, but this page isn't a tutorial on SLD.

Alternatively, when referring to an external SLD file it can also be specified in the style itself, rather than the layer, so the layer can reference one of the inline styles, and the style then points to the external SLD file, e.g.

		<styles>
			<style id="contour">sld\contours.sld</style>
		</styles>

This way if you use the same SLD file for multiple layers you can just reference a single inline style and have that style refer to the SLD file.

Inline Styles

 When specifying a style within the Weave map engine config directly you need to specify and id for the style, so that it can be referenced by the layer, and also what type of features the style will be applied to, point, line (or linestring) or polygon, and you do this by setting the type attribute for the style.

Additionally you can specify a maximum and minimum scale range for the style using minScale (or minscale) and maxScale (or maxscale).

Finally, you can also specify a label (or title) and a description (or abstract) which can be used when generating the legend.

After that it's just a case of setting the appropriate attributes that define how you want the data rendered.

The following are the different values that can be used with an inline style definition, not that both "colour" and "color" can be used, and the hyphen is also optional, so "stroke-colour" and "strokecolor" can both be used.

When specifying colours you can either use hex notation with RRGGBB and prefix the value with a #, for example #ff0000 for red, or you can use a pre-defined colour from the list black, blue, cyan, darkgray, darkgrey, gray, grey, green, lightgray, lightgrey, magenta, orange, pink, red, whiteyellow.

The mark type can be one of squarecircletrianglestarcrossarrow or x.

When specifying a style for lines you can specify the stroke attributes, for a polygons both stroke and fill attributes, and for points stroke, fill and mark are required.

Stroke

NameDefault
stroke-colourorange
stroke-width3
stroke-opacity1

Fill

NameDefault
fill-colourorange
fill-opacity0.125

Mark

NameDefault
mark-typecircle
mark-size10
mark-opacity1
mark-rotation0

Joining Tables

From 2.6.4 it's possible to join to another table if the underlying spatial engine is using a database, i.e. this won't work for shapefiles for example. 

  • No labels