Showing maps using an address
This may sound like a simple problem but I have an application which pulls data from a database and clicking on an address calls appcelerators mapview function and show a map (which all works fine).
However, I don't have the long and lats for any addresses in my database and looking at the API doc it just refers to 'location' and 'region' in the form of long and lats, I don't want to send this because I don't have that information.
Is there a way to show a map passing a full address (including postcode/zip and country) and not just long and lats?
Regards, Scott.
3 Answers
-
Try looking at this site. http://developer.yahoo.com/geo/placefinder/
-
try something like this:
var addr = 'ZIP, City, Country'; Titanium.Geolocation.forwardGeocoder(addr,function(evt) { var objLocationAnnotation = Titanium.Map.createAnnotation({ latitude: evt.latitude, longitude: evt.longitude, image: 'img/icon-marker-map.png' }); objMapView.addAnnotation(objLocationAnnotation); });
-
Yet another update:
Try running the code on the phone! The lookup of addresses just doesn't seem to work properly in my simulator - on my phone it works like a charm! :-)
Update: It seems I was wrong; it makes no difference which order I put the code. The problem for me was just, that sometimes the address does not resolve to a position.
I had the same problem - the map would just show a blue screen - some water somewhere.
What worked for me, was to add the map to my window, before I set the position.