Dear Till, Christopher and Alexandre, thank you again. Some steps further but not at the target :-(
@Till: I got your example doing an onmouseover with an OpenLayers.Popup. The internal id is recognised but I don`t get for example the name, gid or other attributes as you did by: "myFeature.data.gid", "myFeature.data.name" etc. An "alert (myFeature.data.gid);" in my case is undefined: ---> http://www.tourismus-maps.de/behncke/openlayers/workshop/test_wfs_1.html?lon_lat=8.05612609964141,52.2713145994324 Is there a special way you declared the "data"-Object? @Alexandre: I got your example to run locally with your WFS, but not yet with mine: http://www.tourismus-maps.de/behncke/openlayers/workshop/test_wfs_2.html?lon_lat=8.05612609964141,52.2713145994324 In your example you did: ----------- wfs = new OpenLayers.Layer.Vector("States (SVG)", { styleMap: styleMap, projection: new OpenLayers.Projection("EPSG:4326"), strategies: [new OpenLayers.Strategy.BBOX()], protocol: new OpenLayers.Protocol.WFS({ version: "1.0.0", url: "http://sigma.openplans.org/geoserver/ows", featureType: "states", srsName: "EPSG:4326", featureNS: "http://www.openplans.org/topp", geometryName: "the_geom", schema: "http://sigma.openplans.org/geoserver/wfs?service=WFS&version=1.0.0&request=DescribeFeatureType&typeName=topp:states" }) }); ------------ As it`s written here (http://dev.openlayers.org/apidocs/files/OpenLayers/Protocol/WFS/v1-js.html) the URL should be the WFS-Service I think, but so far no succes (neither with: http://www.tourismus-maps.de/cgi-bin/mapserv?map=/home/promotion/behncke/gastronomap_wms/gastronomap_wfs.map&SERVICE=WFS&VERSION=1.0.0&Request=GetFeature&Typename=gastronomie_wfs nor with:http://www.tourismus-maps.de/cgi-bin/mapserv?map=/home/promotion/behncke/gastronomap_wms/gastronomap_wfs.map) I wonder what happens at your: featureNS: "http://www.openplans.org/topp" ? In the moment I try with: ------------------ wfs = new OpenLayers.Layer.Vector("gastronomy", { styleMap: styleMap, projection: new OpenLayers.Projection("EPSG:900913"), strategies: [new OpenLayers.Strategy.BBOX()], protocol: new OpenLayers.Protocol.WFS({ version: "1.0.0", url: "http://www.tourismus-maps.de/cgi-bin/mapserv?map=/home/promotion/behncke/gastronomap_wms/gastronomap_wfs.map", featureType: "gastronomie_wfs", srsName: "EPSG:900913", featurePrefix: "feature", geometryName: "the_geom_900913", schema: "http://www.tourismus-maps.de/cgi-bin/mapserv?map=/home/promotion/behncke/gastronomap_wms/gastronomap_wfs.map&service=WFS&version=1.0.0&request=DescribeFeatureType&typeName=gastronomie_wfs" }) }); ------------- ....but neither the wfs-objects are visualized nor does the popup-window appear. I think it might has something to do with featureNS:?? Might the problem occur because I`m using a WFS by UMN MapServer, it shouldn`t, should it? Has anybody an idea please? Thank you in advance, Kai -------- Original-Nachricht -------- > Datum: Thu, 26 Feb 2009 11:19:53 -0500 > Von: Alexandre Dube <[email protected]> > An: Kai Behncke <[email protected]> > CC: Till Adams <[email protected]>, [email protected] > Betreff: Re: [OpenLayers-Users] Displaying attributes by onmouseover > Hi Kai, > > I've accomplished this kind of feature by customizing my own control. > Its main purpose is to "highlight" features, but there's already a > "displayPopup" property set to true by default. You could customize the > content of the popup to do what you want it to do and that should do the > trick. > > See an example and the code : > > http://dev.openlayers.org/sandbox/adube/openlayers/examples/highlight-feature.html > http://svn.openlayers.org/sandbox/adube/openlayers/lib/OpenLayers/Control/HighlightFeature.js > > Or, you could use displayPopup:false and register your own featureset > event, like in this example which displays Ext.Windows instead of a OL > popup : ( click on the "edit road" button ) > > http://dev4.mapgears.com/bdga-mapfish/bdgaWFS-T.html > > Hope this helps, > > Alexandre > > Kai Behncke wrote: > > Hi Till, > > > > > > thank you for the code :-) > > It`s quite helpful,although I didn`t get it to run as I want so far. > > > > The wfs is correctly visualized, I use that one: > > > http://www.gastronomap.de/cgi-bin/mapserv?map=/home/promotion/behncke/gastronomap_wms/gastronomap_wfs.map&SERVICE=WFS&VERSION=1.0.0&Request=GetFeature&Typename=gastronomie_wfs > > > > If I do a mouseover at the different points of the wfs the following > > > > feature_info_hover(arguments[0], gastronomap_wfs) is called. > > > > > > I try: > > > > function feature_info_hover(feature, myWfsLayer) > > { > > alert (myWfsLayer.getFeatureById(feature.gid)); > > > > > > ...and get always an alert with "null". > > > > (an "alert (feature);" gives an alert with [object Object], so I think > the arguments[0]-parameter is transported correctly). > > > > Has anybody an idea why the gid of the feature doesn`t appear in the > alert? > > > > Best regards, Kai > > -------- Original-Nachricht -------- > > > >> Datum: Tue, 24 Feb 2009 15:20:45 +0100 > >> Von: Till Adams <[email protected]> > >> An: Kai Behncke <[email protected]>, [email protected] > >> Betreff: Re: [OpenLayers-Users] Displaying attributes by onmouseover > >> > > > > > >> Kai Behncke schrieb: > >> > >>> Dear Openlayers-Users, > >>> > >>> > >>> I use an application with a couple of point objects (500) visualized > by > >>> > >> a wms in the map. > >> > >>> I´m looking for a function that pops up a small window (for example > >>> > >> with the name of an object) if I do a mouseover at an object in the > map. > >> > >>> I think for this using a second layer ("invisible" wfs) could be best > >>> > >> practise (or which other possibilities shall be usable)?? > >> > >>> As far as I can see a script like that does not exist in the examples > >>> > >> (if I haven`t overseen it.....). > >> > >>> I would like to try to write one and supply it. > >>> What is the way if I want to supply a script like that to the > examples? > >>> > >>> Best regards, Kai Behncke > >>> > >>> > >> Kai, > >> > >> > >> we use WFS and the select feature from OL:: > >> > >> ** > >> * ------------------------------------------------------------------- > >> * feature_info_hover > >> * function to hover a feature open a new pop up window and destroy > >> * it after 3000 milliseconds (variable at end of function) > >> * > >> * @feature > >> * ------------------------------------------------------------------- > >> */ > >> function feature_info_hover(feature, myWfsLayer) > >> { > >> if (this.popup && NABU.MAP && NABU.MAP.popups && > >> NABU.MAP.popups.length > 0) > >> { > >> window.clearTimeout(this.autodestroy); > >> this.popup.destroy(); > >> this.popup = null; > >> } > >> var myFeature = myWfsLayer.getFeatureById(feature.id); > >> > >> if (myFeature) > >> { > >> > >> var window_position = new > >> OpenLayers.LonLat(myFeature.geometry.x, myFeature.geometry.y); > >> this.popup = new OpenLayers.Popup("ol-info-popup", > >> window_position, null, '<div class="map-kurzinfo-popup"><span>' + > >> myFeature.data.name + '</span><br><span > onclick="javascript:OpenInfo(\'' > >> + myFeature.data.gid + '\',\'' + myWfsLayer.typename + '\')" > >> style="cursor:pointer;">weitere Informationen</span></div>', false); > >> this.popup.autoSize = true; > >> map.addPopup(this.popup, true); > >> this.autodestroy = window.setTimeout(function() > >> { > >> if (map && map.popups && map.popups.length > 0) > >> { > >> var len = map.popups.length; > >> for (var i = 0; i < len; i++) > >> { > >> if (map.popups[i] && map.popups[i].destroy) > >> { > >> map.popups[i].destroy(); > >> } > >> } > >> } > >> }, 3000); > >> } > >> } > >> > >> See that we refer manually to "myFeature.data.gid", > >> "myFeature.data.name" and "myFeature.data.typename" which is not really > >> them ost elegant way... > >> > >> Then initiate it through that code in the ol init function: > >> > >> > >> hover.parken = new OpenLayers.Control.SelectFeature(tbl_p_parken, { > >> callbacks: { > >> 'over': function() > >> { > >> feature_info_hover(arguments[0], tbl_p_parken); > >> } > >> } > >> }); > >> map.addControl(hover.parken); > >> hover.parken.activate(); > >> > >> > >> Where "tbl_p_parken" is our WFS defined in the layer section of the ol > >> init function. This only works for one layer as the select feature of > OL > >> in the moment only handles one layer, this is to be changed on the next > >> OL versions. > >> > >> Regards, Till > >> > >> > >> ---------------------------------------------------------- > >> terrestris GmbH & Co. KG > >> Irmintrudisstrasse 17 > >> 53111 Bonn > >> Germany > >> > >> Till Adams > >> Geschäftsführung > >> > >> Tel: +49 (0)228 / 962 899-52 > >> Fax: +49 (0)228 / 962 899-57 > >> [email protected] http://www.terrestris.de > >> Amtsgericht Bonn, HRA 6835 > >> --------------------------------------------------------- > >> > >> Komplementärin: > >> > >> terrestris Verwaltungs GmbH > >> > >> vertreten durch: > >> Hinrich Paulsen, Till Adams > >> > > > > > > > -- > Alexandre Dubé > Mapgears > www.mapgears.com -- Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger01 _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
