SLD rules are processed on single features at a time, so they cannot express
constraints on the colors of neighboring features. I can think of a couple
of options:
- Approximate the coloring by simply assigning random colors to each
polygon. Actually you would probably want something a little different from
random to avoid countries changing colors between renderings (which would be
particularly noticeable on tiled maps.) So really, you'd probably want to
take the modulus of the hash of some property and use that to choose the
color. I don't think modulus or hash functions are available in SLD so you
would need to write a filter function plugin to provide these.
- Precalculate the coloring using another tool. There are lots of
well-known algorithms for this task (see
http://en.wikipedia.org/wiki/Graph_coloring) but I don't know of an
implementation that is ready-built, so you'd have to write some code for
this one as well, or do it by hand if the dataset is small enough. Once the
coloring is determined you could add a column to the database table with an
appropriate field.
Hope this helps.
--
David Winslow
OpenGeo - http://opengeo.org/
2010/9/17 ZZH <zhuhua...@163.com>
> hi all, I want to write a sld file for a polygon layer.
> the requirement is that the adjacent polygons must have different color.
>
> how to write it?
> Thanks.
>
>
> ------------------------------
> 全国最低价,天天在家冲照片,24小时发货上门! <http://yxp.163.com/photo/ep.html?sss=fromyx0911>
>
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________
> Geoserver-users mailing list
> Geoserver-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>
>
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users