mapscript query question

Paul Cameron pcameron at Soils.Umn.EDU
Thu May 18 10:12:04 PDT 2000


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