Now with a subject J
De: Pedro Mendes [mailto:pmendes@anonymised.com]
Enviada: quinta-feira, 8 de Julho de 2010 17:54
Para: ‘geoserver-users@lists.sourceforge.net’
Assunto:
Hi list,
Is there a way to configure a SLD having linesymbolizers so that line geometries (we’ve an attribute that identifies similar geometries) look like they are merged?
We’ve this
And we’re trying to have this
(these samples are not the same geometries)
Best regards,
Pedro Mendes
The typical approach to solving this problem is to render the two linesymbolizers in separate featuretypestyles. You can see how this is done in the ‘line with border’ example from the SLD Cookbook:
http://docs.geoserver.org/stable/en/user/styling/sld-cookbook/lines.html#line-with-border
As a shameless self-promotion, I’d also like to point out the CSS community module, which would let you achieve this very tersely (reducing the amount of boilerplate needed for specifying rendering order is one of its strong points):
- {
stroke: grey, yellow;
stroke-width: 6px, 4px;
stroke-z-index: 0, 10;
}
If you’re interested, the docs are here: http://docs.geoserver.org/stable/en/user/community/css/index.html
David Winslow-5 wrote:
The typical approach to solving this problem is to render the two
linesymbolizers in separate featuretypestyles. You can see how this is
done in the 'line with border' example from the SLD Cookbook:
http://docs.geoserver.org/stable/en/user/styling/sld-cookbook/lines.html#line-with-border
Yeah, we admit we were a kind of lazy asking this...sorry! Of course there
was already useful info present in the cookbook!
David Winslow-5 wrote:
As a shameless self-promotion, I'd also like to point out the CSS
community module, which would let you achieve this very tersely
(reducing the amount of boilerplate needed for specifying rendering
order is one of its strong points):
Not at all! Great plugin! We know it and we're eager to use it in our
production environments. Right now we're kind of in a migration process from
GS 1.7.7 to to GS 2.x series.
A question not regarding this topic but the CSS module (I dont know if this
make sense...): the RESTful interface will support this kind of
configuration or if we wanna change a SLD we've always to submit in a XML
format?
Much appreciate for the tip!
Thanks!
Pedro Mendes
--
View this message in context: http://old.nabble.com/Styling-roads%3A-is-merging-possicble--tp29109590p29111744.html
Sent from the GeoServer - User mailing list archive at Nabble.com.
On 07/08/2010 05:03 PM, Pedro Mendes wrote:
David Winslow-5 wrote:
The typical approach to solving this problem is to render the two
linesymbolizers in separate featuretypestyles. You can see how this is
done in the 'line with border' example from the SLD Cookbook:
http://docs.geoserver.org/stable/en/user/styling/sld-cookbook/lines.html#line-with-border
Yeah, we admit we were a kind of lazy asking this...sorry! Of course there
was already useful info present in the cookbook!
David Winslow-5 wrote:
As a shameless self-promotion, I'd also like to point out the CSS
community module, which would let you achieve this very tersely
(reducing the amount of boilerplate needed for specifying rendering
order is one of its strong points):
Not at all! Great plugin! We know it and we're eager to use it in our
production environments. Right now we're kind of in a migration process from
GS 1.7.7 to to GS 2.x series.
A question not regarding this topic but the CSS module (I dont know if this
make sense...): the RESTful interface will support this kind of
configuration or if we wanna change a SLD we've always to submit in a XML
format?
Much appreciate for the tip!
Thanks!
Pedro Mendes
The CSS module's integration in GeoServer is pretty loose right now. Apart from the form it adds to the UI, there is no part of GeoServer that understands the CSS syntax. The form just creates SLD files and configures GeoServer to use them (which produces the quirk/feature that you can transfer a datadir to a GeoServer that doesn't have the CSS module installed and keep using the styles). I have a number of ideas for integrating it more deeply (not just PUTting CSS to the REST API, but using CSS_BODY in a WMS request and things like that) but I only have so much time Patches and donations are always welcome, if you want to nudge those features forward.
--
David Winslow
OpenGeo - http://opengeo.org/
On Thu, Jul 8, 2010 at 1:40 PM, David Winslow <dwinslow@anonymised.com> wrote:
As a shameless self-promotion, I’d also like to point out the CSS community module, which would let you achieve this very tersely (reducing the amount of boilerplate needed for specifying rendering order is one of its strong points):
- {
stroke: grey, yellow;
stroke-width: 6px, 4px;
stroke-z-index: 0, 10;
}
I haven’t had a chance to play with the CSS module yet, so this may be a stupid question but if the above generates two featureStyle entries how would I create two rules in one featureStyle?
Ian
–
Ian Turton
The CSS module emulates CSS’s cascading model to recombine rule properties (instead of SLD’s painter’s module.) So, there’s not generally a one-to-one mapping between CSS rules and SLD rules.
Symbolizers with the same z-index are assigned to the same feature type style. The default z-index is just a constant 0 so everything ends up in one featuretypestyle by default.
- { /* everything should be blue */
stroke: blue;
}
[type=‘primary’] { /* except when it is a primary road, those should be red */
stroke: red;
}
gets translated to two rules - one for [type=‘primary’] and one for [type != ‘primary’ OR type IS NULL] - like so:
sld:FeatureTypeStyle
sld:Namename</sld:Name>
sld:Rule
ogc:Filter
ogc:Or
ogc:PropertyIsNotEqualTo
ogc:PropertyNametype</ogc:PropertyName>
ogc:Literalprimary</ogc:Literal>
</ogc:PropertyIsNotEqualTo>
ogc:PropertyIsNull
ogc:PropertyNametype</ogc:PropertyName>
</ogc:PropertyIsNull>
</ogc:Or>
</ogc:Filter>
sld:LineSymbolizer
sld:Stroke
<sld:CssParameter name=“stroke”>#0000ff</sld:CssParameter>
</sld:Stroke>
</sld:LineSymbolizer>
</sld:Rule>
sld:Rule
ogc:Filter
ogc:PropertyIsEqualTo
ogc:PropertyNametype</ogc:PropertyName>
ogc:Literalprimary</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
sld:LineSymbolizer
sld:Stroke
<sld:CssParameter name=“stroke”>#ff0000</sld:CssParameter>
</sld:Stroke>
</sld:LineSymbolizer>
</sld:Rule>
</sld:FeatureTypeStyle>
Maybe a little confusing coming from SLD, but it makes it really easy to do things like change widths and opacities for different scale denominators without repeating yourself over and over:
- {
stroke: black;
stroke-width: 6px;
stroke-linejoin: round;
stroke-linecap: round;
}
[@scale < 1000000] { /* inherits unspecified properties from the more generic rule */
stroke-width: 3px;
}