Hi. Yes.

"x-ruleEvaluation: first" works.



first feature is red. Only first rule applied.

So the documentation is really incorrectly. Should I report it to the issue
tracker as you offered?


вт, 23 июл. 2019 г. в 16:35, Jody Garnett <[email protected]>:

> Were you able to try the above?
> --
> Jody Garnett
>
>
> On Fri, 19 Jul 2019 at 21:56, Jody Garnett <[email protected]> wrote:
>
>> The "x-" is used to indicate that this is a extension to the base SLD
>> spec. YSLD does not do anything special here it just generates the
>> equivalent data structure as SLD would....
>>
>> Searching through the code:
>> https://github.com/geotools/geotools/search?q=firstMatch&unscoped_q=firstMatch
>> only shows "firstMatch" in documentation - so something is odd here.
>>
>> Reading the docs
>> https://docs.geotools.org/latest/userguide/library/render/style.html#featuretypestyle
>>
>> firstMatch: stops rule evaluation after the first match (making it easier
>> to work with datasets where content is classified by distinct attribute
>> values)
>>
>> // exit rules on first match, like a switch statement
>> fts.getOptions().put("ruleEvaluation", "first");
>>
>>
>> So try experimenting with x-ruleEvaulation: "first"
>>
>>
>> --
>> Jody Garnett
>>
>>
>> On Fri, 19 Jul 2019 at 06:42, groznykh <[email protected]> wrote:
>>
>>> Hello.
>>>
>>> According to  documentation
>>> <
>>> https://docs.geoserver.org/stable/en/user/styling/ysld/reference/featurestyles.html#syntax>
>>>
>>> x-firstMatch property of featureType in YSLD style "Stops rule evaluation
>>> after the first match". But somehow it does not.
>>>
>>> I use:
>>>
>>> - window 7
>>> - GeoServer 2.15.2
>>> - mongoDB plugin (for GeoServer 2.15.2)
>>> - YSLD plugin (for GeoServer 2.15.2)
>>>
>>> I populated mongoDB collection with two records:
>>>
>>> - {
>>>     "name" : "name 1",
>>>     "geom" : {
>>>         "type" : "Polygon",
>>>         "coordinates" : [
>>>             [
>>>                 [
>>>                     101.200407,
>>>                     58.922034
>>>                 ],
>>>                 [
>>>                     102.200221,
>>>                     58.918487
>>>                 ],
>>>                 [
>>>                     102.200161,
>>>                     59.917305
>>>                 ],
>>>                 [
>>>                     101.200228,
>>>                     59.916561
>>>                 ],
>>>                 [
>>>                     101.200407,
>>>                     58.922034
>>>                 ]
>>>             ]
>>>         ]
>>>     }
>>> }
>>>
>>> - {
>>>     "name" : "name 2",
>>>     "geom" : {
>>>         "type" : "Polygon",
>>>         "coordinates" : [
>>>             [
>>>                 [
>>>                     103.200407,
>>>                     58.922034
>>>                 ],
>>>                 [
>>>                     104.200221,
>>>                     58.918487
>>>                 ],
>>>                 [
>>>                     104.200161,
>>>                     59.917305
>>>                 ],
>>>                 [
>>>                     103.200228,
>>>                     59.916561
>>>                 ],
>>>                 [
>>>                     103.200407,
>>>                     58.922034
>>>                 ]
>>>             ]
>>>         ]
>>>     }
>>> }
>>>
>>>
>>> Then I create a layer and an YSLD style for that layer:
>>>
>>> feature-styles:
>>> - name: some_name
>>>   *x-firstMatch: true*
>>>   rules:
>>>   - filter: ${name = 'name 1'}
>>>     symbolizers:
>>>     - polygon:
>>>         fill-color: 'red'
>>>         fill-opacity: 0.5
>>>         stroke-color: 'red'
>>>         stroke-opacity: 0.5
>>>   - symbolizers:
>>>     - polygon:
>>>         fill-color: 'yellow'
>>>         fill-opacity: 0.5
>>>         stroke-color: 'yellow'
>>>         stroke-opacity: 0.5
>>>
>>> In preview the feature with name = 'name 1' is orange (both rules are
>>> applied) and the feature with name = 'name 2' is yellow. But first
>>> feature
>>> should be red (not orange) - only first rule should be applied.
>>>
>>> </file/t385081/KAgqWDPuEYyeym.jpg>
>>>
>>> Why so?
>>>
>>> Thanks in advance for any help
>>>
>>>
>>>
>>> --
>>> Sent from:
>>> http://osgeo-org.1560.x6.nabble.com/GeoServer-User-f3786390.html
>>>
>>>
>>> _______________________________________________
>>> 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
>>>
>>>
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>>>
>>
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Без
вирусов. www.avast.ru
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
_______________________________________________
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


[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to