Hi zhoujian_ab your OpenLayers application is running and all layers are displayed fine? What's the output after clicking on an object?
Regards, Ingo * zhoujian_ab <[email protected]> [20091009 03:08]: > > Hi: > I am following the example of getfeatureinfo-popup to write down the code. > And I want to use geoservers example to get the feature in my local computer > like the example when click the object I can see its feature in a popup > window. However, I can't. I don't know why. Please help me . Thanks a lot. > > <html> > <head> > <title>GetFeatureInfo Popup</title> > <script src="openlayers/OpenLayers.js"></script> > <link rel="stylesheet" href="source/style1.css" type="text/css" /> > <link rel="stylesheet" href="source/style.css" type="text/css" /> > <script> > OpenLayers.ProxyHost = "proxy.cgi?url="; > > var map, info; > > function load() { > map = new OpenLayers.Map({ > div: "map", > maxExtent: new OpenLayers.Bounds(143.834,-43.648,148.479,-39.573) > }); > var political = new OpenLayers.Layer.WMS("State Boundaries", > "http://localhost:8081/geoserver/wms", > {'layers': 'topp:tasmania_state_boundaries', transparent: true, > format: 'image/gif'}, > {isBaseLayer: true} > ); > var water = new OpenLayers.Layer.WMS("Bodies of Water", > "http://localhost:8081/geoserver/wms", > {'layers': 'topp:tasmania_water_bodies', transparent: true, > format: 'image/gif'}, > {isBaseLayer: false} > ); > //what's mean of the red code?(I capy form the example) > var highlight = new OpenLayers.Layer.Vector("Highlighted Features", { > displayInLayerSwitcher: false, > isBaseLayer: false > }); > > map.addLayers([political,water, highlight]); > info = new OpenLayers.Control.WMSGetFeatureInfo({ > url: 'http://localhost:8081/geoserver/wms', > 'layers': 'topp:tasmania_water_bodies', > queryVisible: true, > eventListeners: { > getfeatureinfo: function(event) { > map.addPopup(new OpenLayers.Popup.FramedCloud( > "chicken", > map.getLonLatFromPixel(event.xy), > null, > event.text, > null, > true > )); > } > } > }); > map.addControl(info); > info.activate(); > map.addControl(new OpenLayers.Control.LayerSwitcher()); > map.zoomToMaxExtent(); > } > </script> > </head> > <body onload="load()"> > <h1 id="title">Feature Info in Popup</h1> > <div id="tags"></div> > <p id="shortdesc"> > Demonstrates the WMSGetFeatureInfo control for fetching information > about a position from WMS (via GetFeatureInfo request). Results > are displayed in a popup. > </p> > <div id="map" class="smallmap"></div> > <div id="docs"></div> > </body> > </html> > > 2009-10-09 > > > > zhoujian_ab > _______________________________________________ > Users mailing list > [email protected] > http://openlayers.org/mailman/listinfo/users -- Ingo Weinzierl <[email protected]> | Tel.: +49 (0)541-33 508 3773 Intevation GmbH, Neuer Graben 17, 49074 OS | AG Osnabrück - HR B 18998 Geschäftsführer: Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
