...
Overriding selection drawing type for a specific entity
Note |
---|
As of version 1.3.3 of the selection map engine bundle the format for overriding the selection is different (although the old version is still supported). |
Occasionally if you're using a spatial engine that does not support specific geometry types, point
, line
and polygon
, but instead just a generic geometry
type (this includes SQL Server) then you may need to tell the selection map engine what type of renderer to use for a particular entity. This is particularly important if you're seeing "Unable to make suitable draw style for ..." messages in the weave.log file (note that another page that may be relevant in this situation, and is probably a better solution isĀ this page if you're using SQL Server)
This can be done by setting the geometry type for an entity as follows:
Code Block | |||||
---|---|---|---|---|---|
| |||||
<selection:mapengine id="selection"> <override> <entity id="property">polygon</entity> <entity id="road">line</entity> <entity id="trafficlight">point</entity> </override> </selection:mapengine> |
or
...
You can use point or multipoint, line, multiline, linestring or multilinestring, and polygon or multipolygon (all values will be accepted, but they'll be interpreted as 'point', 'line' or 'polygon' regardless).
This then sets the geometry type for the entities selection, and the renderer for that particular type will be used to draw the selections.
Completely overriding the selection drawing for a specific entity
It's also possible to specify the rendering directly for a specific entity by using the entity id instead of point
, line
or polygon
, for example:
Code Block | ||||
---|---|---|---|---|
| ||||
<selection:mapengine id="selection"> <override> <property>polygon</property><entity id="property"> <road>line</road> <active> <trafficlight>point</trafficlight> </override> </selection:mapengine> |
You can use point or multipoint, line, multiline, linestring or multilinestring, and polygon or multipolygon (all values will be accepted, but they'll be interpreted as 'point', 'line' or 'polygon' regardless).
This then sets the geometry type for the entities selection, and the renderer for that particular type will be used to draw the selections.
Completely overriding the selection drawing for a specific entity
It's also possible to specify the rendering directly for a specific entity by using the entity id instead of point
, line
or polygon
, for example:
...
<selection:mapengine id="selection">
<override>
<property>
<active>
<strokecolour>green</strokecolour>
<strokewidth>3</strokewidth>
<strokeopacity>0.75</strokeopacity>
<fillcolour>green</fillcolour>
<fillopacity>0.125</fillopacity>
</active>
<inactive>
<strokecolour>green</strokecolour>
<strokewidth>2</strokewidth>
<strokeopacity>0.25</strokeopacity>
<fillcolour>green</fillcolour>
<fillopacity>0.025</fillopacity>
</inactive>
</property>
</override>
</selection:mapengine>
or
Code Block | |
---|---|
xml | xml |
title | Overriding an entities rendering using CSS properties - 1.3.3 and later |
linenumbers | true | <selection:mapengine id="selection"> <override> <entity id="property"> <active> <strokecolour>green</strokecolour> <strokewidth>3</strokewidth> <strokeopacity>0.75</strokeopacity> <fillcolour>green</fillcolour> <fillopacity>0.125</fillopacity> </active> <inactive> <strokecolour>green</strokecolour> <strokewidth>2</strokewidth> <strokeopacity>0.25</strokeopacity> <fillcolour>green</fillcolour> <fillopacity>0.025</fillopacity> <strokecolour>green</strokecolour> <strokewidth>3</strokewidth> <strokeopacity>0.75</strokeopacity> <fillcolour>green</fillcolour> <fillopacity>0.125</fillopacity> </active> <inactive> <<strokecolour>green</inactive> strokecolour> </entity> </override> </selection:mapengine> |
Advanced selection rendering
Additionally it's possible to specify the selection rendering using SLD (Styled Layer Descriptor).
This can be done either by specifying the SLD directly in the config file or by referencing a file containing the SLD from the config file.
Code Block | |
---|---|
xml | xml |
title | Referencing a SLD file - pre 1.3.3 |
linenumbers | true | <selection:mapengine id="selection"> <override> <property>property.sld</property> <strokewidth>2</strokewidth> <strokeopacity>0.25</strokeopacity> <fillcolour>green</fillcolour> <fillopacity>0.025</fillopacity> </inactive> </entity> </override> </selection:mapengine> |
Advanced selection rendering
Additionally it's possible to specify the selection rendering using SLD (Styled Layer Descriptor).
This can be done either by specifying the SLD directly in the config file or by referencing a file containing the SLD from the config file.
Code Block | xml | xml|||
---|---|---|---|---|
| ||||
<selection:mapengine id="selection"> <override> <entity id="property">property.sld</entity> </override> </selection:mapengine> |
...
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<selection:mapengine id="selection"> <override> <property><<entity id="property"><![CDATA[ <StyledLayerDescriptor version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd" 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"> <NamedLayer> <Name>property</Name> <UserStyle> <!-- Rest of SLD content here --> </UserStyle> </NamedLayer> </StyledLayerDescriptor> ]]></property>entity> </override> </selection:mapengine> |
...
Optional 'override' tag in definition
Additionally, as part of the 1.3.3 release of the selection map engine bundle the <override> tags are now optional (this applies entity renderer overrides in the pre and post 1.3.3 format).
The following two examples are equivalent:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<selection:mapengine id="selection"> <override> <entity id="property">property.sld</entity> </override> </selection:mapengine> |
Code Block | xml | xml|||
---|---|---|---|---|
| ||||
<selection:mapengine id="selection"> <entity id="property">property.sld</entity> </selection:mapengine> |
...