[OpenLayers-Users] request and parse GML

Barbara Fiederer barbara.fiederer at web.de
Wed Nov 18 04:32:08 EST 2009


Hi Pedro, hi list,

thank you for answering my question.

> Is your html code on the same domain of your data? In example: http://
> localhost:8080/mypage.html and http://localhost:8080.
> If not you have to set OpenLayers.ProxyHost so you can request data 
> from other domains. 

I do use a proxy and it works for other Requests.

> Second. You don't need all those parameters on OpenLayers.Request.
> POST. You only need "data", "url" and "callback".

OK, that was because of my attempts to solve my problem. I erased all but the three you suggested.

> Third. As I see on your code, you are doing a request to Geoserver to 
> grab a GML and your callback function is processing it and adding its 
> features to a Vector Layer.
> 
> You could do this directly by using OpenLayers.Layer.Vector() and 
> using GML arguments. Check these examples:
> 1- http://openlayers.org/dev/examples/gml-layer.html
> 2- http://openlayers.org/dev/examples/behavior-fixed-http-gml.html
> 3- http://openlayers.org/dev/examples/wfs-protocol.html
> 
> I am pretty sure example 3 is exactly what you are looking for.

Not exactly: I need to get selected sets of features. I can use example three and get some thousand features that correctly show on the map after a looooong time.
I need to set a filter, but the filter that worked with the post-request, that I tried first and described in my mail, does not work with the WFS-protocol. 

So, now I read through all the filter WFS and BBox discussions and still do not know whether it is possible do what I try here:
var filter_body = new OpenLayers.Filter.Logical({
				type: OpenLayers.Filter.Logical.OR,
				filters: [
						new OpenLayers.Filter.Comparison({
						    type: OpenLayers.Filter.Comparison.EQUAL_TO,
						    property: "infotext",
						    value: "FS330117000000"
						}),
						new OpenLayers.Filter.Comparison({
						    type: OpenLayers.Filter.Comparison.EQUAL_TO,
						    property: "infotext",
						    value: "FS350067900000"
						}),
						new OpenLayers.Filter.Comparison({
						    type: OpenLayers.Filter.Comparison.EQUAL_TO,
						    property: "infotext",
						    value: "FS350068000000"
						})
				]
			});

var DBsellayer = new OpenLayers.Layer.Vector("WFS", {
                    strategies: [new OpenLayers.Strategy.Fixed()],
                    protocol: new OpenLayers.Protocol.WFS({
                        url:  "http://myDomain.com:8090/geoserver/wfs",
                        featureType: "flurst",
                        data: filter_body,
			featureNS: "http://myDomain.com/demo"
			
                    })
                });
map.addLayer(DBsellayer);

I do use Strategy.Fixed because this seems to fix the BBox/Filter-Problem of a WFS-Protocol. But the Layer always shows all features.

Thanks  in advance for answering

Babsi
______________________________________________________
GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://movieflat.web.de




More information about the Users mailing list