An example of how to do random colors to a Polygon

This will generate a new random color each time the tile is generated, be aware


Ref:

https://www.mail-archive.com/geoserver-users@lists.sourceforge.net/msg06557.html

<PolygonSymbolizer>
                 <Fill>
                   <CssParameter name="fill">
                     <ogc:Function name="numberFormat">
                       <ogc:Literal>'#'000000</ogc:Literal>
                       <ogc:Mul>
                         <ogc:Function name="random"></ogc:Function>
                         <ogc:Literal>1000000</ogc:Literal>
                       </ogc:Mul>
                     </ogc:Function>
                   </CssParameter>
                   <CssParameter name="fill-opacity">0.7</CssParameter>
                 </Fill>
            <Stroke>
              <CssParameter name="stroke">#000000</CssParameter>
              <CssParameter name="stroke-width">1</CssParameter>
            </Stroke>
          </PolygonSymbolizer>

Chris

________________________________
From: Vera Green <vera.green...@gmail.com>
Sent: Thursday, August 13, 2020 9:41 AM
To: GeoServer Mailing List List
Subject: [EXTERNAL] [Geoserver-users] Vector CSS Color Map

Hello,
We have scoured the styling documentation looking for a way to assign a random 
color map by type. In other words we have a layer which we want to style on a 
field, however we do not want to define each field value individually, we want 
to say:
Using this field, assign a random color to each unique field value.
Is this possible in GeoServer CSS or SLD?

Thanks much,
Vera

NOTICE: This email message and all attachments transmitted with it may contain 
privileged and confidential information, and information that is protected by, 
and proprietary to, Parsons Corporation, and is intended solely for the use of 
the addressee for the specific purpose set forth in this communication. If the 
reader of this message is not the intended recipient, you are hereby notified 
that any reading, dissemination, distribution, copying, or other use of this 
message or its attachments is strictly prohibited, and you should delete this 
message and all copies and backups thereof. The recipient may not further 
distribute or use any of the information contained herein without the express 
written authorization of the sender. If you have received this message in 
error, or if you have any questions regarding the use of the proprietary 
information contained therein, please contact the sender of this message 
immediately, and the sender will provide you with further instructions.
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to