[Mapserver-users] MapWidth and queryByRect...

Denis Lalonde denlalonde at yahoo.com
Sat Oct 4 19:48:02 EDT 2003


--0-168151693-1065311282=:52216
Content-Type: text/plain; charset=us-ascii

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
--0-168151693-1065311282=:52216
Content-Type: text/html; charset=us-ascii

<DIV><FONT face=Verdana size=1>Hello all,</FONT></DIV>
<DIV><FONT face=Verdana size=1>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.</FONT></DIV>
<DIV><FONT face=Verdana size=1></FONT>&nbsp;</DIV>
<DIV><FONT face=Verdana size=1>Anyway, I have a couple of questions.</FONT></DIV>
<DIV><FONT face=Verdana size=1></FONT>&nbsp;</DIV>
<DIV><FONT face=Verdana size=1>Using the map file below:</FONT></DIV>
<DIV><FONT face=arial size=1>---------------------------------------------------------------------------</FONT></DIV>
<DIV><FONT face=arial size=1>NAME FIRSTMAP<BR>SIZE 468 320<BR>STATUS ON<BR>EXTENT -145 41 -50 83<BR>SHAPEPATH ""<BR>UNITS DD<BR></DIV></FONT>
<DIV><FONT face=arial size=1>OUTPUTFORMAT<BR>&nbsp; NAME png<BR>&nbsp; DRIVER "GD/PNG"<BR>&nbsp; MIMETYPE "image/png"<BR>&nbsp; IMAGEMODE PC256<BR>&nbsp; EXTENSION "png"<BR>END</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=1># Start of scalebar</FONT><BR><FONT size=1>#'''''''''''''''''''''''''''''''''''''<BR>SCALEBAR<BR>&nbsp; IMAGECOLOR 255 255 255<BR>&nbsp; LABEL<BR>&nbsp;&nbsp;&nbsp; COLOR 0 0 0 <BR>&nbsp;&nbsp;&nbsp; SIZE SMALL<BR>&nbsp; END<BR>&nbsp; SIZE 150 4<BR>&nbsp; COLOR 0 0 255<BR>&nbsp; BACKGROUNDCOLOR 0 0 0<BR>&nbsp; OUTLINECOLOR 0 0 0<BR>&nbsp; UNITS KILOMETERS<BR>&nbsp; INTERVALS 2<BR>&nbsp; STATUS EMBED<BR>END</FONT></DIV>
<DIV><FONT size=1></FONT>&nbsp;</DIV>
<DIV><FONT size=1>LAYER<BR>&nbsp;&nbsp;NAME "Canada"<BR>&nbsp; TYPE POLYGON<BR>&nbsp; CONNECTIONTYPE OGR<BR>&nbsp; CONNECTION "canada.tab"<BR>&nbsp; STATUS ON<BR>&nbsp; DATA "canada"<BR>&nbsp;STYLEITEM "AUTO"</FONT></DIV>
<DIV><FONT size=1>End</FONT></DIV>
<DIV><FONT size=1>---------------------------------------------------------------------------</FONT></DIV>
<DIV><FONT size=1></FONT>&nbsp;</DIV>
<DIV><FONT size=1>I am trying to query by rectangle using the following code:</FONT></DIV>
<DIV><FONT size=1>$rect = ms_newrectObj();<BR>$rect-&gt;setextent($map-&gt;extent-&gt;minx,$map-&gt;extent-&gt;miny,$map-&gt;extent-&gt;maxx,$map-&gt;extent-&gt;maxy);</FONT></DIV>
<DIV><FONT size=1>$results=$lyr-&gt;queryByRect($rect);</FONT></DIV>
<DIV><FONT size=1></FONT>&nbsp;</DIV>
<DIV><FONT size=1>I get the following error:</FONT></DIV>
<DIV><STRONG>Warning</STRONG>: [MapServer Error]: msQueryByRect(): No matching record(s) found</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=1>What am I missing? And how would I get a number of records count when I do eventually get it to return something?</FONT></DIV>
<DIV><FONT size=1></FONT>&nbsp;</DIV>
<DIV><FONT size=1>------------------------------</FONT></DIV>
<DIV><FONT size=1></FONT>&nbsp;</DIV>
<DIV><FONT size=1>Ok, and my last Newbie question:</FONT></DIV>
<DIV><FONT size=1>I try to get the MapWidth of the map using the following code:</FONT></DIV>
<DIV><FONT size=1>#$MapOBJ-&gt;units="KILOMETERS"; # tried changing to kilometers, but nothing...<BR>$bottomleftpoint=ms_newpointObj();<BR>$bottomleftpoint-&gt;setXY($extent_to_set[0],$extent_to_set[1]);<BR>$bottomrightpoint=ms_newpointObj();<BR>$bottomrightpoint-&gt;setXY($extent_to_set[2],$extent_to_set[1]);<BR>$distanceToPoint=$bottomleftpoint-&gt;distanceToPoint($bottomrightpoint);</FONT></DIV>
<DIV><FONT size=1></FONT>&nbsp;</DIV>
<DIV><FONT size=1>But what I get is 112 "some units" for something that should give me 6000 kms. (?) </FONT></DIV>
<DIV><FONT size=1></FONT>&nbsp;</DIV>
<DIV><FONT size=1>Thanks in advance,</FONT></DIV>
<DIV><FONT size=1>Denis</FONT></DIV>
<DIV><FONT size=1></FONT>&nbsp;</DIV><p><hr SIZE=1>
Do you Yahoo!?<br>
<a href="http://shopping.yahoo.com/?__yltc=s%3A150000443%2Cd%3A22708228%2Cslk%3Atext%2Csec%3Amail">The New Yahoo! Shopping</a> - with improved product search
--0-168151693-1065311282=:52216--



More information about the mapserver-users mailing list