1

Suppose there are 100,000 points, all of them will be rendered at a small scale with the default style, we can use Rules in SLD style to filter features by properties. But most of the tutorial told me to render, but there are still two problems:

  1. There are no extra properties for the layer

For example, if the feature only have a name property, every feature have the same property, it would be better if GeoServer can filter/simplify the features (maybe discard some of them randomly) according to the current scale.

  1. There are more properties related to the styling.

For example, if two properties(area,typecode) have to be considered during the styling and priority = f(area,typecode), then if two features will overlap at the current scale, feature with the lower priority should be discarded.

Is this possible in GeoServer?

1

While a Priority element is possible for text labels it is not a general property of all symbolizers, so you will need to create an expression based on the existing functions or write a custom one to achieve this.

I suspect that you could do something like:

<ogc:Filter>
  <ogc:PropertyIsLessThan>
    <ogc:Function name="random"/>
    <ogc:Mul>
      <ogc:Function name="env">wms_scale_denominator</ogc:Function>
      <ogc:Literal>0.01</ogc:Literal>
    </ogc:Mul>
   </ogc:PropertyIsLessThan>
<ogc:Filter>

as a solution to your first problem, and add in a custom function to multiply the values for the second one.

Alternatively, a PointStacker or some other transform would be an easier solution?

| improve this answer | |
  • Thanks, you may save my life, I'll have a try. – giser May 24 at 2:38
  • The solution you provided, I am not exactly sure what it means. Does it preserve the density distribution of the data? – giser May 25 at 8:52
  • it tests a random number between 0 & 1 against the scale_denominator * a constant. So it throws away a random amount of the data related to the scale - should preserve density (mostly) – Ian Turton May 25 at 9:49

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.