mapscript query question

Stephen Lime steve.lime at dnr.state.mn.us
Fri May 19 07:07:01 PDT 2000


What happens when you run it from the command line and feed it a point? Also, you don't need the new queryResultObj. That constructor is only necessary when reading cached queries.

Steve

<<< Paul Cameron <pcameron at Soils.Umn.EDU>  5/18 12:16p >>>
Hello,

I've been trying to figure out how the queries work with mapscript and 
was hoping someone could shed some light on it. I'd like to do a simple 
point in polygon query and get access to the dbf record for that polygon. 
The script is crashing on the line that calls queryByPoint with an 
internal server error. If anyone has some code that deals with queries in 
mapscript and are willing to share I'd be very appreciative.

Thanks,
paul

Here's the code that's relevant to the query:

#!/usr/local/bin/perl

use mapscript; 
use CGI qw(:standard :html escape);

$cgi = new CGI;  
$query_type = $mapscript::MS_SINGLE;  

$mode = $cgi->param('mode');  
$x = $cgi->param('img.x'); 
$y = $cgi->param('img.y');

$mapfile = '/usr/people/pcameron/survey/scott/web/mapscript.map';

$map = new mapObj("$mapfile") or die "Unable to load map file. ", 
$mapscript::ms_error->{message};

if ($mode eq 'query') {
  $query_buffer = 10;
  $query = new queryResultObj;
  $point = new pointObj();
  $point->{x} = $x;
  $point->{y} = $y;
  $query = $map->queryByPoint($point,$query_type,$query_buffer);
  &process_query;
}





More information about the MapServer-users mailing list