Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Google Map Annotation from ACS Place Query

$
0
0

Im trying to display multiple places(from ACS place query - there are two mock data in db at the moment) as a pin/photo on map.

But the annotations are not showing up.. Here is my code, help..

// some stuff..
 
    var myAnnotations = new Array();
 
    var mapView = MapModule.createView({
        mapType: MapModule.NORMAL_TYPE,
        animate: true,
        region: {latitude: -37.829055, longitude: 144.963155, latitudeDelta: 0.001, longitudeDelta: 0.001 },
        height: '100%',
        userLocation: true,
        top: 0,
        right: 0,
        width: '100%'
    });
 
 
 
win.addEventListener('open', function () {
 
        Cloud.Places.query({
            page: 1,
            per_page: 20,
            where: {
                lnglat: {
                    'user':currentuserid,
                    '$nearSphere': [longi, lat],
                    '$maxDistance': 0.001569
                }
            }
        }, function (e) {
            if (e.success) {
 
                for (var i = 0; i < e.places.length; i++) {
                    var place = e.places[i];
 
                    var dbMarker = Titanium.Map.createAnnotation({
                        latitude: place.longitude,
                        longitude: place.latitude,
                        pincolor: MapModule.ANNOTATION_AZURE,
                        title: 'Sydney Harbour Bridge',
                        subtitle: 'Port Jackson',
                    });
                    myAnnotations.push(dbMarker);  
                }
                mapView.annotations = myAnnotations;   
            } else {
                alert('Error:\n' +
                    ((e.error && e.message) || JSON.stringify(e)));
            }
        });    
    });  
 
 
win.add(mapView);

Viewing all articles
Browse latest Browse all 8068

Trending Articles