Documentation - Re: [mapserver-users] Something odd with queries in 5.6.1

2010-03-11 Thread Carlos Ruiz
Maybe the PHP Mapscript documentation must specify in the getFeature method 
description of the 
LayerObj Class section 
(http://www.mapserver.org/mapscript/php/index.html#layerobj-class) that it's 
deprecated since version 5.6.1, as the getShape method description:

Deprecated in v5.0, use getFeature() instead (note that the order
of the arguments is reversed since 
tileindex is optional in
getFeature())




IC Carlos Ruiz




From: Daniel Morissette 
To: mapserver-users 
Sent: Wed, March 10, 2010 4:54:09 PM
Subject: Re: [mapserver-users] Something odd with queries in 5.6.1

Carlos Ruiz wrote:
> Hi all,
> 
> I noticed something odd when I do a query with the new 5.6.1 version.
> 
> The getFeature method seems to return a NULL value, when it was working good 
> before the new version update.
> 

Due to a change in the handling of queries in version 5.6, ols scripts must be 
updated to use the new $layer->resultsGetShape() method instead of 
$layer->GetShape() or $layer->GetFeature() to read query results.

There is a mention of this change in the migration guide, but it may not be 
clear enough (contributions welcome):
http://trac.osgeo.org/mapserver/browser/branches/branch-5-6/mapserver/MIGRATION_GUIDE.TXT

Daniel
-- Daniel Morissette
http://www.mapgears.com/
___
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] Something odd with queries in 5.6.1

2010-03-11 Thread Carlos Ruiz
Thanks Daniel, 

I was reading the mapscript documentation before the post of this message and I 
found this:

layer.getShape(int tileindex, int shapeindex)) has been deprecated and
renamed to layer.getFeature(int shapeindex [, int tileindex = -1]) to
match the SWIG MapScript equivalent. Note that the order of the 
arguments
is reversed since tileindex is optional in getFeature().

But I didn't look the Mapserver RFC 52.

Thanks once again !


IC Carlos Ruiz




From: Daniel Morissette 
To: mapserver-users 
Sent: Wed, March 10, 2010 4:54:09 PM
Subject: Re: [mapserver-users] Something odd with queries in 5.6.1

Carlos Ruiz wrote:
> Hi all,
> 
> I noticed something odd when I do a query with the new 5.6.1 version.
> 
> The getFeature method seems to return a NULL value, when it was working good 
> before the new version update.
> 

Due to a change in the handling of queries in version 5.6, ols scripts must be 
updated to use the new $layer->resultsGetShape() method instead of 
$layer->GetShape() or $layer->GetFeature() to read query results.

There is a mention of this change in the migration guide, but it may not be 
clear enough (contributions welcome):
http://trac.osgeo.org/mapserver/browser/branches/branch-5-6/mapserver/MIGRATION_GUIDE.TXT

Daniel
-- Daniel Morissette
http://www.mapgears.com/
___
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] Something odd with queries in 5.6.1

2010-03-10 Thread Daniel Morissette

Carlos Ruiz wrote:

Hi all,

I noticed something odd when I do a query with the new 5.6.1 version.

The getFeature method seems to return a NULL value, when it was working 
good before the new version update.




Due to a change in the handling of queries in version 5.6, ols scripts 
must be updated to use the new $layer->resultsGetShape() method instead 
of $layer->GetShape() or $layer->GetFeature() to read query results.


There is a mention of this change in the migration guide, but it may not 
be clear enough (contributions welcome):

http://trac.osgeo.org/mapserver/browser/branches/branch-5-6/mapserver/MIGRATION_GUIDE.TXT

Daniel
--
Daniel Morissette
http://www.mapgears.com/
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Something odd with queries in 5.6.1

2010-03-10 Thread Andy Colson

On 3/10/2010 3:53 PM, Carlos Ruiz wrote:

Hi all,

I noticed something odd when I do a query with the new 5.6.1 version.

The getFeature method seems to return a NULL value, when it was working
good before the new version update.

Here's the code:

$n = $map->numlayers;

for ($i = 0; $i < $n; $i++) {

$theme = $map->GetLayer($i);

if ($tema->isVisible()) {

^
theme?



if (($regs = $theme->getNumResults()) == 0) {
continue;
}
}
else {
continue;
}

$theme->open();
$values = $theme->getitems();

unset($atts);

for ($reg = 0; $reg < $regs; $reg++) {

$result = $theme->getResult($reg);
// getFeature is returning NULL with the 5.6.1 version
$element = $theme->getFeature($result->shapeindex, $result->tileindex);

for ($value = 0; $value < count($values); $value++) {
$atts[] = $values[$value] . " " . $element->values[$values[$value]];
}

// php crash because $element is a non object
$element->free();

}

$theme->close();

...

}

Any help or idea will be appreciated.

Thanks in advance

IC Carlos Ruiz



___
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] Something odd with queries in 5.6.1

2010-03-10 Thread Carlos Ruiz
Hi all,

I noticed something odd when I do a query with the new 5.6.1 version.

The getFeature method seems to return a NULL value, when it was working good 
before the new version update.

Here's the code:

$n = $map->numlayers;

for ($i = 0; $i < $n; $i++) {

$theme = $map->GetLayer($i);

if ($tema->isVisible()) {
if (($regs = $theme->getNumResults()) == 0) {
continue;
}
}
else {
continue;
}

$theme->open();
$values = $theme->getitems();

unset($atts);

for ($reg = 0; $reg < $regs; $reg++) {

$result = $theme->getResult($reg);
// getFeature is returning NULL with the 5.6.1 version
$element = $theme->getFeature($result->shapeindex, $result->tileindex);

for ($value = 0; $value < count($values); $value++) {
$atts[] = $values[$value] . " " . $element->values[$values[$value]];
}

// php crash because $element is a non object
$element->free();

}

$theme->close();

...

}

Any help or idea will be appreciated.

Thanks in advance


IC Carlos Ruiz


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