Re: [mapserver-users] getShape failing; changes from mapserver 5.6 to 6.0

2012-08-06 Thread Stefan Schwarzer
Thanks a lot, Steve.

However, I had tried this out before, but getResult($)? I think this is Perl, 
no? In PHP this would be different? 

Sorry for a dumb question…

Stefan

 The query code underwent major changes between 5.6 and 6.0 and one casualty 
 was query processing like you're doing. On the bright side it's much more 
 straight forward now. The general steps for a layer-based query is now just:
 
 $layer-queryByRect($map, $rect); # layer is left open after a query operation
 
 for($i=0; $i$layer-getNumResults(); $i++) {
   $shape = $layer-getShape($layer-getResult($)); # much simpler
   # do something with the shape
 }
 
 I see the MapScript/Swig query docs are woefully out of date. I'll file a 
 ticket on that...
 
 Steve
 
 -Original Message-
 From: mapserver-users-boun...@lists.osgeo.org 
 [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Stefan Schwarzer
 Sent: Friday, August 03, 2012 6:37 AM
 To: mapserver-users@lists.osgeo.org
 Subject: [mapserver-users] getShape failing; changes from mapserver 5.6 to 6.0
 
 Hi there,
 
 I am struggling with a few changes I need to go through in order to make my 
 code working now with mapserver 6.x. This one concerns the query part, when a 
 user clicks on the map and a window with some metadata is being displayed.
 
 An error message occurred:
 
   Catchable fatal error: Argument 1 passed to layerObj::getShape() must 
 be an instance of resultObj, integer given
 
 When I changed the getShape command as indicated here [1], it says:
 
   Fatal error: Call to a member function getShape() on a non-object
 
 
 This is the code:
 
   //Query the Map at the point clicked
   if (!$imgbox)
   @$a = $map - queryByPoint($click_pt, MS_MULTIPLE, -1);
   else
   $a = $map - queryByRect($click_rt);
 
   if ($a == MS_SUCCESS)
   {
 
   $numResults = $Layer - getNumResults();
   $oLayer = $map - getLayer($Layer - index);
 
   // Open layer's table... take the list of fields to display 
 from 
   // the HEADERRESULT_FIELDS metadata in the layer object.
   $oLayer - open();
 
   $oRes = $oLayer - getResult(0);
   //$oShape = $oLayer - 
 getShape($oRes-tileindex,$oRes-shapeindex);// before
   $oShape = $layer - getShape($oLayer - getResult(0));  
 // now ??
   
   
   while(list($key, $val) = each($oShape - values))
   {
   //echo br /x - .count($selFields). - .$key .  =  . 
 $val;
   if (($key  META_DATA) AND ($key  oid) AND ($key 
  id) AND ($key  uid))
   $selFields[count($selFields)] = $key;
   }
 
 
 
 Not sure what I should put there...
 
 Thanks for any hints,
 
 Stefan
 
 
 [1] http://mapserver.org/MIGRATION_GUIDE.html
 ___
 mapserver-users mailing list
 mapserver-users@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/mapserver-users
 
 
 

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] getShape failing; changes from mapserver 5.6 to 6.0

2012-08-06 Thread Lime, Steve D (DNR)
Yup, sorry it's Perl. The getResult($) should be getResult($i). Syntax for PHP 
should be pretty close I think, method names are the same.

Steve


From: Stefan Schwarzer [stefan.schwar...@unep.org]
Sent: Monday, August 06, 2012 6:48 AM
To: mapserver-users@lists.osgeo.org
Cc: Lime, Steve D (DNR)
Subject: Re: [mapserver-users] getShape failing;changes from mapserver 
5.6 to 6.0

Thanks a lot, Steve.

However, I had tried this out before, but getResult($)? I think this is Perl, 
no? In PHP this would be different?

Sorry for a dumb question…

Stefan

 The query code underwent major changes between 5.6 and 6.0 and one casualty 
 was query processing like you're doing. On the bright side it's much more 
 straight forward now. The general steps for a layer-based query is now just:

 $layer-queryByRect($map, $rect); # layer is left open after a query operation

 for($i=0; $i$layer-getNumResults(); $i++) {
   $shape = $layer-getShape($layer-getResult($)); # much simpler
   # do something with the shape
 }

 I see the MapScript/Swig query docs are woefully out of date. I'll file a 
 ticket on that...

 Steve

 -Original Message-
 From: mapserver-users-boun...@lists.osgeo.org 
 [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Stefan Schwarzer
 Sent: Friday, August 03, 2012 6:37 AM
 To: mapserver-users@lists.osgeo.org
 Subject: [mapserver-users] getShape failing; changes from mapserver 5.6 to 6.0

 Hi there,

 I am struggling with a few changes I need to go through in order to make my 
 code working now with mapserver 6.x. This one concerns the query part, when a 
 user clicks on the map and a window with some metadata is being displayed.

 An error message occurred:

   Catchable fatal error: Argument 1 passed to layerObj::getShape() must 
 be an instance of resultObj, integer given

 When I changed the getShape command as indicated here [1], it says:

   Fatal error: Call to a member function getShape() on a non-object


 This is the code:

   //Query the Map at the point clicked
   if (!$imgbox)
   @$a = $map - queryByPoint($click_pt, MS_MULTIPLE, -1);
   else
   $a = $map - queryByRect($click_rt);

   if ($a == MS_SUCCESS)
   {

   $numResults = $Layer - getNumResults();
   $oLayer = $map - getLayer($Layer - index);

   // Open layer's table... take the list of fields to display from
   // the HEADERRESULT_FIELDS metadata in the layer object.
   $oLayer - open();

   $oRes = $oLayer - getResult(0);
   //$oShape = $oLayer - 
 getShape($oRes-tileindex,$oRes-shapeindex);// before
   $oShape = $layer - getShape($oLayer - getResult(0));  
 // now ??


   while(list($key, $val) = each($oShape - values))
   {
   //echo br /x - .count($selFields). - .$key .  =  . 
 $val;
   if (($key  META_DATA) AND ($key  oid) AND ($key 
  id) AND ($key  uid))
   $selFields[count($selFields)] = $key;
   }



 Not sure what I should put there...

 Thanks for any hints,

 Stefan


 [1] http://mapserver.org/MIGRATION_GUIDE.html
 ___
 mapserver-users mailing list
 mapserver-users@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/mapserver-users






___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] getShape failing; changes from mapserver 5.6 to 6.0

2012-08-03 Thread Stefan Schwarzer
Hi there,

I am struggling with a few changes I need to go through in order to make my 
code working now with mapserver 6.x. This one concerns the query part, when a 
user clicks on the map and a window with some metadata is being displayed.

An error message occurred:

Catchable fatal error: Argument 1 passed to layerObj::getShape() must 
be an instance of resultObj, integer given

When I changed the getShape command as indicated here [1], it says:

Fatal error: Call to a member function getShape() on a non-object


This is the code:

//Query the Map at the point clicked
if (!$imgbox)
@$a = $map - queryByPoint($click_pt, MS_MULTIPLE, -1);
else
$a = $map - queryByRect($click_rt);

if ($a == MS_SUCCESS)
{

$numResults = $Layer - getNumResults();
$oLayer = $map - getLayer($Layer - index);

// Open layer's table... take the list of fields to display 
from 
// the HEADERRESULT_FIELDS metadata in the layer object.
$oLayer - open();

$oRes = $oLayer - getResult(0);
//$oShape = $oLayer - 
getShape($oRes-tileindex,$oRes-shapeindex);// before
$oShape = $layer - getShape($oLayer - getResult(0));  
// now ??


while(list($key, $val) = each($oShape - values))
{
//echo br /x - .count($selFields). - .$key .  =  . 
$val;
if (($key  META_DATA) AND ($key  oid) AND ($key 
 id) AND ($key  uid))
$selFields[count($selFields)] = $key;
}



Not sure what I should put there…

Thanks for any hints,

Stefan


[1] http://mapserver.org/MIGRATION_GUIDE.html
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] getShape failing; changes from mapserver 5.6 to 6.0

2012-08-03 Thread Lime, Steve D (DNR)
The query code underwent major changes between 5.6 and 6.0 and one casualty was 
query processing like you're doing. On the bright side it's much more straight 
forward now. The general steps for a layer-based query is now just:

$layer-queryByRect($map, $rect); # layer is left open after a query operation

for($i=0; $i$layer-getNumResults(); $i++) {
   $shape = $layer-getShape($layer-getResult($)); # much simpler
   # do something with the shape
}

I see the MapScript/Swig query docs are woefully out of date. I'll file a 
ticket on that...

Steve

-Original Message-
From: mapserver-users-boun...@lists.osgeo.org 
[mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Stefan Schwarzer
Sent: Friday, August 03, 2012 6:37 AM
To: mapserver-users@lists.osgeo.org
Subject: [mapserver-users] getShape failing; changes from mapserver 5.6 to 6.0

Hi there,

I am struggling with a few changes I need to go through in order to make my 
code working now with mapserver 6.x. This one concerns the query part, when a 
user clicks on the map and a window with some metadata is being displayed.

An error message occurred:

Catchable fatal error: Argument 1 passed to layerObj::getShape() must 
be an instance of resultObj, integer given

When I changed the getShape command as indicated here [1], it says:

Fatal error: Call to a member function getShape() on a non-object


This is the code:

//Query the Map at the point clicked
if (!$imgbox)
@$a = $map - queryByPoint($click_pt, MS_MULTIPLE, -1);
else
$a = $map - queryByRect($click_rt);

if ($a == MS_SUCCESS)
{

$numResults = $Layer - getNumResults();
$oLayer = $map - getLayer($Layer - index);

// Open layer's table... take the list of fields to display 
from 
// the HEADERRESULT_FIELDS metadata in the layer object.
$oLayer - open();

$oRes = $oLayer - getResult(0);
//$oShape = $oLayer - 
getShape($oRes-tileindex,$oRes-shapeindex);// before
$oShape = $layer - getShape($oLayer - getResult(0));  
// now ??


while(list($key, $val) = each($oShape - values))
{
//echo br /x - .count($selFields). - .$key .  =  . 
$val;
if (($key  META_DATA) AND ($key  oid) AND ($key 
 id) AND ($key  uid))
$selFields[count($selFields)] = $key;
}



Not sure what I should put there...

Thanks for any hints,

Stefan


[1] http://mapserver.org/MIGRATION_GUIDE.html
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users