Versions Compared

Key

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

If you want to manually edit the SLD for the selected Layer then click on the Advanced tab. 

Info

From iShare 6.0 which uses MapServer 7.6.3 the handling of Multiple Rules in an SLD that match a given style have changed from matching just the first, to applying all that match, in order of the rules. See Using Multiple Rules below for details.


Note

If you manually edit the SLD via the Advanced tab and you add entries that cannot be handled by the SLD Style Editor then the Advanced tab will be your only option.

Image RemovedImage Added

Table of Contents

...

Here you can manually configure the style of your OGC Layer. Astun supply some default SLD files in the folder specified in the iShare Settings General tab SldSnippetDefinitionPath. For more information on SLD please refer to the GeoServer documentation which has plenty of examples httphttps://docs.geoserver.org/stable/en/user/styling/sld-/cookbook/index.html.

Toolbar

There is a Toolbar at the top of the Editing pane for common functions:

Image RemovedImage Added

  • Undo - the last action
  • Redo - the last action
  • Cut - the selected data
  • Copy - the selected data to the clipboard
  • Paste - from the clipboard into the cursor position
  • Currently available snippets - allows you to insert a selected snippet at the current cursor position.
  • Format the SLD - clicking this button will format the SLD for you.

...


Code Block
titleExample Area SLD
collapsetrue
<Rule>
	<Name>Ward</Name>
	<PolygonSymbolizer>
		<Fill>
			<CssParameter name="fill">#008000</CssParameter>
			<CssParameter name="fill-opacity">0.25</CssParameter>
		</Fill>
		<Stroke>
			<CssParameter name="stroke">#004000</CssParameter>
			<CssParameter name="stroke-width">2</CssParameter>
			<CssParameter name="stroke-opacity">1</CssParameter>
		</Stroke>
	</PolygonSymbolizer>
	<TextSymbolizer>
		<Label>
			<ogc:PropertyName>name</ogc:PropertyName>
		</Label>
		<Font>
			<CssParameter name="font-family">arlrdbd</CssParameter>
			<CssParameter name="font-size">11</CssParameter>
		</Font>
		<LabelPlacement>
			<PointPlacement>
				<AnchorPoint>
					<AnchorPointX>0.5</AnchorPointX>
					<AnchorPointY>0.5</AnchorPointY>
				</AnchorPoint>
				<Displacement>
					<DisplacementX>0</DisplacementX>
					<DisplacementY>0</DisplacementY>
				</Displacement>
			</PointPlacement>
		</LabelPlacement>
		<Fill>
			<CssParameter name="fill">#004000</CssParameter>
		</Fill>
		<Halo>
			<Radius>0</Radius>
			<Fill>
				<CssParameter name="fill"></CssParameter>
			</Fill>
		</Halo>
	</TextSymbolizer>
</Rule>

Using an existing SLD

You may have an existing SLD that you wish to use to style your OGC Layer in iShare. If you wish to use this in iShare then you will need to do the following:

  • Open the SLD in a text editor, such as Notepad++.
  • In Studio, select the OGC Layer to which you wish to apply the SLD and click Modify Style.
  • Select the Advanced tab.
  • From your original SLD only extract the information for the Rule i.e. <Rule> ... </Rule> (see the above example SLD for details) as iShare does not need the rest of the information.
  • Select the existing Rule in the SLD Style Editor and replace with the Rule you have extracted from your SLD.
  • Click OK to return to the Layer
  • Save your changes.
Note

Prior to V5.6.0 you could only have one Rule per OGC Layer.

Best Practice

  • Use a WHERE clause in the SQL statement for your Layer to limit the features being displayed rather than using FILTER statements in the SLD styling. Only use FILTER statements to style the display of the visible features.

Anchor
multiplerules
multiplerules
Using Multiple Rules

Status
colourYellow
title5.6.0+

If you wish to apply different styles to a Layer then you can do this using Multiple Rules.

Note
titleiShare 6.0

From iShare 6.0, due to the change in the way that Multiple Rules are handled i.e. Rules now apply to all that match not just the first match it finds, the solution is to use the <ElseFilter/> in the Rule which is used to match all not-otherwise-matched features. This goes in the Rule in the place that a Filter would normally occupy, e.g. in this simplified SLD, there’s a Rule with a Filter to match features with a crime_type value of Vehicle crime and a second Rule that uses ElseFilter to apply to all other features. Without the ElseFilter, every feature would have a fill colour of #FF8000.

Code Block
languagexml
titleExample ElseFilter
collapsetrue
<Rule>
  <Name>Vehicle crime</Name>
  <Description>
    <Title>Vehicle crime</Title>
  </Description>
  <Filter>
    <PropertyIsEqualTo>
      <PropertyName>crime_type</PropertyName>
      <Literal>Vehicle crime</Literal>
    </PropertyIsEqualTo>
  </Filter>
  <PointSymbolizer>
    <Graphic>
      <Mark>
        <WellKnownName>circle</WellKnownName>
        <Fill>
          <SvgParameter name="fill">#000080</SvgParameter>
        </Fill>
        <Stroke>
          <SvgParameter name="stroke">#000000</SvgParameter>
        </Stroke>
      </Mark>
      <Size>7</Size>
    </Graphic>
  </PointSymbolizer>
</Rule>
<Rule>
  <Name>Other crime</Name>
  <Description>
    <Title>Other crime</Title>
  </Description>
  <ElseFilter />
  <PointSymbolizer>
    <Graphic>
      <Mark>
        <WellKnownName>circle</WellKnownName>
        <Fill>
          <SvgParameter name="fill">#FF8000</SvgParameter>
        </Fill>
        <Stroke>
          <SvgParameter name="stroke">#000000</SvgParameter>
        </Stroke>
      </Mark>
      <Size>7</Size>
    </Graphic>
  </PointSymbolizer>
</Rule>


For a list of available filter functions that can be used with in a Rule/Filter see: https://mapserver.org/ogc/filter_encoding.html

Note

Any field used as a

...

SLD <PropertyName> must be made available as a

...

Displayed Field in the

...

Layer Fields options, and the <PropertyName> in the SLD must match the field name in the database exactly (including case).

The following SLD is an example of how we have styled the Councils layer to display different colours for different types of authority and it appears in iShare GIS like this:

...

Code Block
titleMultiple Rules
collapsetrue
<Rule>
  <Name>Unitary Authorities</Name>
  <Filter>
    <PropertyIsEqualTo>
      <PropertyName>descriptio</PropertyName>
      <Literal>Unitary Authority</Literal>
    </PropertyIsEqualTo>
  </Filter>
  <PolygonSymbolizer>
    <Stroke>
      <CssParameter name="stroke">#FF0000</CssParameter>
      <CssParameter name="stroke-width">2</CssParameter>
      <CssParameter name="stroke-opacity">1</CssParameter>
    </Stroke>
  </PolygonSymbolizer>
</Rule>
<Rule>
  <Name>Districts</Name>
  <Filter>
    <PropertyIsEqualTo>
      <PropertyName>descriptio</PropertyName>
      <Literal>District</Literal>
    </PropertyIsEqualTo>
  </Filter>
  <PolygonSymbolizer>
    <Stroke>
      <CssParameter name="stroke">#000066</CssParameter>
      <CssParameter name="stroke-width">2</CssParameter>
      <CssParameter name="stroke-opacity">1</CssParameter>
    </Stroke>
  </PolygonSymbolizer>
</Rule>
<Rule>
  <Name>Counties</Name>
  <Filter>
    <PropertyIsEqualTo>
      <PropertyName>descriptio</PropertyName>
      <Literal>County</Literal>
    </PropertyIsEqualTo>
  </Filter>
  <PolygonSymbolizer>
    <Stroke>
      <CssParameter name="stroke">#0000FF</CssParameter>
      <CssParameter name="stroke-width">2</CssParameter>
      <CssParameter name="stroke-opacity">1</CssParameter>
    </Stroke>
  </PolygonSymbolizer>
</Rule>
<Rule>
  <Name>Metropolitan Districts</Name>
  <Filter>
    <PropertyIsEqualTo>
      <PropertyName>descriptio</PropertyName>
      <Literal>Metropolitan District</Literal>
    </PropertyIsEqualTo>
  </Filter>
  <PolygonSymbolizer>
    <Stroke>
      <CssParameter name="stroke">#006600</CssParameter>
      <CssParameter name="stroke-width">2</CssParameter>
      <CssParameter name="stroke-opacity">1</CssParameter>
    </Stroke>
  </PolygonSymbolizer>
</Rule>
<Rule>
  <Name>London Boroughs</Name>
  <Filter>
    <PropertyIsEqualTo>
      <PropertyName>descriptio</PropertyName>
      <Literal>London Borough</Literal>
    </PropertyIsEqualTo>
  </Filter>
  <PolygonSymbolizer>
    <Stroke>
      <CssParameter name="stroke">#6600FF</CssParameter>
      <CssParameter name="stroke-width">2</CssParameter>
      <CssParameter name="stroke-opacity">1</CssParameter>
    </Stroke>
  </PolygonSymbolizer>
</Rule>
<Rule>
  <Name>Greater London Authority</Name>
  <Filter>
    <PropertyIsEqualTo>
      <PropertyName>descriptio</PropertyName>
      <Literal>Greater London Authority</Literal>
    </PropertyIsEqualTo>
  </Filter>
  <PolygonSymbolizer>
    <Stroke>
      <CssParameter name="stroke">#00FFFF</CssParameter>
      <CssParameter name="stroke-width">2</CssParameter>
      <CssParameter name="stroke-opacity">1</CssParameter>
    </Stroke>
  </PolygonSymbolizer>
</Rule>

Using an SLD exported from QGIS

...

Image Removed

...

Image Removed

...

You will see a Style button with a drop down selection.

Select Save Style > SLD File... and save it to a location of your choice.

...

Image Removed

...

Now we need to extract the information from this SLD and paste it into the SLD Style Editor.

Open the SLD in a text editor e.g. Notepad++

Now you need to remove all references to the namespace in our example below this is se:

...

Image Removed

...

Image Removed

...

Now you need to extract just the <Rule> information.

Our example above just has one Rule but yours may have several so, if you are using v5.6.0 or above, then you can extract them all.

Now you can paste this information into the Advanced tab of the SLD Style Editor.

...