Versions Compared

Key

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

...

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:

xml
Code Block
xmltitleOverriding the rendering type for an entity - 1.3.3 and later
linenumberstrue
<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
titleOverriding an entities rendering using CSS properties
linenumberstrue
<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
xmlxml
titleOverriding an entities rendering using CSS properties - 1.3.3 and later
linenumberstrue
<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
xmlxml
titleReferencing a SLD file - pre 1.3.3
linenumberstrue
<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.

xml
Code Block
xml
titleReferencing a SLD file - 1.3.3 or laterfile
linenumberstrue
<selection:mapengine id="selection">
  <override>
    <entity id="property">property.sld</entity>
  </override>
</selection:mapengine>

...

Code Block
xml
xml
titleEmbedding a SLD file
linenumberstrue
<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
xmlxmltitleReferencing a SLD file with override tag - 1.3.3 or later
linenumberstrue
<selection:mapengine id="selection">
  <override>
    <entity id="property">property.sld</entity>
  </override>
</selection:mapengine>


xml
Code Block
xml
titleReferencing a SLD file without override tag - 1.3.3 or later
linenumberstrue
<selection:mapengine id="selection">
  <entity id="property">property.sld</entity>
</selection:mapengine>

...