Mapview current location to destination

You must Login before you can answer or comment on any questions.

i want to google mapview when i click annotation how can i do this? like this image

![alt text](c:/Users/heedoo/Desktop/photo.jpg "photo")

var win = Ti.UI.currentWindow;
 
Titanium.Geolocation.purpose = "GPS user coordinates";
Titanium.Geolocation.distanceFilter = 10; // set the granularity of the location event
 
    Titanium.Geolocation.getCurrentPosition(function(e)
    {
        if (e.error)
        {
               alert('Sorry, geo location is not available now') // manage the error
                return;
        }
 
        var longitude = e.coords.longitude;
        var latitude = e.coords.latitude;
        var altitude = e.coords.altitude;
        var heading = e.coords.heading;
        var accuracy = e.coords.accuracy;
        var speed = e.coords.speed;
        var timestamp = e.coords.timestamp;
        var altitudeAccuracy = e.coords.altitudeAccuracy;
 
        mapview.region = {latitude:latitude,
            longitude:longitude,
            latitudeDelta:0.05,
            longitudeDelta:0.05
                    };
                // we use the above data the way we need it
    });
 
    Titanium.Geolocation.addEventListener('location',function(e)
    {
        if (e.error)
        {
                // manage the error
        return;
        }
 
        var longitude = e.coords.longitude;
        var latitude = e.coords.latitude;
        var altitude = e.coords.altitude;
        var heading = e.coords.heading;
        var accuracy = e.coords.accuracy;
        var speed = e.coords.speed;
        var timestamp = e.coords.timestamp;
        var altitudeAccuracy = e.coords.altitudeAccuracy;
 
               // again we use the gathered data
      });
 
 
var KCPC = Titanium.Map.createAnnotation({
    latitude:38.828726,
    longitude:-77.481885,
    title:"????????? | KCPC",
    subtitle:'15451 Lee Highway, Centreville, VA 20121',
    pincolor:Titanium.Map.ANNOTATION_GREEN,
    animate:true,
    rightButton: 'KCPClogo.symbol_color.png',
    id:2, // CUSTOM ATTRIBUTE THAT IS PASSED INTO EVENT OBJECTS
});
 
 
var mapview = Titanium.Map.createView({
    width:'auto',
    height : 'auto',
    mapType : Titanium.Map.STANDARD_TYPE,
 
    region :{latitude : 38.828726, longitude:-77.481885 ,latitudeDelta:0.05,longitudeDelta:0.05},
        animate:true,
        regionFit:true,
        annotation:[KCPC],
        userLocation:true });
    win.add(mapview);
    mapview.addAnnotation(KCPC);

1 Answer

sorry image doesn't work anyway like when we click iphone maps start location to destination view

Your Answer

Think you can help? Login to answer this question!