you just need to create a table with the polygons, then you can use a built in function like STContains
http://technet.microsoft.com/en-us/library/bb933904.aspx also, I would recommend considering avoiding using propriety vendor apis like google maps or bing, stick with something like flexible like openlayers or leafletJS so that you can easily swap backends On Wed, Jun 5, 2013 at 5:11 PM, <[email protected]> wrote: > *Hi Zac* > > * * > > *Thanks for your reply* > > * * > > *If you have any suggestions on the best way to record geo fence zones > with z radius so that the system can then detect whenever a given reported > location is inside / outside of a given zone I would appreciate it* > > * * > > *I am using the Bing mapping api and I am developing the tracking portal > app in CF* > > ** ** > > ** ** > > Kind Regards**** > > ** ** > > Claude Raiola**** > > SAMARIS Software**** > > Call 1300 255 990**** > > * * > > *From:* [email protected] [mailto:[email protected]] *On > Behalf Of *Zac Spitzer > *Sent:* Wednesday, 5 June 2013 3:07 PM > *To:* CFAussie > > *Subject:* Re: [cfaussie] Cold Fusion with SQL and Geo Spatial Mapping > Geo Fence Functionality**** > > ** ** > > SQL Server 2008 also supports proper spatial? **** > > ** ** > > On Wed, Jun 5, 2013 at 2:19 PM, Robin Hilliard <[email protected]> > wrote:**** > > 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. > > **** > > > > > -- > Zac Spitzer > Solution Architect / Director > Ennoble Consultancy Australia > +61 405 847 168**** > > -- > 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. > > > -- Zac Spitzer Solution Architect / Director Ennoble Consultancy Australia +61 405 847 168 -- 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.
