TransWikia.com

OpenLayers.Filter.Comparison value charecter encoding

Geographic Information Systems Asked by barteloma on December 11, 2020

I am using vector layer with WFS protocol

var adressVector = new OpenLayers.Layer.Vector("Adress", {
  strategies: [new OpenLayers.Strategy.BBOX()],
    protocol: new OpenLayers.Protocol.WFS({
    url: "http://localhost:8080/geoserver/wfs",
    featurePrefix:"compa",
    featureType: "adress_location",
    featureNS: "http://localhost:8080/location",
    srsName: "EPSG:4326",
    geometryName: "the_geom",
    version: "1.0.0"
  })
});

I want to get addresses with some filter and adding filters property fo vector layer:

var adressVector = new OpenLayers.Layer.Vector("Adress", {
  strategies: [new OpenLayers.Strategy.BBOX()],
    protocol: new OpenLayers.Protocol.WFS({
    url: "http://localhost:8080/geoserver/wfs",
    featurePrefix:"compa",
    featureType: "adress_location",
    featureNS: "http://localhost:8080/location",
    srsName: "EPSG:4326",
    geometryName: "the_geom",
    version: "1.0.0",
    "filter": new OpenLayers.Filter.Logical({
          type: OpenLayers.Filter.Logical.OR,
          filters: [
                    new OpenLayers.Filter.Comparison({
                        "type": OpenLayers.Filter.Comparison.EQUAL_TO,
                        "property": 'name',
                        "value": "BÖRT De Sem"
                    })
                ]
          })
  })
});

But this filter creates a WFS XML like this.

<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.1.0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<wfs:Query typeName="compa:adress_location" srsName="EPSG:4326">
  <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
    <ogc:Or>
       <ogc:PropertyIsEqualTo matchCase="true">
          <ogc:PropertyName>name</ogc:PropertyName>
          <ogc:Literal>B�RT De Sem</ogc:Literal>
       </ogc:PropertyIsEqualTo>
   </ogc:Or>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>

I mean my vaue property is ugly charectes.

“BÖRT De Sem” is going “B�RT De Sem”

So no feature found.

How can I solve this problem?

One Answer

You could try

   "value": encodeURI("BÖRT De Sem")

instead of

"value": "BÖRT De Sem"

Answered by Thomas B on December 11, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP