The problem you are trying to solve is very common, google "point in polygon"
kris On Tue, Jan 24, 2012 at 10:14 PM, coollearner <[email protected]> wrote: > This is my code objective: I want an android application to start to > trigger connecting to server and sending the latitude and longitude > only when the phone (being used in a car) is within a road area ( say > an area 1km x 30m ). It is continuously listening to its location but > will start sending to server once it enters the area and will > continuously send and will stop only once it exit the area. > > > A good answer i received for this: "create two location, a NorthWest > location and a SouthEast location that represent your box. In your > onLocationChanged method, compare the new location with the corners, > such that (l.lat > se.lat && l.lat < nw.lat) and (l.lon < se.lon && > l.lon > nw.lon) where "l" is the newest location from the callback, > "se" is the south east corner of your boundary and "nw" is the north > west corner of your bounder. If it meets the 4 above conditions, then > you send to your server" > > > I think this is applicable when a pair of the sides of the > rectangular area are parallel to the latitude(equator) and the other > pair of the sides parallel to the longitude lines (meridian). What if > the rectangular area's sides are not parallel to the latitude and > longitude lines . How can I meet my objective? Proximity alert will > form a circle. Should a mathematical formula do it sir? > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

