[Geoserver-users] Use of colour palettes in GeoServer WMS

Hi to the GeoServer community,

We are implementing a GeoServer WMS with a very simple shapefile that shows a Spanish administrative division and we would like to render every polygon with different colours, assigned randomly. Would it be possible to use a colour palette in GeoServer? How could it be done in the SLD files?

Thanks in advance,

José Miguel


José Miguel Rubio Iglesias

Subdirección General de Aplicaciones Geográficas

Instituto Geográfico Nacional

C/General Ibáñez de Ibero, 3 28003 MADRID

Despacho: A 0002 Teléfono: 91 597 97 51

E-mail: jmrubio@anonymised.com

Rubio Iglesias José Miguel ha scritto:

Hi to the GeoServer community,

We are implementing a GeoServer WMS with a very simple shapefile that shows a Spanish administrative division and we would like to render every polygon with different colours, assigned randomly. Would it be possible to use a colour palette in GeoServer? How could it be done in the SLD files?

There is no support for random colors chosen out of a palette.
Plus, if it was truly random, each time you render the map you'd
get different colors.

I guess what you really need is a tool that generates a SLD with
random colors. Maybe uDig can do that (you can copy a and paste
the styles generated by uDig into GeoServer) or the GeoServer Styler
extension. Not sure in either case.

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Andrea Aime wrote:

Rubio Iglesias José Miguel ha scritto:
  

Hi to the GeoServer community,

We are implementing a GeoServer WMS with a very simple shapefile that shows a Spanish administrative division and we would like to render every polygon with different colours, assigned randomly. Would it be possible to use a colour palette in GeoServer? How could it be done in the SLD files?
    
There is no support for random colors chosen out of a palette.
Plus, if it was truly random, each time you render the map you'd
get different colors.

I guess what you really need is a tool that generates a SLD with
random colors. Maybe uDig can do that (you can copy a and paste
the styles generated by uDig into GeoServer) or the GeoServer Styler
extension. Not sure in either case.

Cheers
Andrea
  

Do we cache the images used for fill , or are they reloaded for every feature that is rendered ?

If they are not cached, you could use an external image as fill, and use something like PHP to have it be random.

Not hacky at all :wink:

-Arne

Arne Kepp ha scritto:

Andrea Aime wrote:

Rubio Iglesias José Miguel ha scritto:

Hi to the GeoServer community,

We are implementing a GeoServer WMS with a very simple shapefile that shows a Spanish administrative division and we would like to render every polygon with different colours, assigned randomly. Would it be possible to use a colour palette in GeoServer? How could it be done in the SLD files?
    
There is no support for random colors chosen out of a palette.
Plus, if it was truly random, each time you render the map you'd
get different colors.

I guess what you really need is a tool that generates a SLD with
random colors. Maybe uDig can do that (you can copy a and paste
the styles generated by uDig into GeoServer) or the GeoServer Styler
extension. Not sure in either case.

Cheers
Andrea
  

Do we cache the images used for fill , or are they reloaded for every feature that is rendered ?

We do cache them

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.