[fusion-users] calling query() method from another window

Tómas Guðmundsson tomas at snertill.is
Wed Jun 25 06:21:44 EDT 2008


Hi again.

 

I've just gotten back to this problem. What I tried to do is I found a package in the map, and I used an identifier that we use which is called TENGINR. I also noted a bounding box coordinates In x and y to pass along.  This is my options array.

                var options = {};

                options.selectionType = 'INTERSECTS';

                options.geometry = "POLYGON((-20020.500 12622.1736, -20020.500 13033.2695, -18907.7325 13033.2695, -18907.7325 0.005797101449276809, -75.58840579710144 12622.1736))";

                options.maxFeatures = 0;

                options.layers = 'hus'

                options.filter = 'TENGINR = 100016700140';

                this.getMap().query(options);

 

Now, I've tried and debugged Query.php and this is what I get. First we get the REQUEST array, which is correct.

Array

(

    [filter] => TENGINR = 100016700140

    [layers] => hus

    [mapname] => kopavogsbaer486217dfddd16

    [maxfeatures] => 0

    [session] => d78d7550-ffff-ffff-8000-00000000b8fb_en_7F0000010AF20AF10AF0

    [spatialfilter] => POLYGON((-20020.500 12622.1736, -20020.500 13033.2695, -18907.7325 13033.2695, -18907.7325 0.005797101449276809, -75.58840579710144 12622.1736))

    [variant] => INTERSECTS

    [PHPSESSID] => d78d7550-ffff-ffff-8000-00000000b8fb-en-7F0000010AF20AF10AF0

    [_ASPXAUTH] => DCD7E4D6BF85EED759ED9B249B6C77897AEDA988CDA9FFF298FF3CE3E73D931EC2C777103B1DD88472C02B6CCAFD73086707A610D36F153DFCF1A2BE8FBFE00D1D6A48727480EA4333C38749AA8D720D

    [ASP_NET_SessionId] => rwjfzkuxr2t5x2mqtz2srhql

)

 

Then I get this:

<!-- filter: TENGINR = 100016700140 -->

spatial filter is POLYGON((-20020.500 12622.1736, -20020.500 13033.2695, -18907.7325 13033.2695, -18907.7325 0.005797101449276809, -75.58840579710144 12622.1736))<BR>stdClass Object

(

    [layers] => Array

        (

            [0] => hus

        )

 

    [hus] => stdClass Object

        (

            [propertynames] => Array

                (

                    [0] => TENGINR

                    [1] => HEIMILISFAN

                )

 

            [propertyvalues] => Array

                (

                    [0] => TENGINR

                    [1] => HEIMILISFAN

                )

 

            [propertytypes] => Array

                (

                    [0] => 9

                    [1] => 9

                )

 

            [numelements] => 0

            [values] => Array

                (

                )

 

            [metadatanames] => Array

                (

                    [0] => dimension

                    [1] => bbox

                    [2] => center

                    [3] => area

                    [4] => length

                )

 

        )

 

)

And finally I get the very disappointing result:  

{"hasSelection":false}

 

I'm trying this with definitive values from the map and the map layer but nothing happens. Can anyone spot what I'm doing wrong?

Regards,

Tómas.

 

From: Vitor Fortunato [mailto:sapucaiatotal at gmail.com] 
Sent: 6. júní 2008 11:23
To: Tómas Guðmundsson
Cc: Paul Spencer; fusion-users at lists.osgeo.org
Subject: Re: [fusion-users] calling query() method from another window

 

thanks Paul, I will try that later...

Tómas,

You have to create an array for the options:

var options = {};    
options.selectionType = 'INTERSECTS';
options.geometry = "POLYGON((-75.58840579710144 -10.755072463768112, -61.16086956521739 -10.755072463768112, -61.16086956521739 0.005797101449276809, -75.58840579710144 0.005797101449276809, -75.58840579710144 -10.755072463768112))";
 options.maxFeatures = 0;
 options.filter = "gid=1"
 options.layers = 'States';

BUT, Fusion doesn't  use the options.filter yet... to make a query by filter you need to change a line code of the query.php file (Fusion\mapserver|mapguide\php\query.php):
search for the line bellow at the code (it only query by shape):
if (@$oLayer->queryByShape($oSpatialFilter) == MS_SUCCESS) {

change it to:
if (@$oLayer->queryByAttributes($field, $filter, MS_MULTIPLE) == MS_SUCCESS) {



see you




On Fri, Jun 6, 2008 at 6:30 AM, Tómas Guðmundsson <tomas at snertill.is> wrote:

In related matters, does anyone know of a resource that can tell me how to query? I do have a certain layer or a certain map I want to query against, but I don't know the format of a query string for map.query(). I see that Paul sent some options so maybe I need an options variable to search by ? Is there anywhere in the fusion code where this is done so I can see what parameters options has ?

Rgds
Tómas


-----Original Message-----
From: fusion-users-bounces at lists.osgeo.org [mailto:fusion-users-bounces at lists.osgeo.org] On Behalf Of Paul Spencer
Sent: 6. júní 2008 01:37
To: Vitor Fortunato
Cc: fusion-users at lists.osgeo.org
Subject: Re: [fusion-users] calling query() method from another window

Hi Vitor,

you need to get the map in a slightly different way:

var map = window.opener.Fusion.getWidgetById('map'); //or whatever
your map div id is
map.query(options);

Cheers

Paul

On 5-Jun-08, at 8:40 PM, Vitor Fortunato wrote:

> Hi list!
>
> I am trying to call the query() method from a new window opened by a
> widget.
> In execute method of the widget I have the code bellow:
>
> execute : function() {
>     var Url = 'qb.html';
>     winQb = window.open(Url, 'New window',
> 'toolbar
> =
> no
> ,menubar
> =
> no
> ,location
> =no,resizable=yes,status=yes,scrollbars=yes,width=900,height=540');
> }
>
>
> when the widget is executed it pops up a new window. I am trying to
> execute the query method from this new window. I've tried to code
> something, but still with no success:
> code of the new window:
> <script>
>     var options = {};
>     options.filter = 'gid in (1, 2, 3)';
>     options.layers = 'Estados';
>
>     window.opener.Fusion.Widget.Map.query(options);
>
>     //also tried to get the caller widget:
>     // var myWidObj = new window.opener.Fusion.Widget.Pqb();
> </script>
>
> thanks in advance
> _______________________________________________
> fusion-users mailing list
> fusion-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/fusion-users


__________________________________________

   Paul Spencer
   Chief Technology Officer
   DM Solutions Group Inc
   http://www.dmsolutions.ca/

_______________________________________________
fusion-users mailing list
fusion-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/fusion-users

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/fusion-users/attachments/20080625/aaaf4747/attachment-0001.html


More information about the fusion-users mailing list