0

How can we add category based styling to geometry point my application show geoserver rendered map, and all the map POI are directly fetched from database and shown to the map.i need know how we can add different style for different points please help me

database used is POSTGIS

1
1

There are several options I can think of, but there are probably more and better ways to do it.

  1. Depending on how many styles you need, you could create a new rule for each style you need. Set a filter on each type of style like this:

    <ogc:Filter>
       <ogc:PropertyIsEqualTo>
         <ogc:PropertyName>POI_TYPE</ogc:PropertyName>
         <ogc:Literal>Rainbow</ogc:Literal>
        </ogc:PropertyIsEqualTo>
     </ogc:Filter>
    
  2. You also use the database to color you POI's differently. You can fill your database with HEX colors and tell the SLD to use it like this:

    <PointSymbolizer>
     <Graphic>
      <Mark>
       <Fill>
        <CssParameter name="fill">
        <ogc:PropertyName>SLD_COLOUR</ogc:PropertyName>
        </CssParameter>
       </Fill>
       <WellKnownName>circle</WellKnownName>
      </Mark>
      <Size>5.0</Size>
     </Graphic>
    </PointSymbolizer>
    

You can also look at http://osgeo-org.1560.x6.nabble.com/SLD-for-attribute-based-polygon-td3789822.html

I have tried to do this with the "WellKNownName" shapes, but this has failed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.