Module: geo

Members

(static) config

Properties:
Name Type Description
config
Properties
Name Type Attributes Default Description
gpsAccuracy String <optional>
"ACCURACY_HIGH" Accuracy of localization. Must be one of `'ACCURACY_HIGH'` and `'ACCURACY_LOW'`
geocodeUseGoogle Boolean <optional>
true Tell to use Google Services instead of Titanium geocoding services.
clusterPixelRadius Number <optional>
15 The clustering radius expressed in px.
clusterRemoveOutOfBB Boolean <optional>
true Tell the clustering to remove pins that are out of the bounding box.
clusterMaxDelta Number <optional>
0.3 The value before the clustering is off.
clusterRegionBounds Boolean <optional>
false Tell the clustering to add the region information of its points.
googleApiKey String <optional>
null Optional Google API key for some methods.
Source:

(static) on

Attach events to current module
Source:

Methods

(static) authorizeLocationServices(opt)

Parameters:
Name Type Description
opt Object return Q.promise
Source:

(static) autocomplete(opt)

Return a list of predicted places based on an input string. To use this method, you need to create a browser key for the Google Places API Web Service and place it in the tiapp.xml file as a property named "google.places.api.key".
Parameters:
Name Type Description
opt Object
Properties
Name Type Attributes Default Description
input String The text string on which to search.
offset String <optional>
The position, in the input term, of the last character that the service uses to match predictions.
location String <optional>
The point around which you wish to retrieve place information. Must be specified as latitude,longitude.
radius Number <optional>
The distance (in meters) within which to return place results.
language String <optional>
The language code, indicating in which language the results should be returned, if possible. See https://developers.google.com/maps/faq#languagesupport
types String <optional>
The types of place results to return. See https://developers.google.com/places/web-service/autocomplete#place_types
components Object <optional>
A grouping of places to which you would like to restrict your results. Currently, you can use components to filter by country. The country must be passed as a two character, ISO 3166-1 Alpha-2 compatible country code. For example: components: {country: "fr"} would restrict your results to places within France.
success function <optional>
Success callback
error function <optional>
Error callback
silent Boolean <optional>
true Silence HTTP events
ttl Number <optional>
2592000 Override the TTL seconds for the cache. The default and maximum value is 30 days. Set to -1 to disable request caching.
Source:
See:

(static) checkForDependencies() → {Boolean}

Check if the Google Play Services are installed and updated, otherwise Maps doesn't work and the app crashes. It the check fail, an error is displayed that redirect to the Play Store, and the app is terminated. On iOS, simply return `true`
Source:
Returns:
Type
Boolean

(static) distanceInKm(lat1, lon1, lat2, lon2) → {Number}

Return the distance express in km between two points of the earth
Parameters:
Name Type Description
lat1 Number The latitude of first point
lon1 Number The longitude of first point
lat2 Number The latitude of second point
lon2 Number The longitude of second point
Source:
Returns:
The distance expressed in km
Type
Number

(static) geocode(opt)

Return the coordinates of an address
Parameters:
Name Type Description
opt Object
Properties
Name Type Attributes Default Description
address String The address to geocode
success function Success callback
error function <optional>
Error callback
language String <optional>
The language in which to return results
silent Boolean <optional>
true Silence HTTP events
ttl Number <optional>
2592000 Override the TTL seconds for the cache. The default and maximum value is 30 days. Set to -1 to disable request caching.
components Object <optional>
The component filters. Each component filter consists of a component:value pair and will fully restrict the results from the geocoder.
Source:
See:

(static) getCurrentPosition(opt)

Get the current GPS coordinates of user using `Ti.Geolocation.getCurrentPosition`
Parameters:
Name Type Description
opt Object
Source:

(static) getPlaceDetails(opt)

Return the details of a place with a specific placeid. To use this method, you need to create a browser key for the Google Places API Web Service and place it in the tiapp.xml file as a property named "google.places.api.key".
Parameters:
Name Type Description
opt Object
Properties
Name Type Attributes Default Description
placeid String A textual identifier that uniquely identifies a place, returned from a Place Search. See https://developers.google.com/places/web-service/search
extensions Object <optional>
Indicates if the Place Details response should include additional fields.
language String <optional>
The language code, indicating in which language the results should be returned, if possible. See https://developers.google.com/maps/faq#languagesupport
success function <optional>
Success callback
error function <optional>
Error callback
silent Boolean <optional>
true Silence HTTP events
ttl Number <optional>
2592000 Override the TTL seconds for the cache. The default and maximum value is 30 days. Set to -1 to disable request caching.
Source:
See:

(static) getRegionBounds(array, mulGap) → {Map.MapRegionType}

Get the minimum MapRegion to include all annotations in array
Parameters:
Name Type Description
array Object An array of annotations
mulGap Number Gap multiplier
Source:
Returns:
Type
Map.MapRegionType

(static) isAuthorizationUnknown() → {Boolean}

Check if the the app doesn't know if it can use location services. This is the default state.
Source:
Returns:
Type
Boolean

(static) isAuthorized() → {Boolean}

Check if the location services are enabled and the app is authorized to use them.
Source:
Returns:
Type
Boolean

(static) isDenied() → {Boolean}

On iOS, check if the the app is denied from using the location services and must be notified to the user. Returns false for every other platform.
Source:
Returns:
Type
Boolean

(static) markerCluster(event, markers, keysopt) → {Array}

Process a set of markers and cluster them
Parameters:
Name Type Attributes Description
event Object The event raised from `regionchanged`.
markers Object The markers **must be** an instance of `Backbone.Collection` or an Object id-indexed
keys Object <optional>
The keys of the object to get informations. Default: `{ latitude: 'lat', longitude: 'lng', id: 'id' }`
Source:
Returns:
Type
Array

(static) off(name, cb)

Remove events to current module
Parameters:
Name Type Description
name String Event key
cb function Callback
Source:

(static) reverseGeocode(opt)

Return the address with the specified coordinates
Parameters:
Name Type Description
opt Object
Properties
Name Type Attributes Default Description
lat String The latitude of the address to search
lng String The longitude of the address to search
success function Success callback
error function <optional>
Error callback
language String <optional>
The language in which to return results
silent Boolean <optional>
true Silence HTTP events
ttl Number <optional>
2592000 Override the TTL seconds for the cache. The default and maximum value is 30 days. Set to -1 to disable request caching.
Source:
See:

(static) startNavigator(lat, lng, modeopt)

Open Apple Maps on iOS, Google Maps on Android and route from user location to defined location
Parameters:
Name Type Attributes Description
lat Number Destination latitude
lng Number Destination longitude
mode String <optional>
GPS mode used (walking,driving)
Source:

(static) trigger(name, cb)

Trigger events from current module
Parameters:
Name Type Description
name String Event key
cb function The data
Source: