On Feb 10, 2011, at 10:48 AM, ext Daniel Degasperi wrote:

> Hi Chris,
> I admit it is a ugly hack.
> 
> I'm working localy on my machine, so I can't give you the exact url.
> The url was constructed with following lines of code:
> 
> var queryModel = queryableLayers[featureType];
> var filter = new OpenLayers.Filter.Comparison({
>     type: OpenLayers.Filter.Comparison.EQUAL_TO,
>     property: fieldName,
>     value: fieldValue
> });
> var filter_1_0 = new OpenLayers.Format.Filter({version: "1.0.0"});
> var xml = new OpenLayers.Format.XML();
> var filterValue = xml.write(filter_1_0.write(filter));
> 
> // create WFS url
> var wfsUrl = 
> queryModel.layer.url+'PROJECT='+queryModel.layer.parameters.project+'&MAP='+queryModel.layer.parameters.map+'&SERVICE=WFS&VERSION=1.0.0&REQUEST=GETFEATURE'
>                         + '&SRS='+gisclient.options.mapsetData.projection
>                         + '&TYPENAME='+featureType
>                         + '&FILTER='+filterValue;
> 
> Maybe the right solution is to quote each url parameter value (in proxy or in 
> javascript), espacially the xml strings, to avoid problems of truncated 
> parameter values.

I don't know much about filters, but this looks like it is a problem on your 
client side, yes. I would recommend instead of building a long string by
hand, you build your query string with:

 OpenLayers.Util.getParameterString({'FILTER': filterValue})

etc.

This function will handle the encoding the parameter pieces for
you (and makes your code cleaner to boot).

-- Chris

> Daniel
> 
> Am 10/02/2011 15:38, schrieb [email protected]:
>> On Feb 10, 2011, at 9:15 AM, ext Daniel Degasperi wrote:
>> 
>> 
>>> Hi,
>>> I used the proxy.py script (equivalent to the proxy.cgi in OpenLayers 
>>> example) with a WFS request, on which I applied a OGC filter.
>>> The proxy didn't work as normally, because of a space-character in middle 
>>> of my OGC filter.
>>> 
>>> The solution I've applied was to quote the part of the OGC filter:
>>> start = url.find("<ogc:Filter")
>>> end = url.find("</ogc:Filter>")
>>> 
>>> urlPre = url[:start]
>>> urlFilter = url[start:end+13]
>>> urlPost = url[end+13:]
>>> url = urlPre + urllib.quote(urlFilter) + urlPost
>>> 
>>> Could this solution be integrated in the example?
>>> 
>> I don't know that I understand what you're suggesting here,
>> but encoding the specifics of OGC filter rules into the proxy.cgi
>> in the OpenLayers examples is probably not the right solution.
>> 
>> Can you give an example of the URL to proxy.py that you used to 
>> reproduce this? 
>> 
>> Like:
>>   
>> http://openlayers.org/dev/examples/proxy.cgi?url=http://example.com/ogcfilterhere
>> 
>> 
>> Thanks,
>> Chris
>> 
>> 
>>> Best regards,
>>> Daniel
>>> 
>>> 
>>> -- 
>>> Daniel Degasperi
>>> R3 GIS Srl - GmbH
>>> Via Johann Kravogl-Str. 2
>>> I-39012 Meran/Merano (BZ)
>>> web: 
>>> www.r3-gis.com
>>> 
>>> Email: 
>>> [email protected]
>>> 
>>> Tel. : +39 0473 494949
>>> Fax : +39 0473 069902
>>> 
>>> ATTENZIONE! Le informazioni contenute nella presente e-mail e nei documenti 
>>> eventualmente allegati sono confidenziali. La loro diffusione, 
>>> distribuzione e/o riproduzione da parte di terzi, senza autorizzazione del 
>>> mittente è vietata e può violare il D. Lgs. 196/2003. In caso di ricezione 
>>> per errore, Vogliate immediatamente informare il mittente del messaggio e 
>>> distruggere la e-mail.
>>> 
>>> ACHTUNG! Die in dieser Nachricht oder in den beigelegten Dokumenten 
>>> beinhalteten Informationen sind streng vertraulich. Ihre Verbreitung 
>>> und/oder ihre Wiedergabe durch Dritte ist ohne Erlaubnis des Absenders 
>>> verboten und verstößt gegen das Legislativdekret 196/2003. Sollten Sie 
>>> diese Mitteilung irrtümlicherweise erhalten haben, bitten wir Sie uns 
>>> umgehend zu informieren und anschließend die Mitteilung zu vernichten.
>>> 
>>> WARNING! This e-mail may contain confidential and/or privileged 
>>> information. If you are not the intended recipient (or have received this 
>>> e-mail in error) please notify the sender immediately and destroy this 
>>> e-mail. Any unauthorised copying, disclousure or distribution of the 
>>> material in this e-mail is strictly forbidden and could be against the law 
>>> (D. Lgs. 196/2003)
>>> 
>>> 
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> Users mailing list
>>> 
>>> [email protected]
>>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
> 
> 
> -- 
> Daniel Degasperi
> R3 GIS Srl - GmbH
> Via Johann Kravogl-Str. 2
> I-39012 Meran/Merano (BZ)
> web: www.r3-gis.com
> Email: [email protected]
> Tel. : +39 0473 494949
> Fax : +39 0473 069902
> 
> ATTENZIONE! Le informazioni contenute nella presente e-mail e nei documenti 
> eventualmente allegati sono confidenziali. La loro diffusione, distribuzione 
> e/o riproduzione da parte di terzi, senza autorizzazione del mittente è 
> vietata e può violare il D. Lgs. 196/2003. In caso di ricezione per errore, 
> Vogliate immediatamente informare il mittente del messaggio e distruggere la 
> e-mail.
> 
> ACHTUNG! Die in dieser Nachricht oder in den beigelegten Dokumenten 
> beinhalteten Informationen sind streng vertraulich. Ihre Verbreitung und/oder 
> ihre Wiedergabe durch Dritte ist ohne Erlaubnis des Absenders verboten und 
> verstößt gegen das Legislativdekret 196/2003. Sollten Sie diese Mitteilung 
> irrtümlicherweise erhalten haben, bitten wir Sie uns umgehend zu informieren 
> und anschließend die Mitteilung zu vernichten.
> 
> WARNING! This e-mail may contain confidential and/or privileged information. 
> If you are not the intended recipient (or have received this e-mail in error) 
> please notify the sender immediately and destroy this e-mail. Any 
> unauthorised copying, disclousure or distribution of the material in this 
> e-mail is strictly forbidden and could be against the law (D. Lgs. 196/2003)
> 
> 
> 
> 
> 

_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to