[OpenLayers-Users] How to re-format the tables in popups?

Sveen Atle Frenvik (Geomatikk IKT) Atle.Frenvik.Sveen at geomatikk.no
Thu Aug 19 05:50:20 EDT 2010


As you are using getFeatureInfo you are displaying a table generated by 
your wms-server (which seems to be Geoserver, right?).

In that case I guess the simplest fix is to edit the getfeatureInfo 
templete in geoserver, as described here: 
http://geoserver.org/display/GEOSDOC/GetFeatureInfo+templates


(technically i guess you could try and alter the returned html in 
javascript, but i wouldn't go there...)

-atle

On 08/19/2010 06:07 AM, geekjack wrote:
> http://osgeo-org.1803224.n2.nabble.com/file/n5438892/popup.png
>
> Hi All!
>     See the Image ?
>          I use the codes below to get features , and the features showed like
> that which is a long and unfriendly table in the map.
>          now I got two problems:
>          (1)I just want some attributes of the clicked feature. for example .
> when I click the map on the "WY",I just want the popup show its "state_name"
> and "state_fips" of "WY",
>          (2) and the next step I want to do is puting the data in a more
> friendly table,such as this:
> http://osgeo-org.1803224.n2.nabble.com/file/n5438892/2.png ,
>          what should be change and how?   thank you!!
>
>          part of my codes:
> 		 var state = new OpenLayers.Layer.WMS(
> 		    "state 2","http://localhost:8081/geoserver/wms",
>                      {
>                          layers: 'topp:states',
>                          styles: '',
>                          srs: 'EPSG:4326',
>                          format: format
>                       }     );
>    	info = new OpenLayers.Control.WMSGetFeatureInfo({
>              url: 'http://localhost:8081/geoserver/wms',
>              title: 'Identify features by clicking',
>              queryVisible: true,
>              eventListeners: {
>                  getfeatureinfo: function(event){
> 				if(event.text.length != 687) {
>                      map.addPopup(new OpenLayers.Popup.FramedCloud(
>                          "chicken",
>                          map.getLonLatFromPixel(event.xy),
>                          null,
>                          event.text,
>                          null,
>                          true
>                      ));
>                  }
>              }
> 			}
>          });
>          map.addControl(info);
>          info.activate();
>    


-- 
Atle Frenvik Sveen
Utvikler
Geomatikk IKT AS
tlf: 45 27 86 89
atle.frenvik.sveen at geomatikk.no

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100819/f5cd05c9/attachment.html


More information about the Users mailing list