[Mapserver-users] $lyr->getShape($shape,$tile,$record) problem
Eric Bridger
eric at gomoos.org
Fri Feb 14 06:10:27 PST 2003
This may be a bug. You need to re-open the layer after you call
queryByPoint() which I think closes the layer.
E.g.:
my $datafile = $lyr->{data};
if($lyr->open($datafile)){
warn "Error layer->open(): $datafile\n";
}
and close it afterwards:
$lyr->close();
Another issue is that you must have a TEMPLATE defined in you layer for
it to be queryable. TEMPLATE "bogus.html"
Eric Bridger
eric at gomoos.org Gulf of Maine Ocean Observing System www.gomoos.org
On Fri, 2003-02-14 at 18:29, Eduardo Spremolla wrote:
> Can some one point me to why I always get $shape->{numlines} == 0 ???
>
> Thanks in advance
>
> Spinet of a heavy hacked qry_point.pl examle from the wiki
> PerlMapScript
>
>
> my $lyr = $map->getLayerByName("ejes") or die('Unable to Open Boundary
> Layer!');
> $lyr->{status} = $mapscript::MS_ON;
> # Query the layer using the created point.
> my $zz=$lyr->queryByPoint($map,$pnt,$mapscript::MS_MULTIPLE,0);
> # Create a resultcache object to see how many results.
> my $rsltcache = $lyr->{resultcache};
> #
> # How many matches did we find.
> $cantidad=$rsltcache->{numresults};
> if ( $cantidad == 0 ) {exit;}
> #
> # Grab the first result (there should only be one).
> my $rslt = $lyr->getResult(0);
> # What is the shape number.
> my $record = $rslt->{shapeindex};
> my $tile = $rslt->{tileindex};
> $shape= new shapeObj(-1);
> $zz=$lyr->getShape($shape,$tile,$record);
> print "Retorno $zz\n";
> my $num_lines = $shape->{numlines};
> print "numlines:$num_lines\n";
> $nombre=$shape->getValue(7);
> print "NOM:$nombre\n";
>
>
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>
More information about the MapServer-users
mailing list