[OpenLayers-Users] GetFeature with WFS protocol doesn't return features
Lauri Kajan
lauri.kajan at gmail.com
Fri Feb 22 14:45:37 PST 2013
Hi again,
The problem still occurs.
And I can now confirm that it is not due any incomplete server response. I
looked network traffic with fiddler and it revealed that the response is
valid gml. I even copied the respond to a file and it opens to QGIS with no
problems.
Have any of you any ideas what to look next. How should I debug this?
Here is my completed code:
var selection = new OpenLayers.Control.GetFeature({
protocol: new OpenLayers.Protocol.WFS({
version: "1.1.0",
url: "***",
featurePrefix: '***',
featureType: "***",
featureNS: "***",
geometryName: "geom",
srsName: "EPSG:3067",
outputFormat: "GML2"
}),
click: true,
clickTolerance: 1,
single: true,
hover: false
});
selection.events.register("featureselected", this, function(e) {
//do something with the feature
});
map.addControl(selection);
selection.activate();
-Lauri
On Wed, Feb 20, 2013 at 4:18 PM, Gery . <gamejihou at hotmail.com> wrote:
> Could you paste the server responses and URL? I've never work with
> proxi.cgi because I test and run things in local machines for both client
> and backend. I've read once some problems about longer strings, perhaps
> that's the issue.
>
> Sent from my iBath
>
> On Feb 20, 2013, at 14:59, "Lauri Kajan" <lauri.kajan at gmail.com> wrote:
>
> I think I found the reason, but not yet any solution.
>
> Actually the response that wfs-server sent was not valid. It was cutted
> after around 23000 characters.
> What could affect that. Is it the proxy.cgi that cannot pass longer
> strings or is something else?
>
> -Lauri
>
>
> On Wed, Feb 20, 2013 at 11:04 AM, Gery . <gamejihou at hotmail.com> wrote:
>
>> Hi Lauri,
>>
>> not sure but the problem can be related to how the features are called (and
>> thus stored) to be then selected. If featureselected never gets triggered,
>> that should mean that it is not called. The callback you show what
>> actually does? I think taking a look to the whole code will be more
>> useful.
>>
>> Regards,
>>
>> Gery
>>
>>
>>
>> __________________________________________________________________________________________
>> Piensa en el medio ambiente - mantenlo en la pantalla. NO lo imprimas si
>> NO es necesario.
>> Think green - keep it on the screen. Do NOT print if it is NOT necessary.
>> Denken Sie an die Umwelt - bewahren Sie es auf dem Bildschirm. Drucken
>> Sie es NICHT, wenn es NICHT notwendig ist.
>>
>>
>> ------------------------------
>> Date: Wed, 20 Feb 2013 09:23:02 +0200
>> From: lauri.kajan at gmail.com
>> To: openlayers-users at lists.osgeo.org
>> Subject: Re: [OpenLayers-Users] GetFeature with WFS protocol doesn't
>> return features
>>
>>
>> Hi Gery,
>>
>> The execution never get that far. Featureselected is not triggered.
>> Problem is in the request method of GetFeature class or actually much
>> deeper but that httprequest code gets too complex for me to understand.
>>
>> In the request method of GetFeature class result.features.length is 0 so
>> it never selects anything.
>>
>> *Request method of GetFeature class:*
>> callback: function(result) {
>> if(result.success()) {
>> if(result.features.length) {
>> if(options.single == true) {
>> this.selectBestFeature(result.features,
>> bounds.getCenterLonLat(), options);
>> } else {
>> this.select(result.features);
>> }
>>
>> -Lauri
>>
>>
>>
>> On Wed, Feb 20, 2013 at 12:35 AM, Gery . <gamejihou at hotmail.com> wrote:
>>
>> perhaps using some:
>>
>> console.log("WHAT IT IS GOING ON WITH": feat);
>> console.log("WHAT IT IS GOING ON WITH": bbox);
>> console.log("WHAT IT IS GOING ON WITH": center);
>>
>> can help you to find the error.
>>
>>
>> __________________________________________________________________________________________
>> Piensa en el medio ambiente - mantenlo en la pantalla. NO lo imprimas si
>> NO es necesario.
>> Think green - keep it on the screen. Do NOT print if it is NOT necessary.
>> Denken Sie an die Umwelt - bewahren Sie es auf dem Bildschirm. Drucken
>> Sie es NICHT, wenn es NICHT notwendig ist.
>>
>>
>> ------------------------------
>> Date: Wed, 20 Feb 2013 00:31:15 +0200
>> From: lauri.kajan at gmail.com
>> To: openlayers-users at lists.osgeo.org
>> Subject: [OpenLayers-Users] GetFeature with WFS protocol doesn't return
>> features
>>
>>
>> Hello,
>>
>> When I'm trying to use GetFeature control to get features from my WFS run
>> into problems. The "featureselected" event never gets triggered.
>> I debugged it little bit and found out that the wfs request itself return
>> a valid gml and the status code of the request is 200. But still the
>> features array of the result object is empty so the code never gets to the
>> select method of the GetFeature class.
>>
>> Is this something to do with a proxy that I have set?
>> I have set OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";
>>
>> I have configured GetFeature control as follows:
>>
>> var select = new OpenLayers.Control.GetFeature({
>> protocol: OpenLayers.Protocol.WFS({
>> url: "**:8080/geoserver/wfs",
>> featureType: "**",
>> featureNS: "**",
>> geometryName: "geom"
>> }),
>> click: true,
>> clickTolerance: 1,
>> single: true,
>> hover: false
>> });
>> select.events.register("featureselected", this, function(e) {
>> var feat = e.feature;
>> var bbox = feat.geometry.bounds;
>> var center = bbox.getCenterLonLat();
>> map.panTo(center);
>> });
>>
>>
>> I would appreciate all the help
>> Thanks
>>
>>
>> -Lauri
>>
>> _______________________________________________ Users mailing list
>> Users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>
>>
>>
>> _______________________________________________ Users mailing list
>> Users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130223/3bcce7ad/attachment.html>
More information about the Users
mailing list