[android-developers] Re: How to calculate distance between to city (dynamically)
Android has a distanceTo method that does this for you, it's in the Location class (see http://developer.android.com/reference/android/location/Location.html#distanceTo%28android.location.Location%29) So, for instance: Location amsCentral = new Location(Amsterdam CS); amsCentral.setLatitude(52.3791); amsCentral.setLongitude(4.9002); Location histMuseum = new Location(Historical Museum); histMuseum.setLatitude(52.370247); histMuseum.setLongitude(4.889731); float distanceInMeters = histMuseum.distanceTo(amsCentral); (P.S. The distance between the above two locations is 1216.0496 meters ;-) On Sep 17, 7:42 am, Maps.Huge.Info (Maps API Guru) cor...@gmail.com wrote: The Haversine formula computes distance between two points along a spheroid (such as Earth). You will need to know the coordinates of each city to use this formula. Coordinates for nearly all cities in the world can be downloaded from the geonames.org website for free. The Google geocoder will also return those coordinates but you'll have to obey the terms in order for you to use that service. For the exact formula, try searching Google. -John Coryat -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: How to calculate distance between to city (dynamically)
Doesn't the method of Location class implement the same formula??? On Fri, Sep 17, 2010 at 11:21 AM, Rocky rkjhaw1...@gmail.com wrote: thanks man On Fri, Sep 17, 2010 at 11:12 AM, Maps.Huge.Info (Maps API Guru) cor...@gmail.com wrote: The Haversine formula computes distance between two points along a spheroid (such as Earth). You will need to know the coordinates of each city to use this formula. Coordinates for nearly all cities in the world can be downloaded from the geonames.org website for free. The Google geocoder will also return those coordinates but you'll have to obey the terms in order for you to use that service. For the exact formula, try searching Google. -John Coryat -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Thanks Regards Rakesh Kumar Jha Software Developer Symphony Services Corp (India) Pvt Ltd Bangalore (O) +918030273740 (R) +919886336619 -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to calculate distance between to city (dynamically)
you can also use 'haversine' formula. google it. you need two geopoint. On Sep 16, 3:36 pm, Rocky rkjhaw1...@gmail.com wrote: Hi Shashidhar, Thanks dear... On Thu, Sep 16, 2010 at 12:56 PM, Shashidhar shashi.zep...@gmail.comwrote: Have a look at this http://developer.android.com/reference/android/location/Location.html...[]%29http://developer.android.com/reference/android/location/Location.html... http://developer.android.com/reference/android/location/Location.html... -Shashidhar On Thu, Sep 16, 2010 at 12:45 PM, RKJ (Android developer) rkjhaw1...@gmail.com wrote: Hi All, I want to calculate the distance between 2 city, whatever user mention. Example - Default City - 1st City - New York or New Delhi, London Seoul anything User Put - 2nd City - California Need - to calculate distance between California to New York or London Welcome any hints --RKJ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2Bunsubs cr...@googlegroups.com 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2Bunsubs cr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Thanks Regards Rakesh Kumar Jha Software Developer Symphony Services Corp (India) Pvt Ltd Bangalore (O) +918030273740 (R) +919886336619 -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: How to calculate distance between to city (dynamically)
Hi DADADA, Can u elaborate it. On Thu, Sep 16, 2010 at 9:13 PM, dadada ytbr...@gmail.com wrote: you can also use 'haversine' formula. google it. you need two geopoint. On Sep 16, 3:36 pm, Rocky rkjhaw1...@gmail.com wrote: Hi Shashidhar, Thanks dear... On Thu, Sep 16, 2010 at 12:56 PM, Shashidhar shashi.zep...@gmail.com wrote: Have a look at this http://developer.android.com/reference/android/location/Location.html...[]%29http://developer.android.com/reference/android/location/Location.html...%5B%5D%29 http://developer.android.com/reference/android/location/Location.html... http://developer.android.com/reference/android/location/Location.html... -Shashidhar On Thu, Sep 16, 2010 at 12:45 PM, RKJ (Android developer) rkjhaw1...@gmail.com wrote: Hi All, I want to calculate the distance between 2 city, whatever user mention. Example - Default City - 1st City - New York or New Delhi, London Seoul anything User Put - 2nd City - California Need - to calculate distance between California to New York or London Welcome any hints --RKJ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.comandroid-developers%2Bunsubs cr...@googlegroups.com 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.comandroid-developers%2Bunsubs cr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Thanks Regards Rakesh Kumar Jha Software Developer Symphony Services Corp (India) Pvt Ltd Bangalore (O) +918030273740 (R) +919886336619 -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Thanks Regards Rakesh Kumar Jha Software Developer Symphony Services Corp (India) Pvt Ltd Bangalore (O) +918030273740 (R) +919886336619 -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to calculate distance between to city (dynamically)
The Haversine formula computes distance between two points along a spheroid (such as Earth). You will need to know the coordinates of each city to use this formula. Coordinates for nearly all cities in the world can be downloaded from the geonames.org website for free. The Google geocoder will also return those coordinates but you'll have to obey the terms in order for you to use that service. For the exact formula, try searching Google. -John Coryat -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: How to calculate distance between to city (dynamically)
thanks man On Fri, Sep 17, 2010 at 11:12 AM, Maps.Huge.Info (Maps API Guru) cor...@gmail.com wrote: The Haversine formula computes distance between two points along a spheroid (such as Earth). You will need to know the coordinates of each city to use this formula. Coordinates for nearly all cities in the world can be downloaded from the geonames.org website for free. The Google geocoder will also return those coordinates but you'll have to obey the terms in order for you to use that service. For the exact formula, try searching Google. -John Coryat -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Thanks Regards Rakesh Kumar Jha Software Developer Symphony Services Corp (India) Pvt Ltd Bangalore (O) +918030273740 (R) +919886336619 -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en