[Mapserver-users] MapWidth and queryByRect...

Steve Lime steve.lime at dnr.state.mn.us
Mon Oct 6 18:17:24 EDT 2003


The layer is not queryable because there is no layer template defined.
You need to set one even if you're not going to use it. Adding TEMPLATE
'dummy' should suffice. As for number of results, the layer object has a
results member, which in turn has a numresults member. Check that
value.



>>> Denis Lalonde <denlalonde at yahoo.com> 10/4/2003 6:48:02 PM >>>
Hello all,
I tried posting this yesterday as a Newbie, but I think it may have
gotten lost in cyberspace. My appologies if the lost post suddenly
re-appears.
 
Anyway, I have a couple of questions.
 
Using the map file below:
---------------------------------------------------------------------------
NAME FIRSTMAP
SIZE 468 320
STATUS ON
EXTENT -145 41 -50 83
SHAPEPATH ""
UNITS DD

OUTPUTFORMAT
  NAME png
  DRIVER "GD/PNG"
  MIMETYPE "image/png"
  IMAGEMODE PC256
  EXTENSION "png"
END
 
# Start of scalebar
#'''''''''''''''''''''''''''''''''''''
SCALEBAR
  IMAGECOLOR 255 255 255
  LABEL
    COLOR 0 0 0 
    SIZE SMALL
  END
  SIZE 150 4
  COLOR 0 0 255
  BACKGROUNDCOLOR 0 0 0
  OUTLINECOLOR 0 0 0
  UNITS KILOMETERS
  INTERVALS 2
  STATUS EMBED
END
 
LAYER
  NAME "Canada"
  TYPE POLYGON
  CONNECTIONTYPE OGR
  CONNECTION "canada.tab"
  STATUS ON
  DATA "canada"
 STYLEITEM "AUTO"
End
---------------------------------------------------------------------------
 
I am trying to query by rectangle using the following code:
$rect = ms_newrectObj();
$rect->setextent($map->extent->minx,$map->extent->miny,$map->extent->maxx,$map->extent->maxy);
$results=$lyr->queryByRect($rect);
 
I get the following error:
Warning: [MapServer Error]: msQueryByRect(): No matching record(s)
found
 
What am I missing? And how would I get a number of records count when I
do eventually get it to return something?
 
------------------------------
 
Ok, and my last Newbie question:
I try to get the MapWidth of the map using the following code:
#$MapOBJ->units="KILOMETERS"; # tried changing to kilometers, but
nothing...
$bottomleftpoint=ms_newpointObj();
$bottomleftpoint->setXY($extent_to_set[0],$extent_to_set[1]);
$bottomrightpoint=ms_newpointObj();
$bottomrightpoint->setXY($extent_to_set[2],$extent_to_set[1]);
$distanceToPoint=$bottomleftpoint->distanceToPoint($bottomrightpoint);
 
But what I get is 112 "some units" for something that should give me
6000 kms. (?) 
 
Thanks in advance,
Denis
 


---------------------------------
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search



More information about the mapserver-users mailing list