Skip to content

Instantly share code, notes, and snippets.

@bradenpowers
Created December 21, 2010 12:31
Show Gist options
  • Save bradenpowers/749880 to your computer and use it in GitHub Desktop.
Save bradenpowers/749880 to your computer and use it in GitHub Desktop.
var mapview = Titanium.Map.createView({
mapType: Titanium.Map.STANDARD_TYPE,
region:{latitude:-33.8642194, longitude:151.2095497},
animate:true,
regionFit:true,
annotations:[]
});
var getShops = Ti.Network.createHTTPClient();
getShops.open('GET', 'URL');
getShops.onload = function(){
var xml = this.responseXML;
var resultList = xml.documentElement.getElementsByTagName("Result");
for (i = 0; i < resultList.length; i++)
{
var resultName = resultList.item(i).getAttribute("name");
var resultLat = resultList.item(i).getAttribute("lat");
var resultLng = resultList.item(i).getAttribute("lng");
var postId = resultList.item(i).getAttribute("postId");
var mapit = Ti.Map.createAnnotation({
latitude: resultLat,
longitude: resultLng,
myid: postId,
animate: true,
title: resultName,
pincolor: Ti.Map.ANNOTATION_RED
});
Titanium.API.info(resultLng);
mapview.addAnnotation(mapit);
}
};
getShops.send();
var map3 = Ti.Map.createAnnotation({
latitude: -33.8642194,
longitude: 151.2095497,
pincolor: Ti.Map.ANNOTATION_RED
});
mapwin.add(mapview);
mapview.addAnnotation(map3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment