[Users] Adding WFS layers from Grid/Store to mappanel

Nomeneta Saili nome.saili at gmail.com
Fri Sep 9 05:22:16 CEST 2011


Hi people,

I have this code which creates a grid and store than loads my
collection of WFS layers on my local Geoserver into the grid. However
the Add to Map (mappanel) part is not working and i am not sure if its
the right way to go about it. Any tips would be greatly apperciated.

Thanks,

Nome

var grid1 = new Ext.grid.GridPanel({
        		title: "Available WFS Layers",
			region: "east",
        		renderTo: document.body,
        		width: 800,
        		height: 300,
        		viewConfig: {forceFit: true},
        		store: new GeoExt.data.WFSCapabilitiesStore({
                		url:
"/geoserver/ows?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetCapabilities",
                		protocolOptions: {version: "1.1.0"},
        			fields: ['EPC_Assets'],
                 		autoLoad: true
        		}),
        		columns: [
            			{header: "Name", dataIndex: "name", sortable: true},
            			{header: "Title", dataIndex: "title", sortable: true},
            			{header: "Abstract", dataIndex: "abstract"}
        		],
			bbar: [{
        		    text: "Add To Map",
        		    handler: function() {
            		        grid.getSelectionModel().each(function(record) {
                		    var clone = record.clone();
                		    clone.get("layer").mergeNewParams({
                    			format: "image/png",
                    			transparent: true
                		    });
                	            mapPanel.layers.add(clone);
                	            mapPanel.map.zoomToExtent(
                    	
OpenLayers.Bounds.fromArray(clone.get("llbbox"))
                	            );
            		        });
        	            }
    		        }]
            	  });

On Thu, Sep 8, 2011 at 1:25 AM,  <users-request at geoext.org> wrote:
> Send Users mailing list submissions to
>        users at geoext.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://www.geoext.org/cgi-bin/mailman/listinfo/users
> or, via email, send a message with subject or body 'help' to
>        users-request at geoext.org
>
> You can reach the person managing the list at
>        users-owner at geoext.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Users digest..."
>
>
> Today's Topics:
>
>   1. GeoExt.Action (Button) to show/hide Layer (Kai Volland)
>   2. Re: GeoExt.Action (Button) to show/hide Layer (gbrun)
>   3. Copyright popup with google maps api v3 and GeoExt (Neil Penman)
>   4. Re: Copyright popup with google maps api v3 and GeoExt
>      (Andreas Hocevar)
>   5. Re: GeoExt.Action (Button) to show/hide Layer (Kai Volland)
>   6. Re: Copyright popup with google maps api v3 and GeoExt
>      (Neil Penman)
>   7. Re: GeoExt.Action (Button) to show/hide Layer (gbrun)
>   8. Re: Tutorial / Documentation for Query Panels in GeoExt?
>      (Philippe Rufin)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 08 Sep 2011 12:05:44 +0200
> From: Kai Volland <kaivolland at web.de>
> Subject: [Users] GeoExt.Action (Button) to show/hide Layer
> To: users at geoext.org
> Message-ID: <4E689378.3010309 at web.de>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi Users,
>
> i've some issues with using a Button to show/hide a Layer in my map.
>
> 1. "checked:true" doesn't work
> 2. I get an error whne first check and uncheck the button:
>             this.control is undefined
>                  this.control.activate();
>             this.control is undefined
>                  this.control.deactivate();
>
> 3. Afterwards the button seems to work, but unchecking it doesn't affect
> the Layer (it stays visible).
>
> CODE:
>     var action1 = new GeoExt.Action({
>         text: 'Sites',
>         map: map,
>         tooltip: 'NESPOS - SITES',
>         enableToggle: true,
>         handler: function(toggled){
>             if (toggled) {
>                 nespos.setVisibility(true);
>             } else {
>                 nespos.setVisibility(false);
>             }
>         },
>         checked: true
>     });
>     actions["Sites"] = action1;
>     toolbarItems.push(action1);
>     toolbarItems.push("-");
>
>
> Kind regards,
>
> Kai
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://www.geoext.org/pipermail/users/attachments/20110908/aa73a34b/attachment-0001.htm
>
> ------------------------------
>
> Message: 2
> Date: Thu, 08 Sep 2011 13:20:46 +0200
> From: gbrun <gbrun at myopera.com>
> Subject: Re: [Users] GeoExt.Action (Button) to show/hide Layer
> To: users at geoext.org, "Kai Volland" <kaivolland at web.de>
> Message-ID: <op.v1hlswvuyqc6xb at asensio.parc.local>
> Content-Type: text/plain; charset=iso-8859-15; format=flowed;
>        delsp=yes
>
> You try to use a GeoExt action. For this, you need to define an OpenLayers
> control. That's why you received this 'undefined' message.
>
> Instead of GeoExt action, try to use a classic Ext button and it should
> work (only if you don't have any OpenLayers control). For the "checked"
> problem, I think you can use "pressed" instead.
>
> Geoffrey
>
>
> On Thu, 08 Sep 2011 12:05:44 +0200, Kai Volland <kaivolland at web.de> wrote:
>
>> Hi Users,
>>
>> i've some issues with using a Button to show/hide a Layer in my map.
>>
>> 1. "checked:true" doesn't work
>> 2. I get an error whne first check and uncheck the button:
>>              this.control is undefined
>>                   this.control.activate();
>>              this.control is undefined
>>                   this.control.deactivate();
>>
>> 3. Afterwards the button seems to work, but unchecking it doesn't affect
>> the Layer (it stays visible).
>>
>> CODE:
>>      var action1 = new GeoExt.Action({
>>          text: 'Sites',
>>          map: map,
>>          tooltip: 'NESPOS - SITES',
>>          enableToggle: true,
>>          handler: function(toggled){
>>              if (toggled) {
>>                  nespos.setVisibility(true);
>>              } else {
>>                  nespos.setVisibility(false);
>>              }
>>          },
>>          checked: true
>>      });
>>      actions["Sites"] = action1;
>>      toolbarItems.push(action1);
>>      toolbarItems.push("-");
>>
>>
>> Kind regards,
>>
>> Kai
>
>
> --
> Using Opera's revolutionary email client: http://www.opera.com/mail/
>
>
> ------------------------------
>
> Message: 3
> Date: Thu, 8 Sep 2011 21:57:00 +1000
> From: Neil Penman <neilpenman at gmail.com>
> Subject: [Users] Copyright popup with google maps api v3 and GeoExt
> To: users at geoext.org
> Message-ID:
>        <CAPCQpVoTYungonN5GNEeS=kAzOJHQjGAFSXC6G7nqo_qqNaBAg at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi,
>
> Is there a published example of GeoExt using google maps api version 3?  I
> am getting the large popup copyright notice in the bottom left corner.  If
> not any suggestions on how to hide this popup?
>
> Regards
>
> Neil
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://www.geoext.org/pipermail/users/attachments/20110908/01719504/attachment-0001.htm
>
> ------------------------------
>
> Message: 4
> Date: Thu, 8 Sep 2011 13:58:52 +0200
> From: Andreas Hocevar <ahocevar at opengeo.org>
> Subject: Re: [Users] Copyright popup with google maps api v3 and
>        GeoExt
> To: Neil Penman <neilpenman at gmail.com>
> Cc: users at geoext.org
> Message-ID: <82688821-6F79-4679-B3A7-E53783F3B7D9 at opengeo.org>
> Content-Type: text/plain; charset=us-ascii
>
> Hi,
>
> please upgrade to a newer version of OpenLayers, because the GMaps API version that Layer.Google.v3 in OpenLayers 2.10 was written for is no longer available.
>
> Andreas.
>
> On Sep 8, 2011, at 13:57 , Neil Penman wrote:
>
>> Hi,
>>
>> Is there a published example of GeoExt using google maps api version 3?  I am getting the large popup copyright notice in the bottom left corner.  If not any suggestions on how to hide this popup?
>>
>> Regards
>>
>> Neil
>> _______________________________________________
>> Users mailing list
>> Users at geoext.org
>> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>
> --
> Andreas Hocevar
> OpenGeo - http://opengeo.org/
> Expert service straight from the developers.
>
>
>
> ------------------------------
>
> Message: 5
> Date: Thu, 08 Sep 2011 14:06:32 +0200
> From: Kai Volland <kaivolland at web.de>
> Subject: Re: [Users] GeoExt.Action (Button) to show/hide Layer
> To: users at geoext.org
> Message-ID: <4E68AFC8.7000407 at web.de>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Thx Geoffrey!
>
> Problem 1 and 2 are solved.
> But the third one still doesn't work. Is this function with "toggled"
> the right way?
>
> Kai
>
>
> Am 08.09.2011 13:20, schrieb gbrun:
>> You try to use a GeoExt action. For this, you need to define an OpenLayers
>> control. That's why you received this 'undefined' message.
>>
>> Instead of GeoExt action, try to use a classic Ext button and it should
>> work (only if you don't have any OpenLayers control). For the "checked"
>> problem, I think you can use "pressed" instead.
>>
>> Geoffrey
>>
>>
>> On Thu, 08 Sep 2011 12:05:44 +0200, Kai Volland<kaivolland at web.de>  wrote:
>>
>>> Hi Users,
>>>
>>> i've some issues with using a Button to show/hide a Layer in my map.
>>>
>>> 1. "checked:true" doesn't work
>>> 2. I get an error whne first check and uncheck the button:
>>>               this.control is undefined
>>>                    this.control.activate();
>>>               this.control is undefined
>>>                    this.control.deactivate();
>>>
>>> 3. Afterwards the button seems to work, but unchecking it doesn't affect
>>> the Layer (it stays visible).
>>>
>>> CODE:
>>>       var action1 = new GeoExt.Action({
>>>           text: 'Sites',
>>>           map: map,
>>>           tooltip: 'NESPOS - SITES',
>>>           enableToggle: true,
>>>           handler: function(toggled){
>>>               if (toggled) {
>>>                   nespos.setVisibility(true);
>>>               } else {
>>>                   nespos.setVisibility(false);
>>>               }
>>>           },
>>>           checked: true
>>>       });
>>>       actions["Sites"] = action1;
>>>       toolbarItems.push(action1);
>>>       toolbarItems.push("-");
>>>
>>>
>>> Kind regards,
>>>
>>> Kai
>>
>
>
>
> ------------------------------
>
> Message: 6
> Date: Thu, 8 Sep 2011 22:11:08 +1000
> From: Neil Penman <neilpenman at gmail.com>
> Subject: Re: [Users] Copyright popup with google maps api v3 and
>        GeoExt
> To: Andreas Hocevar <ahocevar at opengeo.org>
> Cc: users at geoext.org
> Message-ID:
>        <CAPCQpVr7p1NogNoWoEhHjXH7YeXiEg9jif5fUvimrD=ToT=38Q at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Perfect.  Thankyou!
>
> On Thu, Sep 8, 2011 at 9:58 PM, Andreas Hocevar <ahocevar at opengeo.org>wrote:
>
>> Hi,
>>
>> please upgrade to a newer version of OpenLayers, because the GMaps API
>> version that Layer.Google.v3 in OpenLayers 2.10 was written for is no longer
>> available.
>>
>> Andreas.
>>
>> On Sep 8, 2011, at 13:57 , Neil Penman wrote:
>>
>> > Hi,
>> >
>> > Is there a published example of GeoExt using google maps api version 3?
>>  I am getting the large popup copyright notice in the bottom left corner.
>>  If not any suggestions on how to hide this popup?
>> >
>> > Regards
>> >
>> > Neil
>> > _______________________________________________
>> > Users mailing list
>> > Users at geoext.org
>> > http://www.geoext.org/cgi-bin/mailman/listinfo/users
>>
>> --
>> Andreas Hocevar
>> OpenGeo - http://opengeo.org/
>> Expert service straight from the developers.
>>
>>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://www.geoext.org/pipermail/users/attachments/20110908/3ac43d38/attachment-0001.htm
>
> ------------------------------
>
> Message: 7
> Date: Thu, 08 Sep 2011 14:15:44 +0200
> From: gbrun <gbrun at myopera.com>
> Subject: Re: [Users] GeoExt.Action (Button) to show/hide Layer
> To: users at geoext.org
> Message-ID: <op.v1hocitnyqc6xb at asensio.parc.local>
> Content-Type: text/plain; charset=iso-8859-15; format=flowed;
>        delsp=yes
>
> You're right! Wrong function!
>
> I currently use this one:
>
> toggleHandler: function (button, state){
>        if (state == true){
>          ********
>        }else{
>          ********
>        }
> }
>
> Geoffrey
>
>
> On Thu, 08 Sep 2011 14:06:32 +0200, Kai Volland <kaivolland at web.de> wrote:
>
>> Thx Geoffrey!
>>
>> Problem 1 and 2 are solved.
>> But the third one still doesn't work. Is this function with "toggled"
>> the right way?
>>
>> Kai
>>
>>
>> Am 08.09.2011 13:20, schrieb gbrun:
>>> You try to use a GeoExt action. For this, you need to define an
>>> OpenLayers
>>> control. That's why you received this 'undefined' message.
>>>
>>> Instead of GeoExt action, try to use a classic Ext button and it should
>>> work (only if you don't have any OpenLayers control). For the "checked"
>>> problem, I think you can use "pressed" instead.
>>>
>>> Geoffrey
>>>
>>>
>>> On Thu, 08 Sep 2011 12:05:44 +0200, Kai Volland<kaivolland at web.de>
>>> wrote:
>>>
>>>> Hi Users,
>>>>
>>>> i've some issues with using a Button to show/hide a Layer in my map.
>>>>
>>>> 1. "checked:true" doesn't work
>>>> 2. I get an error whne first check and uncheck the button:
>>>>               this.control is undefined
>>>>                    this.control.activate();
>>>>               this.control is undefined
>>>>                    this.control.deactivate();
>>>>
>>>> 3. Afterwards the button seems to work, but unchecking it doesn't
>>>> affect
>>>> the Layer (it stays visible).
>>>>
>>>> CODE:
>>>>       var action1 = new GeoExt.Action({
>>>>           text: 'Sites',
>>>>           map: map,
>>>>           tooltip: 'NESPOS - SITES',
>>>>           enableToggle: true,
>>>>           handler: function(toggled){
>>>>               if (toggled) {
>>>>                   nespos.setVisibility(true);
>>>>               } else {
>>>>                   nespos.setVisibility(false);
>>>>               }
>>>>           },
>>>>           checked: true
>>>>       });
>>>>       actions["Sites"] = action1;
>>>>       toolbarItems.push(action1);
>>>>       toolbarItems.push("-");
>>>>
>>>>
>>>> Kind regards,
>>>>
>>>> Kai
>>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at geoext.org
>> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>
>
> --
> Using Opera's revolutionary email client: http://www.opera.com/mail/
>
>
> ------------------------------
>
> Message: 8
> Date: Thu, 8 Sep 2011 14:25:36 +0200
> From: Philippe Rufin <philippe.rufin at googlemail.com>
> Subject: Re: [Users] Tutorial / Documentation for Query Panels in
>        GeoExt?
> To: Matt Priour <mpriour at kestrelcomputer.com>, users at geoext.org
> Message-ID:
>        <CAC1gkPxqGkhjOJ9PwfN7F_jAepw6kL6br9ubGb_eqZ99JGiKZQ at mail.gmail.com>
> Content-Type: text/plain; charset="windows-1252"
>
> **
> Hi Matt,
>
> thanks for the fast answer. I added the override-ext-ajax.js, the requests
> are now send with the URL parameter:
>
> http://localhost/cgi-bin/proxy.cgi?url=http%3A%2F%2Flocalhost%2Fcgi-bin%2Fproxy.cgi%2Fwfs%3FVERSION%3D1.1.0%26REQUEST%3DDescribeFeatureType%26TYPENAME%3Dcases%26query%3D
>
> It seems, something?s still wrong since adding the js file didn?t help
> making it work properly. The proxy.cgi URL is now in it twice, how did that
> happen? How can I  "add the URL myself" here to just test?
>
> Considering the PrintProvider. I installed the required files properly and
> the print() function works fine. For adding the print function to my map
> panel, I used the following code:
>
>        var mapPanel = new GeoExt.MapPanel({
>                title: "Case Mapping",
>                region: "center",
>                viewConfig: {forceFit: true},
>                width: 800,
>                height: 400,
>                map: map,
>                layers: [nrw,sttl,lvr,inz,vecLayer],
>                bbar: ["->", {
>                    text: "Print...",
>                    handler: function() {
>                        var printDialog = new Ext.Window({
>                                items: [new GeoExt.PrintMapPanel({
>                                    sourceMap: mapPanel,
>                                    printProvider: new
> GeoExt.data.PrintProvider({
>                                        method: "POST",
>                                        url: "/geoserver/pdf",
>                                        listeners: {
>                                        "loadcapabilities": function() {
>                                        var printPage = new
> GeoExt.data.PrintPage({
>                    });
>
>            printPage.fit(mapPanel, true);
>            printProvider.print(mapPanel, printPage);
>                }
>            }
>    })
>                                })],
>                                bbar: [{
>                                    text: "Create PDF",
>                                    handler: function() {
>                                        printDialog.items.get(0).print();
>                                    }
>                                }]
>                        });
>                    printDialog.show();
>                    }
>                }]
>            });
>
> When using this, and trying the print button on the map panel, the following
> error occurs:
>
> this.printProvider.layout is null
>  var printSize = this.printProvider.layout.get("size");  (Line 240 in the
> PrintMapPanel.js)
>
> Is it any configuration regarding the size of the map panel missing? I tried
> several settings but didn?t really find out what it might be...
>
> Cheers,
>
> Philippe
>
>
> On 05.09.2011 18:15, Matt Priour wrote:
>
>  1. You are missing the URL parameter in your proxy request. it should be:
> ...proxy.cgi?url=<urlencoded full path to service>
> for example:
> http://localhost/cgi-bin/proxy.cgi?url=http%3A%2F%2Flocalhost%3A8080%2Fgeoserver%2Fwfs%3Fversion%3D1.1.0%26request%3DDescribeFeatureType%26typename%3Dcases
>
> This will be done automatically for you when using OL methods with your
> OpenLayers.ProxyHost = ?proxy.cgi?url=?
> This will also be handled automatically when you are using this
> configuration and are using GeoExt?s ?override-ajax-ext.js? file which
> forces all AJAX operations in ExtJS through the OpenLayers.Request class
> If you don?t want to use this file and want to only primarily use GeoExt /
> ExtJS methods for dynamically configuring the QueryPanel, then you will have
> to add the url parameter yourself before the request is actually made.
>
> 2. Printing is chiefly done through the Mapfish/Geoserver Print Module on
> the server side with client side interface provided by
> GeoExt.data.PrintProvider and its associated classes
> http://www.mapfish.org/doc/print/
> http://docs.geoserver.org/latest/en/user/community/printing/index.html
> http://dev.geoext.org/docs/examples.html#print-preview-window
>
> 3. Exporting data as CSV can be done as a WFS output format when using
> Geoserver.
> http://docs.geoserver.org/latest/en/user/services/wfs/outputformats.html
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://www.geoext.org/pipermail/users/attachments/20110908/437c6841/attachment.htm
>
> ------------------------------
>
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>
>
> End of Users Digest, Vol 32, Issue 11
> *************************************
>


More information about the Users mailing list