[OpenLayers-Users] WFS Layers, Markers, Popups
Lehtonen, Mika
mika at digikartta.net
Mon Oct 27 12:51:01 EDT 2008
Hi Indika,
maybe you can get something out of this code of mine. I can explain it
better later on when I have better time. BTW: hiiri is a mouse in
Finnish ;-)
cheers,
mika
map.events.register('click', null, function (e) {
OpenLayers.Util.getElement('nodelist').innerHTML = "Odota hetki...";
var hiiri = wfs.map.getLonLatFromPixel(e.xy);
var hiirixy = (hiiri.lat+','+hiiri.lon);
var url = wfs.getFullRequestString({
SERVICE: 'WFS',
VERSION: '1.1.0',
REQUEST: 'GetFeature',
OUTPUTFORMAT: 'json',
PROPERTYNAME: 'the_geom,LAYER',
MAXFEATURES: 5,
TYPENAME: 'dikanet:karsa_region',
SRSNAME: 'EPSG:2393',
FILTER: '<wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc" service="WFS" version="1.1.0" xmlns:gml="http://www.opengis.net/gml"><gml:featureMember><ogc:Filter><ogc:Contains><ogc:PropertyName>the_geom</ogc:PropertyName><gml:Point><gml:coordinates>'+hiirixy+'</gml:coordinates></gml:Point></ogc:Contains></ogc:Filter></gml:featureMember></wfs:FeatureCollection>'
},
"http://karsamaki.digikartta.net/asemakaavat/wfs"
);
Indika Tantrigoda kirjoitti:
> Hi,
> I have a wfs layer that displays points on my map, using markers.
> I would like to have a popup that displays data regarding the point
> which would get activated for a click event.
>
> I tried the following but, it seems to return all the data regarding
> the wfs layer, not the single point, irrespective of
> where I click on the map.
>
> wfs_cities.events.register('click', map, function (e) {
> document.getElementById('nodelist').innerHTML =
> "Loading... please wait...";
> var url = map.layers[2].getFullRequestString(
> {
> REQUEST: "GetFeature",
> EXCEPTIONS: "application/vnd.ogc.se_xml",
> BBOX: map.getExtent().toBBOX(),
> X: e.xy.x,
> Y: e.xy.y,
> INFO_FORMAT: 'text/html',
> QUERY_LAYERS: map.layers[2].params.LAYERS,
> FEATURE_COUNT: 50,
> WIDTH: map.size.w,
> HEIGHT: map.size.h
> },
> "http://localhost:8080/geoserver/wfs"
> );
>
> Any ideas how I can get around this ?
>
> Thanks in advance.
>
> Regards,
> Indika
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
More information about the Users
mailing list