Home » Server Options » Spatial » How to determine a point is inside a polygon area? (Oracle 10g , CentOS) 
	| 
		
 |  
	
		
		
			| Re: How to determine a point is inside a polygon area? [message #516736 is a reply to message #516722] | 
			Wed, 20 July 2011 07:02    | 
		 
		
			
				
				
				
					
						
						_jum
						 Messages: 577 Registered: February 2008 
						
					 | 
					Senior Member  | 
					 | 
		 
		 
	 | 
 
	
		You could use fe. SDO_RELATE or SDO_CONTAINS.  
Is the POINT (6,6,0) in the POLYGON (1,1, 10,1, 10,10, 1,10, 1,1)? : 
 
SELECT sdo_geom.relate 
  (MDSYS.SDO_GEOMETRY(2003, NULL, NULL, MDSYS.sdo_elem_info_array(1, 1003, 1),
     MDSYS.sdo_ordinate_array(1,1, 10,1, 10,10, 1,10, 1,1)),
   'DETERMINE',
   MDSYS.SDO_GEOMETRY(2001, NULL, 
     SDO_POINT_TYPE(6,6,0), NULL,NULL),0.1) relatio
  FROM dual;
RELATIO
------------
CONTAINS     
 
  
		
		
		
 |  
	| 
		
	 | 
 
 
 |  
	
		
		
			| Re: How to determine a point is inside a polygon area? [message #516822 is a reply to message #516736] | 
			Thu, 21 July 2011 02:04    | 
		 
		
			
				
				
				  | 
					
						
						ntt85
						 Messages: 34 Registered: July 2011  Location: vietnam
						
					 | 
					Member  | 
					 
  | 
		 
		 
	 | 
 
	
		Thanks, but my polygon like : 
mdsys.sdo_geometry(3,null,mdsys.sdo_point_type(null,null,null),{1, 3, 1},{105.092614, 21.718754, 105.092822, 21.7187, 105.093139, 21.718823}) 
May I have another options?
		
		
		
 |  
	| 
		
	 | 
 
 
 |  
	
		
		
			| Re: How to determine a point is inside a polygon area? [message #516839 is a reply to message #516822] | 
			Thu, 21 July 2011 02:55    | 
		 
		
			
				
				
				
					
						
						_jum
						 Messages: 577 Registered: February 2008 
						
					 | 
					Senior Member  | 
					 | 
		 
		 
	 | 
 
	
		Don't understand your reply, what is the problem ? Btw. your geometry is not valid! 
Quote: 
mdsys.sdo_geometry(3,null,mdsys.sdo_point_type(null,null,null),{1, 3, 1},{105.092614, 21.718754, 105.092822, 21.7187, 105.093139, 21.718823}) 
 
		
		
		
 |  
	| 
		
	 | 
 
 
 |  
	
		
		
			| Re: How to determine a point is inside a polygon area? [message #516850 is a reply to message #516839] | 
			Thu, 21 July 2011 03:22    | 
		 
		
			
				
				
				  | 
					
						
						ntt85
						 Messages: 34 Registered: July 2011  Location: vietnam
						
					 | 
					Member  | 
					 
  | 
		 
		 
	 | 
 
	
		Hi _jum, 
That's geometry I converted from shape file, using shp2sdo. 
I found data in in Pro Oracle Spatial book of Appress:  
mdsys.sdo_geometry(2007,8307,mdsys.sdo_point_type(null,null,null),{1, 1003, 1, 51, 1003, 1},{-61.738891602, 17.540554047, -61.732780457, 17.541110992, -61.731117249, 17.547222137, -61.729171753, 17.608608246, -61.731674194, 17.624996185, -61.738059998, 17.644721985, -61.740280151, 17.649166107, -61.743339539, 17.653053284, -61.783615112, 17.697219849, -61.787223816, 17.700553894, -61.839172363, 17.724720001, -61.845558167, 17.724998474, -61.850280762, 17.722774506, -61.873062134, 17.703887939, -61.875282288, 17.698608398, -61.873893738, 17.68888855, -61.856674194, 17.592498779, -61.853057861, 17.583053589, -61.847503662, 17.58082962, -61.842781067, 17.582775116, -61.839447021, 17.586666107, -61.834724426, 17.588607788, -61.815559387, 17.583885193, -61.751945496, 17.549442291, -61.738891602, 17.540554047, -61.738059998, 16.989719391, -61.686668396, 17.024440765, -61.682502747, 17.027496338, -61.667503357, 17.040554047, -61.666389465, 17.045829773, -61.668891907, 17.084999084, -61.670280457, 17.090274811, -61.674171448, 17.093608856, -61.744171143, 17.137218475, -61.784172058, 17.158332825, -61.794448853, 17.163330078, -61.826393127, 17.167221069, -61.832778931, 17.163887024, -61.884170532, 17.109722137, -61.88722229, 17.1052742, -61.891113281, 17.094165802, -61.88722229, 17.033054352, -61.88583374, 17.028053284, -61.883613586, 17.023609161, -61.880561829, 17.019721985, -61.876113892, 17.016941071, -61.829170227, 16.996944427, -61.738059998, 16.989719391}) 
 
I think my geometry is a bit like this.
		
		
		[Updated on: Thu, 21 July 2011 03:24] Report message to a moderator  
 |  
	| 
		
	 | 
 
 
 |  
	
		
		
			| Re: How to determine a point is inside a polygon area? [message #516861 is a reply to message #516850] | 
			Thu, 21 July 2011 03:49    | 
		 
		
			
				
				
				
					
						
						_jum
						 Messages: 577 Registered: February 2008 
						
					 | 
					Senior Member  | 
					 | 
		 
		 
	 | 
 
	
		The valid SDO_GEOMETRY (2007=2D-MULTIPOLYGON) could be: 
SELECT 
  SDO_GEOMETRY(2007,8307,
    SDO_POINT_TYPE(null,null,null),
    SDO_ELEM_INFO_ARRAY(1, 1003, 1, 51, 1003, 1),
    SDO_ORDINATE_ARRAY(-61.738891602, 17.540554047, -61.732780457, 17.541110992, -61.731117249, 17.547222137, -61.729171753, 17.608608246, -61.731674194, 17.624996185, -61.738059998, 17.644721985, -61.740280151, 17.649166107, -61.743339539, 17.653053284, -61.783615112, 17.697219849, -61.787223816, 17.700553894, -61.839172363, 17.724720001, -61.845558167, 17.724998474, -61.850280762, 17.722774506, -61.873062134, 17.703887939, -61.875282288, 17.698608398, -61.873893738, 17.68888855, -61.856674194, 17.592498779, -61.853057861, 17.583053589, -61.847503662, 17.58082962, -61.842781067, 17.582775116, -61.839447021, 17.586666107, -61.834724426, 17.588607788, -61.815559387, 17.583885193, -61.751945496, 17.549442291, -61.738891602, 17.540554047, -61.738059998, 16.989719391, -61.686668396, 17.024440765, -61.682502747, 17.027496338, -61.667503357, 17.040554047, -61.666389465, 17.045829773, -61.668891907, 17.084999084, -61.670280457, 17.090274811, -61.674171448, 17.093608856, -61.744171143, 17.137218475, -61.784172058, 17.158332825, -61.794448853, 17.163330078, -61.826393127, 17.167221069, -61.832778931, 17.163887024, -61.884170532, 17.109722137, -61.88722229, 17.1052742, -61.891113281, 17.094165802, -61.88722229, 17.033054352, -61.88583374, 17.028053284, -61.883613586, 17.023609161, -61.880561829, 17.019721985, -61.876113892, 17.016941071, -61.829170227, 16.996944427, -61.738059998, 16.989719391)
  );
FROM dual;
 
		
		
		[Updated on: Thu, 21 July 2011 03:51] Report message to a moderator  
 |  
	| 
		
	 | 
 
 
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	
		
		
			| Re: How to determine a point is inside a polygon area? [message #516873 is a reply to message #516870] | 
			Thu, 21 July 2011 05:15    | 
		 
		
			
				
				
				
					
						
						_jum
						 Messages: 577 Registered: February 2008 
						
					 | 
					Senior Member  | 
					 | 
		 
		 
	 | 
 
	
		sdo_geom.relate works fine for me with your corrected geometry: 
SELECT
  sdo_geom.relate( 
    SDO_GEOMETRY(2007,8307,
      SDO_POINT_TYPE(null,null,null),
      SDO_ELEM_INFO_ARRAY(1, 1003, 1, 51, 1003, 1),
      SDO_ORDINATE_ARRAY(-61.738891602, 17.540554047, -61.732780457, 17.541110992, -61.731117249, 17.547222137, -61.729171753, 17.608608246, -61.731674194, 17.624996185, -61.738059998, 17.644721985, -61.740280151, 17.649166107, -61.743339539, 17.653053284, -61.783615112, 17.697219849, -61.787223816, 17.700553894, -61.839172363, 17.724720001, -61.845558167, 17.724998474, -61.850280762, 17.722774506, -61.873062134, 17.703887939, -61.875282288, 17.698608398, -61.873893738, 17.68888855, -61.856674194, 17.592498779, -61.853057861, 17.583053589, -61.847503662, 17.58082962, -61.842781067, 17.582775116, -61.839447021, 17.586666107, -61.834724426, 17.588607788, -61.815559387, 17.583885193, -61.751945496, 17.549442291, -61.738891602, 17.540554047, -61.738059998, 16.989719391, -61.686668396, 17.024440765, -61.682502747, 17.027496338, -61.667503357, 17.040554047, -61.666389465, 17.045829773, -61.668891907, 17.084999084, -61.670280457, 17.090274811, -61.674171448, 17.093608856, -61.744171143, 17.137218475, -61.784172058, 17.158332825, -61.794448853, 17.163330078, -61.826393127, 17.167221069, -61.832778931, 17.163887024, -61.884170532, 17.109722137, -61.88722229, 17.1052742, -61.891113281, 17.094165802, -61.88722229, 17.033054352, -61.88583374, 17.028053284, -61.883613586, 17.023609161, -61.880561829, 17.019721985, -61.876113892, 17.016941071, -61.829170227, 16.996944427, -61.738059998, 16.989719391)),
    'DETERMINE',
    MDSYS.SDO_GEOMETRY(2001, 8307,SDO_POINT_TYPE(-61.73,17,0), NULL,NULL)
  ,0.1)
FROM dual;
SDO_GEOM.RELATE(SDO_GEOMETRY(2007,8307,SDO_POINT_TYPE(NULL,NULL,NULL),SDO_ELEM_I
--------------------------------------------------------------------------------
CONTAINS                                                                        
1 row selected.
 
 
		
		
		
 |  
	| 
		
	 | 
 
 
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |   
Goto Forum:
 
 Current Time: Tue Nov 04 07:17:00 CST 2025 
 |