queryByShape Problem

Josh Hevenor Josh.Hevenor at DPRA.COM
Wed Jan 30 13:14:49 PST 2008


A good point was made here. My use of union_geos wasn't doing what I thought it was. I've decided to manually calculate the boundary of my initial query result (just looking for min{x|y}, max{x|y}) and trying to find the points in that bounding box and still have had no luck. 

I've checked http://www.openlayers.org/dev/examples/vector-formats.html that the points I expect really are supposed to be returned. My bounding box is 

	POLYGON ((-63.60658536 44.61749653, -63.60658536 44.6555663, -	63.55962575 44.6555663, -63.55962575 44.61749653, -63.60658536 	44.61749653))

The points that should be returned by the query are 

	POINT (-63.5735359191895 44.6371459960938)
	POINT (-63.5701866149902	44.6374168395996)

I'm using MapServer 5 on windows server 2003. The point layer is OGR with the FID set. I'm attempting to use the same function with other layers and I'm not having any better luck. I must be using this wrong. 


	$taBounds = ms_newRectObj();
	$taBounds->setextent($taBoundMinX, $taBoundMinY, $taBoundMaxX, 										$taBoundMaxY);
			
	@$bannerLayer->queryByRect($taBounds);
	$numRes = $bannerLayer ->getNumResults();
	If($numRes > 0){
		. . .
	}

Your help is appreciated, 

Josh
	

-----Original Message-----
From: Guillaume Sueur [mailto:guillaume.sueur at neogeo-online.net] 
Sent: Wednesday, January 30, 2008 11:45 AM
To: Josh Hevenor; MAPSERVER-USERS at LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-USERS] queryByShape Problem

Oups ! read the stuff too fast. The query object IS a polygon.
In fact your point does'nt seem to be INTO the polygon. Have a check 
with OpenLayers vector capabilities, in which you can test WKTs :
http://www.openlayers.org/dev/examples/vector-formats.html



Guillaume Sueur a écrit :
> Hi Josh,
> 
> See mapscript documentation about this function :
> Query layer based on a single shape, the shape has to be a polygon
>         at this point.
> 
> Sorry !
> 
> 
> Josh Hevenor a écrit :
>> Good morning,
>>
>>  
>>
>> I'm having trouble getting a response from PHP MapScript's 
>> Layer::queryByShape()
>>
>>  
>>
>> I'm trying to query an OGR point layer by a Polygon Shape that I got 
>> from querying a different layer. queryByAttribute on the same OGR 
>> Point layer is working properly.
>>
>>  
>>
>> My code looks like:
>>
>>  
>>
>>             
>> if($bannerLayer->queryByShape($tradeAreaShape)==MS_SUCCESS){                              
>>
>>
>>             /// . . .
>>
>> } else {
>>
>>             Echo "FOUND NOTHING!";
>>
>> }
>>
>>  
>>
>> The WKT of tradeAreaShape is
>>
>> POLYGON ((-63.5931228499999290 44.6328285400000480, 
>> -63.5947725799999260 44.6335656500000940, -63.5951314899999720 
>> 44.6341621000000830, -63.5957245999999260 44.6340256500000690, 
>> -63.5965530599999620 44.6338150900000410, -63.5968179299999290 
>> 44.6337532300000820, -63.5977474799999530 44.6335363100000680, 
>> -63.5982376599999380 44.6333897900000810, -63.5988134899999410 
>> 44.6332354000000460, -63.5987020099999540 44.6332166200000420, 
>> -63.5971723199999700 44.6327559600000540, -63.5969579099999580 
>> 44.6327936700000690, -63.5964623699999270 44.6323998900000450, 
>> -63.5946525499999780 44.6317434200000780, -63.5938438599999360 
>> 44.6315586800000690, -63.5932997099999400 44.6312995200000840, 
>> -63.5928279799999250 44.6307981100000570, -63.5924848199999250 
>> 44.6305387700000440, -63.5919616199999500 44.6299659500000420, 
>> -63.5916053899999270 44.6296526400000740, -63.5909086899999350 
>> 44.6292868500000850, -63.5899865099999600 44.6291208900000810, 
>> -63.5892757299999400 44.6286565300000580, -63.58845245
> 99999280 44.6282188300000940, -63.5874521599999410 44.6277828000000910, 
> -63.5860267299999580 44.6277003300000390, -63.5850517499999340 
> 44.6273278300000700, -63.5841646099999590 44.6268552600000700, 
> -63.5839624399999370 44.6268111700000530, -63.5838486099999610 
> 44.6267392600000790, -63.5831529099999670 44.6265364200000930, 
> -63.5826986099999660 44.6264936700000590, -63.5820406399999460 
> 44.6262448900000660, -63.5816217099999220 44.6259225200000740, 
> -63.5814790499999280 44.6255455100000520, -63.5812254099999450 
> 44.6253663000000530, -63.5807831799999690 44.6253010900000500, 
> -63.5812146799999600 44.6263535200000660, -63.5815108999999550 
> 44.6275863300000420, -63.5816280799999730 44.6279660300000390, 
> -63.5816691499999250 44.6280994700000520, -63.5816917799999710 
> 44.6291450300000750, -63.5818721599999320 44.6295401500000820, 
> -63.5820067699999640 44.6298511200000690, -63.5822121299999590 
> 44.6303349300000600, -63.5823497599999430 44.6306541100000800, 
> -63.5833684999999490 44.630405840000
> 0940, -63.5843872299999480 44.6301575700000510, -63.5853932299999660 
> 44.6299183500000820, -63.5862579099999720 44.6318944600000690, 
> -63.5867230999999720 44.6330173000000630, -63.5868909099999660 
> 44.6334035400000740, -63.5909856299999770 44.6318880900000750, 
> -63.5927758399999450 44.6326734800000510, -63.5931228499999290 
> 44.6328285400000480))
>>
>>  
>>
>> And a point that should be found is
>>
>>  
>>
>> POINT (-63.573535919189 44.637145996094)
>>
>>  
>>
>> Thanks once again,
>> Josh Hevenor
>> Application Developer
>> ____________________________________________
>> 5230 South Service Road
>> Burlington, Ontario
>> L7L 5K2  Canada
>> **Email: josh.hevenor at dpra.com***
>> *Internet: http://www.dpra.com*
>>
>> *
>>
>>  
>>
>>  
>>
>>
>> **Attention:***
>> *Privileged/Confidential Information may be contained in this message. 
>> Disclosure to any person other than the named recipient is 
>> unauthorized. If you are not the intended recipient, please delete all 
>> copies of this information and kindly notify the sender by reply 
>> email. Opinions, conclusions and other information in this message 
>> that do not relate to the official business of DPRA shall be 
>> understood as neither given nor endorsed by it. DPRA and any of its 
>> subsidiaries reserve the right to monitor all e-mail communications 
>> through its networks. Thank you.
>>
>>  
>>
> 

-- 
Guillaume SUEUR
Expert SIG et OpenSource
NEOGEO
46 RUE MATABIAU
31000 TOULOUSE
06 74 91 95 20
Site web : http://www.neogeo-online.net



More information about the MapServer-users mailing list