Download presentation
Presentation is loading. Please wait.
Published byMarcel Maul Modified over 9 years ago
1
GIS CUP 2013
2
Geo - Fencing ● Virtual perimeter for a real world geographic area ● Widely used in location based services ● Location based advertisements ● Child Location services
3
Problem Definition ● Input : Set of Regions ( May be overlapping) ● Set of Points ( ID and Sequence) ● Output : Pair each input point with one or more regions on the satisfaction of spatial condition between them ● Spatial conditions ● INSIDE ● WITH IN
4
INSIDE ● TRUE - if a point is inside the polygon ● The point can be associated with one or more polygons ● A point can be INSIDE any polygon with a sequence number (i.e., timestamp) less than the sequence number of the point where only the latest position of each polygon (up to that sequence number) is considered.
5
Point in Polygon Algorithm ● Compare each side of the polygon to the Y (vertical) coordinate of the test point, and compile a list of nodes, where each node is a point where one side crosses the Y threshold of the test point ● Arbitrarily decide that points on the Y threshold will belong to the “above” side of the threshold ● In Above figure, eight sides of the polygon cross the Y threshold, while the other six sides do not ● Odd number of nodes on each side of the test point - inside the polygon ● Even number - outside the polygon.
6
● Polygon Crosses itself ● The effect is much like “exclusive or”. The portions of the polygon which overlap cancel each other out. ● So, the test point is outside the polygon ● Even number of nodes (two and two) on either side of it.
7
● The six-sided polygon does not overlap itself, but it does have lines that cross. ● Not a problem; the algorithm still works fine.
8
● A vertex of the polygon falls directly on the Y threshold (fig 1) ● One of its sides lies entirely on the threshold ( fig 2) ● Not a problem; the algorithm still works fine.
9
PIP Variables ● Global Variables ● int polysides; ● float polyX[]; ● float polyY[]; ● float x,y;
10
PIP Algorithm bool pointInPolygon() { int i, j=polySides-1 ; bool oddNodes=NO ; for (i=0; i<polySides; i++) { if ((polyY[i] =y || polyY[j] =y) && (polyX[i]<=x || polyX[j]<=x)) { oddNodes^=(polyX[i]+(y-polyY[i])/(polyY[j]-polyY[i])*(polyX[j]-polyX[i])<x); } j=i; } return oddNodes; }
11
Within ● True – if the point is at less than 1000 units distance from the polygon ● Each point may be associated with one or more of the polygons, as the same point can be within 1000 units distance from several polygons.
12
With in Algorithm ● Finding the distance between every polygon edge and test point ● Check If there exists any polygon edge with 1000 units distance from test point ● Distance calculation
13
Algorithm ● Start ● Read Predicate value from user ● For every test Point { ● { For every Polygon, ● If( Point sequence> Polygon sequence) ● PIP algorithm or With in Algorithm ● } ● Return point id sequence with their associating polygon or YES/ NO if point with in 1000 units ● Stop ●
14
Cost analysis ● Time complexity ● Pre processing – O(N) ● Processing – May be O(Log N) ● Accuracy – works well with convex/ concave polygons. ● Not sure for points on the polygons ● Still working on that!
15
Thank you!!!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.