Hi Claude,
Funny, happened to have some CF code to check for polygon containment open when
I saw your post:
function polyContains(poly, lon, lat) {
var j = 1;
var oddNodes = false;
var lenPoly = arrayLen(poly);
for (var i = 1; i < lenPoly; i += 2) {
j = i + 2;
if (j > lenPoly - 2)
j = 1;
if (((poly[i + 1] > lat) != (poly[j + 1] > lat)) // the
polygon edge passes through the lattitude lat
and ((((lat - poly[i + 1]) * (poly[j] - poly[i])) /
(poly[j + 1] - poly[i + 1])) < lon)) // at lattitude lat, polygon edge is west
of lon
oddNodes = !oddNodes;
}
return oddNodes;
};
I'm using this because MySQL spatial polygon containment only compares bounding
boxes (on the version supported by Redhat). MySQL whittles the list down to a
few polygons and I use this to do the rest, based on the odd/even polygon
containment test. Note that poly is a flat array containing lon lat pairs.
I'm currently running some tests on a database of about 5,000 polygons covering
SE Australia, sampling every one km grid. There are a few anomalies I'm
investigating, hopefully it's the data and not an algorithm glitch but you have
been warned.
Robin
ROBIN HILLIARD
Chief Technology Officer
[email protected]
RocketBoots Pty Ltd
Level 11
189 Kent Street
Sydney NSW 2001
Australia
Phone +61 2 9323 2507
Facsimile +61 2 9323 2501
Mobile +61 418 414 341
www.rocketboots.com.au
On 04/06/2013, at 7:58 PM, [email protected] wrote:
> I have the Tracking Server with listener set up so the listener captures the
> data (long / lat) sent from the mobile tracking devices to the server, which
> is then stored into an sql table
>
> I have the Bing Maps API set up so the locations stored in the above database
> table correctly display on the bing map
>
> The challenge is trying to figure out how to create Geo Fence functionality
> combining SQL 2008, using Bing Maps API and using CF application to manage
> and display the Geo Fences
>
> I am wanting to be able to create circular zones so the co ordinates are
> saved in the geo fence table assigned to a specific device id,
>
> Once the geo fences are created and stored in the geo fence table each new
> location sent to the tracking server then needs to be validated against
> existing geo fences to determine if the new location is inside or outside of
> geo fences listed in the geo fence table
>
> If anyone can assist to direct me to a resource or example code that deal
> with the above I would appreciate the advise
>
>
> Kind Regards
>
> Claude Raiola
>
> --
> You received this message because you are subscribed to the Google Groups
> "cfaussie" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/cfaussie?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups
"cfaussie" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cfaussie?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.