Hi

I tried LIKE operator in filter of YLSD and SLD styles

YSLD:
feature-styles:
- rules:
  - filter: ${ "measurements.name" LIKE 'wind%' }
    symbolizers:
    - point:
        size: 16
        symbols:
        - mark:
            shape: circle
            fill-color: '#00F'

SLD:
<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor version="1.0.0"
                       xsi:schemaLocation="http://www.opengis.net/sld
StyledLayerDescriptor.xsd"
                       xmlns="http://www.opengis.net/sld";
                       xmlns:ogc="http://www.opengis.net/ogc";
                       xmlns:xlink="http://www.w3.org/1999/xlink";
                       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
">
  <NamedLayer>
    <UserStyle>
      <FeatureTypeStyle>
        <Rule>
          <ogc:Filter>
            <ogc:PropertyIsLike wildCard="%" singleChar="." escape="\">
              <ogc:PropertyName>measurements.name</ogc:PropertyName>
              <ogc:Literal>wind%</ogc:Literal>
            </ogc:PropertyIsLike>
          </ogc:Filter>
          <PointSymbolizer>
            <Graphic>
              <Mark>
                <WellKnownName>circle</WellKnownName>
                <Fill>
                  <CssParameter name="fill">#00F</CssParameter>
                </Fill>
              </Mark>
              <Size>16</Size>
            </Graphic>
          </PointSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

None of them work.

Nuno Oliveira said

> On top of Jody answer I will add that this thread is related with this one:
>
> http://osgeo-org.1560.x6.nabble.com/CQL-filter-OR-operator-does-not-work-on-attributes-that-are-multiple-on-MongoDB-DataSource-td5408541.html


Firstly I thought the same. But CQL filter - "measurements.name" LIKE
'wind%' - of the layer works (both point-layers are visilbe)

<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>

сб, 20 июл. 2019 г. в 08:10, Jody Garnett <[email protected]>:

> I think only a few of the filters are set up to work with multiples (say
> in the result of a join), I imagine these could be adapted to work on a
> dataset that has some kind of array type natively...
> It is relatively uncommon to have multiples so not a lot of functions are
> going to be set up to work with this way, so you may need to work on the
> code ...
>
> Can you try a filter that is known to work with multiples just to see if
> MongoDB is setup to consider this idea? There should be some kind of "match
> action" "any" "all" "one" that would be appropriate ... here are the
> geotools docs:
> https://docs.geotools.org/latest/userguide/library/opengis/filter.html#matchaction
>
> Looking at the diagram there it appears that LIKE is a "multi valued
> filter" so the option would be supported if you were doing an XML query.
> I am not sure if ECQL supports this idea so you may have a feature request
> ...
>
>
>
>
> --
> Jody Garnett
>
>
> On Fri, 19 Jul 2019 at 10:42, Artem Groznykh <[email protected]>
> wrote:
>
>> Hello.
>>
>> I use:
>>
>> - window 7
>> - mongoDB 3.6
>> - GeoServer 2.15.2
>> - mongoDB plugin (for GeoServer 2.15.2)
>> - YSLD plugin (for GeoServer 2.15.2)
>>
>> I've created a collection with data from here
>> <https://docs.geoserver.org/stable/en/user/data/app-schema/mongo-tutorial.html#use-case>
>>  (just
>> two records), created 2dsphere index
>>
>> Then I've created a layer and an YSLD style for that layer.
>>
>> When I use simple attributes (that are not multiple) in the filter all is
>> fine:
>>
>> feature-styles:
>> - rules:
>>   - filter: ${"name" ILIKE 'station%'}
>>     symbolizers:
>>     - point:
>>         size: 16
>>         symbols:
>>         - mark:
>>             shape: circle
>>             fill-color: '#00F'
>>
>> [image: test_multifields_YSLD.jpg]
>>
>>
>> When I use attributes that are multiple in the filter then it DOES NOT
>> work
>>
>> feature-styles:
>> - rules:
>>   - filter: ${ "measurements.name" = 'wind' }
>>     symbolizers:
>>     - point:
>>         size: 16
>>         symbols:
>>         - mark:
>>             shape: circle
>>             fill-color: '#00F'
>>
>> [image: test_multifields_YSLD (1).jpg]
>>
>>
>> Maybe it relates somehow to the bug
>> <https://osgeo-org.atlassian.net/browse/GEOS-9291> that I reported (when
>> OR operator does not work in CQL filter of a layer with multiple attributes)
>>
>> How can I make it work?
>>
>>
>> <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>
>> <#m_8429073423488944350_m_-1510410678340779583_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
>>
>
_______________________________________________
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