Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
arunraj2308
Contributor
Contributor

Point in Polygon

Hi ,

I need to find out if a point is inside or outside a polygon. Suppose I have a square with the following co-ordinates :

0,0

0,2

2,2

2,0

Is there a way in Load script, I can identify whether or not point (x,y) is inside or outside the square? So if my point is (1,1) then it should return 'Inside' and if my point is (3,3) it should return 'outside'.

Any help will be greatly appreciated.

Kind Regards

A

6 Replies
Anil_Babu_Samineni

Why 1,1 and 3,3 only.. Is there any logic to pick only those or does they coming from another field?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
MarcoWedel

What kind of polygons do you have?

If only squares then one condition might be simply:

x>=x1 and x<=x2 and y>=y1 and y<=y2

Please post some sample data (tables and fields) and your expected result to test with.

thanks

regards

Marco

arunraj2308
Contributor
Contributor
Author

Hi Anil,

No 1,1 and 3,3 were just examples. It is not necessary that the shape is a square. It can have any number of vertices.

Anil_Babu_Samineni

Not really, Sure how Polygon values are setting up. Are you loading any earth data using boudaries from in and out??

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
arunraj2308
Contributor
Contributor
Author

Hi Marco,

You are right, that condition will work for a square.

Unfortunately it can be any shape. eg: pentagon, hexagon . with any number of vertices.

I will be given the latitude longitude co-ordinates of an area of any shape for example:

Tab1:

Area_Latitude, Area_Longitude

51.717772, 0.906372

51.690096, -0.494385

51.372295, -0.543823

51.262431, -0.175781

51.2074, 0.340576

51.512674, 0.038452

I need to show whether the customer address falls within the above area or not.

Tab2:

CustomerID, Cust_Latitude, Cust_Latitude

1, 51.499305, -0.137329

2, 51.478783, 0.164795


Result:

CustomerID, Cust_Latitude, Cust_Latitude, Inside_OutsideAreaIndicator

1, 51.499305, -0.137329, Inside Area

2, 51.478783, 0.164795, Outside Area


KInd Regards

Arun

arunraj2308
Contributor
Contributor
Author

Hi Anil,

You are right, I will be given latitude longitude co-ordinates.

I will be given the latitude longitude co-ordinates of an area of any shape for example:

Tab1:

Area_Latitude, Area_Longitude

51.717772, 0.906372

51.690096, -0.494385

51.372295, -0.543823

51.262431, -0.175781

51.2074, 0.340576

51.512674, 0.038452

I need to show whether the customer address falls within the above area or not.

Tab2:

CustomerID, Cust_Latitude, Cust_Latitude

1, 51.499305, -0.137329

2, 51.478783, 0.164795


Result:

CustomerID, Cust_Latitude, Cust_Latitude, Inside_OutsideAreaIndicator

1, 51.499305, -0.137329, Inside Area

2, 51.478783, 0.164795, Outside Area