[OpenLayers-Users] how to query wms, like wfs?

zach cruise zachc1980 at gmail.com
Tue Feb 25 21:14:13 PST 2014


yeah, got a mix of wms and wfs (gml), it's just that vector points
that show up together are hard to separately identify - they do have
different "fid"s, so trying to filter on that.

typically, i'd:
1. call -
	query = new OpenLayers.Control.SelectFeature(layer, {callbacks:
{'click': result}});
2. loop -
    for(var i in feature.attributes){
		html += feature.attributes[i]; // i = name
	}

but this doesn't get me the "fid", so using
http://dev.openlayers.org/sandbox/pinch/examples/GMLParser.html
(http://dev.openlayers.org/sandbox/pinch/examples/gml/owls.xml):
1. call -
	OpenLayers.loadURL("gml/owls.xml", "", null, parseData); // deprecated, wtf?!
2. loop -
	for(var i in features){
		html += new OpenLayers.Format.GML().read(responseText)[i].geometry;
	}
but where is the "fid"? stepping up and down the node tree shouldn't
be this dense.


On 2/25/14, Phil Scadden <p.scadden at gns.cri.nz> wrote:
> On 26/02/2014 12:11 p.m., zach cruise wrote:
>> thanks phil, i got that to work also, it being a pure javascript fix.
>>
>> but for vector points with the same coordinates, fid returns "null".
>>
>> alert(feature.fid);
>>
>> is there a way to extract their attributes (OpenLayers.Format.GML?)?
> I'd examine the feature data structure in the debugger where you put the
> Alert in. However, I dont work much with vector data (in my experience
> draw with WMS and query with WFS is the fastest way to do things) so not
> a lot of help. I am assuming that the vector data originated in GML in
> the first place?
>
> --
> Phil Scadden, Senior Scientist GNS Science Ltd 764 Cumberland St,
> Private Bag 1930, Dunedin, New Zealand Ph +64 3 4799663, fax +64 3 477 5232
>
> Notice: This email and any attachments are confidential.
> If received in error please destroy and immediately notify us.
> Do not copy or disclose the contents.
>
>


More information about the Users mailing list