Converting addresses to latitude and longitude locations
Getting our location is all well and good when it's done for us, but humans don't think of places in terms of latitude and longitude values. We use good old addresses to define points on a map. To convert addresses to decimal latitude and longitude values, we can again use the Ti.Geolocation
namespace, and specifically a method within it called forwardGeocoder
. Titanium has built-in methods for geocoding that utilize and essentially black box the services provided by the Apple and Google Maps APIs. The Geocoding API processes the conversion of addresses (such as 1600, Amphitheatre Parkway, Mountain View, CA) into geographic coordinates (such as latitude 37.423021 and longitude 122.083739), which you can use to place markers or position the map. This API provides a direct way to access a geocoder via an HTTP request.
How to do it...
Firstly, we need to create some input fields so that the user can provide us with a starting...