Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement