[mapserver-users] mapscript queryUsing Point question
Paul Ramsey
pramsey at refractions.net
Mon Oct 22 20:55:32 PDT 2001
Robert,
My perl code (3.5 cvs) seems to do a queryByPoint correctly. See the
file below. I think the problem w/ your code might be that you are
supplying a querypoint in image coordinates rather than geographic
coordinates.
My own problem is that when I call getShape() in the code below, perl
cores out. Ouch.
PS - As a perl fool, I would like to note that having MS_SUCCESS == 0 is
highly counter-intuitive :)
------------
use mapscript;
my $map = new mapObj("/home/pramsey/arcims_proxy/imsbin/demo.map");
my $pt = new pointObj();
$pt->{x} = 900000;
$pt->{y} = 900000;
my $lyr = $map->getLayer(0);
print $lyr,"\n";
print $lyr->{metadata},"\n";
my $rv = $lyr->queryByPoint($map,$pt,$mapscript::MS_SINGLE,10.0);
die "Query failed" if $rv != $mapscript::MS_SUCCESS;
print $rv,"\n";
my $rsltcache = $lyr->{resultcache};
my $bds = $rsltcache->{bounds};
print "(" . $bds->{minx} . "," . $bds->{miny} . ") ";
print "(" . $bds->{maxx} . "," . $bds->{maxy} . ")\n";
my $numrslt = $rsltcache->{numresults};
my $rslt = $lyr->getResult(0);
print $rslt->{shapeindex},"\n";
print $rslt->{tileindex},"\n";
my $shp = new shapeObj($mapscript::MS_SHAPE_POLYGON);
$rv = $lyr->getShape($shp,$rslt->{tileindex},$rslt->{shapeindex});
------------
[pramsey at localhost imsbin]$ perl imsbin.pl
layerObj=HASH(0x80d3e48)
hashTableObjPtr=SCALAR(0x80aa194)
0
(866069.209709852,888026.148641071) (1000000.03274901,1001458.47721688)
52
-1
Segmentation fault (core dumped)
More information about the MapServer-users
mailing list