Titanium.Map

submodule of Titanium
           
0.8

The top level Map module. The Map module is used for creating in-application native maps.

Objects

Name Description
Titanium.Map.Annotation

An Annotation object that is created by the method Titanium.Map.createAnnotation. This object gives you low level control over annotations that can be added to a Map View.

Titanium.Map.MapView

The MapView is an object created by Titanium.Map.createView and is used for embedding native mapping capabilities as a view in your application. With native maps, you can control the mapping location, the type of map, the zoom level and you can add custom annotations directly to the map.

Methods

Name Description
addEventListener add an event listener for the instance to receive view triggered events
createAnnotation create and return an instance of Titanium.Map.Annotation
createMapView create and return an instance of Titanium.Map.MapView
fireEvent fire a synthesized event to the views listener
removeEventListener remove a previously added event listener

Properties

Name Type Description
ANNOTATION_GREEN int

The head of the pin is green. Green pins indicate starting points on the map.

ANNOTATION_PURPLE int

The head of the pin is purple. Purple pins indicate user-specified points on the map.

ANNOTATION_RED int

The head of the pin is red. Red pins indicate destination points on the map.

HYBRID_TYPE int

Displays a satellite image of the area with road and road name information layered on top.

SATELLITE_TYPE int

Displays satellite imagery of the area.

STANDARD_TYPE int

Displays a street map that shows the position of all roads and some road names.

Events

This module has no events

Code Examples

Map Example

This is a basic map example that uses a custom annotation on the map.

var mountainView = Titanium.Map.createAnnotation({
    latitude:37.390749,
    longitude:-122.081651,
    title:"Appcelerator Headquarters",
    subtitle:'Mountain View, CA',
    pincolor:Titanium.Map.ANNOTATION_RED,
    animate:true,
    leftButton: '../images/appcelerator_small.png',
    myid:1 // CUSTOM ATTRIBUTE THAT IS PASSED INTO EVENT OBJECTS
});
 
var mapview = Titanium.Map.createView({
    mapType: Titanium.Map.STANDARD_TYPE,
    region: {latitude:33.74511, longitude:-84.38993, 
            latitudeDelta:0.01, longitudeDelta:0.01},
    animate:true,
    regionFit:true,
    userLocation:true,
    annotations:[mountainView]
});
 
win.add(mapview);