Hello Andrea - hear comes the SLD.
As you see, my SVG filenames has many characters witch makes it hard to use
the &env= , I think.
I believe the URL in a GetMap request is limited to 512 or 1024 characters?
This is only one part/scaleinterval (of 13) of my SLD covering the Rules for
1:96000 to 1:192000 and this example has 5 area intervals.
My naming of SVG files:
YMS200 is one SVG 200x200 pixel Symbol.
YMark2000_4 This is a 2000x2000 pixel SVG symbol that has four (4) YMS200
symbols.
YMark2000_1 has one YMS200 and YMark2000_16 has sixteen (16) YMS200 symbols.
I´m testing these SVG symbols to minimize the amount of symbols in each
polygon.
Thanks and regards. Anders Söderman Stockholm, Sweden.
My question:
One SLD file with 13 scaleintervals each having 3 - 8 areaintervals means
that I have to write the name of the SVG-file, Stroke colours etc many
times.
My guestion:
It would be very nice to be able to start the SLD with PARAMETERS
(SVG_file_1, SVG_file_2 ...) ie.
SVG_file_1 = xyz_1.svg
SVG_file_2 = xyz_2.svg
etc.
and then I only have to change xyz_1.svg, xyz_2.svg etc. to my SVG
filenamnes right in the beginning of the SLD file.
I hope you understand my problem.
Andrea: Not really no. Seeing the SLD in question would help.
Here is the SLD:
<!-- Regel Lst_RI_Kulturmiljovard Snowstar_Kringla i skalområdet 1:96 000 -
1:192 000 Målskala 1:144 000 -->
<Rule>
<ogc:Filter>
<ogc:PropertyIsBetween>
<ogc:PropertyName>yta_ha_ans</ogc:PropertyName>
<ogc:LowerBoundary>
<ogc:Literal>0</ogc:Literal>
</ogc:LowerBoundary>
<ogc:UpperBoundary>
<ogc:Literal>100</ogc:Literal>
</ogc:UpperBoundary>
</ogc:PropertyIsBetween>
</ogc:Filter>
<sld:MinScaleDenominator>96000.0</sld:MinScaleDenominator>
<sld:MaxScaleDenominator>192000.0</sld:MaxScaleDenominator>
<PolygonSymbolizer>
<Fill>
<GraphicFill>
<Graphic>
<ExternalGraphic>
<OnlineResource xlink:type="simple"
xlink:href="YMS200_Lst_RI_Kulturmiljövård SnowStar Kringla Brun TEXT
ans110529.svg"/>
<Format>image/svg+xml</Format>
</ExternalGraphic>
<Size>
<ogc:Literal>25</ogc:Literal>
</Size>
</Graphic>
</GraphicFill>
</Fill>
<Stroke>
<CssParameter name="stroke">#8F3E0F</CssParameter>
<CssParameter name="stroke-width">2</CssParameter>
</Stroke>
</PolygonSymbolizer>
<TextSymbolizer>
<Label>Kulturmiljövård</Label>
<Font>
<CssParameter name="font-family">Arial</CssParameter>
<CssParameter name="font-size">12</CssParameter>
<CssParameter name="font-style">normal</CssParameter>
<CssParameter name="font-weight">bold</CssParameter>
</Font>
<LabelPlacement>
<PointPlacement>
<AnchorPoint>
<AnchorPointX>0.0</AnchorPointX>
<AnchorPointY>0.0</AnchorPointY>
</AnchorPoint>
<sld:DisplacementX>0</sld:DisplacementX>
<sld:DisplacementY>20</sld:DisplacementY>
</PointPlacement>
</LabelPlacement>
<VendorOption name="goodnessOfFit">0</VendorOption>
</TextSymbolizer>
</Rule>
<Rule>
<!-- Först Name och Title som skrivs ut i GetLegendGraphics. Därefter
FILTER. Sedan SCALE. Sist SYMBOLIZER ans110419 -->
<ogc:Filter>
<ogc:PropertyIsBetween>
<ogc:PropertyName>yta_ha_ans</ogc:PropertyName>
<ogc:LowerBoundary>
<ogc:Literal>100</ogc:Literal>
</ogc:LowerBoundary>
<ogc:UpperBoundary>
<ogc:Literal>1000</ogc:Literal>
</ogc:UpperBoundary>
</ogc:PropertyIsBetween>
</ogc:Filter>
<sld:MinScaleDenominator>96000.0</sld:MinScaleDenominator>
<sld:MaxScaleDenominator>192000.0</sld:MaxScaleDenominator>
<PolygonSymbolizer>
<Fill>
<GraphicFill>
<Graphic>
<ExternalGraphic>
<OnlineResource xlink:type="simple"
xlink:href="YMS200_Lst_RI_Kulturmiljövård SnowStar Kringla Brun TEXT
ans110529.svg"/>
<Format>image/svg+xml</Format>
</ExternalGraphic>
<Size>
<ogc:Literal>65</ogc:Literal>
</Size>
</Graphic>
</GraphicFill>
</Fill>
<Stroke>
<CssParameter name="stroke">#8F3E0F</CssParameter>
<CssParameter name="stroke-width">3</CssParameter>
</Stroke>
</PolygonSymbolizer>
</Rule>
<Rule>
<!-- Först Name och Title som skrivs ut i GetLegendGraphics. Därefter
FILTER. Sedan SCALE. Sist SYMBOLIZER ans110419 -->
<!-- Jag har inte gjort i ordning dessa intervall SOM SKA VARA TVÅ STYCKEN
1-3-15 Lägger in YMK2000_16 så länge med 300px -->
<ogc:Filter>
<ogc:PropertyIsBetween>
<ogc:PropertyName>yta_ha_ans</ogc:PropertyName>
<ogc:LowerBoundary>
<ogc:Literal>1000</ogc:Literal>
</ogc:LowerBoundary>
<ogc:UpperBoundary>
<ogc:Literal>15000</ogc:Literal>
</ogc:UpperBoundary>
</ogc:PropertyIsBetween>
</ogc:Filter>
<sld:MinScaleDenominator>96000.0</sld:MinScaleDenominator>
<sld:MaxScaleDenominator>192000.0</sld:MaxScaleDenominator>
<PolygonSymbolizer>
<Fill>
<GraphicFill>
<Graphic>
<ExternalGraphic>
<OnlineResource xlink:type="simple"
xlink:href="YMark2000_16_Lst_RI_ Kulturmiljövård SnowStar Kringla S18 Brun
TEXT ans110529.svg"/>
<Format>image/svg+xml</Format>
</ExternalGraphic>
<Size>
<ogc:Literal>300</ogc:Literal>
</Size>
</Graphic>
</GraphicFill>
</Fill>
<Stroke>
<CssParameter name="stroke">#8F3E0F</CssParameter>
<CssParameter name="stroke-width">5</CssParameter>
</Stroke>
</PolygonSymbolizer>
</Rule>
<Rule>
<!-- Först Name och Title som skrivs ut i GetLegendGraphics. Därefter
FILTER. Sedan SCALE. Sist SYMBOLIZER ans110419 -->
<ogc:Filter>
<ogc:PropertyIsBetween>
<ogc:PropertyName>yta_ha_ans</ogc:PropertyName>
<ogc:LowerBoundary>
<ogc:Literal>15000</ogc:Literal>
</ogc:LowerBoundary>
<ogc:UpperBoundary>
<ogc:Literal>100000</ogc:Literal>
</ogc:UpperBoundary>
</ogc:PropertyIsBetween>
</ogc:Filter>
<sld:MinScaleDenominator>96000.0</sld:MinScaleDenominator>
<sld:MaxScaleDenominator>192000.0</sld:MaxScaleDenominator>
<PolygonSymbolizer>
<Fill>
<GraphicFill>
<Graphic>
<ExternalGraphic>
<OnlineResource xlink:type="simple"
xlink:href="YMark2000_4_Lst_RI_ Kulturmiljövård SnowStar Kringla S18 Brun
TEXT ans110529.svg"/>
<Format>image/svg+xml</Format>
</ExternalGraphic>
<Size>
<ogc:Literal>600</ogc:Literal>
</Size>
</Graphic>
</GraphicFill>
</Fill>
<Stroke>
<CssParameter name="stroke">#8F3E0F</CssParameter>
<CssParameter name="stroke-width">5</CssParameter>
</Stroke>
</PolygonSymbolizer>
</Rule>
<Rule>
<!-- Först Name och Title som skrivs ut i GetLegendGraphics. Därefter
FILTER. Sedan SCALE. Sist SYMBOLIZER ans110419 -->
<ogc:Filter>
<ogc:PropertyIsBetween>
<ogc:PropertyName>yta_ha_ans</ogc:PropertyName>
<ogc:LowerBoundary>
<ogc:Literal>100000</ogc:Literal>
</ogc:LowerBoundary>
<ogc:UpperBoundary>
<ogc:Literal>10000000</ogc:Literal>
</ogc:UpperBoundary>
</ogc:PropertyIsBetween>
</ogc:Filter>
<sld:MinScaleDenominator>96000.0</sld:MinScaleDenominator>
<sld:MaxScaleDenominator>192000.0</sld:MaxScaleDenominator>
<PolygonSymbolizer>
<Fill>
<GraphicFill>
<Graphic>
<ExternalGraphic>
<OnlineResource xlink:type="simple"
xlink:href="YMark2000_1_Lst_RI_ Kulturmiljövård SnowStar Kringla S18 Brun
TEXT ans110529.svg"/>
<Format>image/svg+xml</Format>
</ExternalGraphic>
<Size>
<ogc:Literal>600</ogc:Literal>
</Size>
</Graphic>
</GraphicFill>
</Fill>
<Stroke>
<CssParameter name="stroke">#8F3E0F</CssParameter>
<CssParameter name="stroke-width">5</CssParameter>
</Stroke>
</PolygonSymbolizer>
</Rule>
-----Original Message-----
From: andrea.aime@anonymised.com [mailto:andrea.aime@anonymised.com] On Behalf Of
Andrea Aime
Sent: den 12 juni 2011 16:58
To: Anders Söderman
Cc: David Collins; geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] Is it possible to use the active scale on the
screen for calculations in an SLD.
2011/6/12 Anders Söderman <Anders.Soderman@anonymised.com>:
Hello Andrea and David and thanks for your input.
I have tried UOM meter instead of pixels, but it made things even more
complicated as far as I could see.
I guess your problem is not changing the size of the symbolizer based
on the scale then.
I will look into CSS to see if my VERY LARGE SLDs could be made more
"readable" or at least shorter.
That will definitely make for much more compact specifications, easier to
read,
and quicker to write.
Though I guess you may want to use SLDs for a few months to come, at
least until the SLD workshop at FOSS4G :-p
http://2011.foss4g.org/sessions/practical-use-geoserver-sld-wms
One SLD file with 13 scaleintervals each having 3 - 8 areaintervals means
that I have to write the name of the SVG-file, Stroke colours etc many
times.
My guestion:
It would be very nice to be able to start the SLD with PARAMETERS
(SVG_file_1, SVG_file_2 ...) ie.
SVG_file_1 = xyz_1.svg
SVG_file_2 = xyz_2.svg
etc.
and then I only have to change xyz_1.svg, xyz_2.svg etc. to my SVG
filenamnes right in the beginning of the SLD file.
I hope you understand my problem.
Not really no. Seeing the SLD in question would help.
I looked at the "env" variable but I couldn´t figure out if it could be
used.
It is used to pass into the SLD values coming from the WMS request itself.
It is documented here:
http://docs.geoserver.org/stable/en/user/styling/sld-extensions/substitution
.html
If you want to change the name of a SVG on a per request basis you can
do so by adding &env=svg1:symbol1
and then have the following in the SLD (using the dynamic symbolizers
features,
another GeoServer extension):
<OnlineResource xlink:type="simple" xlink:href="${env('svg1')}.svg"/>
that is calling the env function with 'svg1' as the key. You can also
provide a default
value to have a valid SLD even when the parameter is not provided in
the request:
<OnlineResource xlink:type="simple" xlink:href="${env('svg1',
'defaultSymbol')}.svg"/>
In this case if you don't specify the value of svg1 in the request you'll
get
defaultSymbol.svg as the default svg file
Ah, though I never tried, as far as I know most of the above can be
done in CSS as well,
so you can have the style be compact and parametric at the same time.
Hope this helps!
Cheers
Andrea
--
-------------------------------------------------------
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 962313
http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf
-------------------------------------------------------