libs/upp-base/src/modules/geocode.ts
Provides geocoding and geolocation services for interacting with Google Maps API to retrieve address, timezone, and positional data.
Properties |
|
Methods |
Accessors |
constructor(androidPermissions: AndroidPermissions, geolocation: Geolocation, http: httpService, lang: languageService, modalCtrl: ModalController, alertCtrl: alertService, toast: toastService, platform: platformService)
|
|||||||||||||||||||||||||||
|
Initializes the service and requests Android permissions if applicable.
Parameters :
|
| DistanceTo | ||||||||
DistanceTo(coordinates: Coordinates)
|
||||||||
|
Calculates the distance in meters between the current position and specified coordinates.
Parameters :
Returns :
number
Distance in meters. |
| GetCurrentPosition | ||||||||||||
GetCurrentPosition(resolve: GeocodePositionCallback, reject: GeocodePositionErrorCallback)
|
||||||||||||
|
Retrieves the current geolocation position.
Parameters :
Returns :
void
|
| LoadGoogleMaps | ||||||
LoadGoogleMaps(loaded: Subject
|
||||||
|
Parameters :
Returns :
Promise<void>
|
| Async NearBy | |||||||||||||||
NearBy(center: Coordinates | null, radius: number)
|
|||||||||||||||
|
Enables or disables a proximity-based restriction. Starts watching the position if required and checks proximity.
Parameters :
Returns :
Promise<boolean>
A promise resolving to |
| RequestAddress | ||||||||||||
RequestAddress(lat: number, lng: number)
|
||||||||||||
|
Requests address data from the Google Geocoding API based on latitude and longitude. Caches responses to reduce repeated network requests.
Parameters :
Returns :
Promise<any>
A promise resolving to address data or |
| RequestTimezne | ||||||||||||
RequestTimezne(lat: number, lng: number)
|
||||||||||||
|
Requests timezone information for a specific location using the Google Timezone API.
Parameters :
Returns :
Promise<string>
A promise resolving to the timezone ID or 'UTC' if an error occurs. |
| ResolveAddress | ||||||||
ResolveAddress(address: string)
|
||||||||
|
Resolves an address from a string query using the Google Geocoding API. Caches responses to optimize repeated lookups.
Parameters :
Returns :
Promise<Address | null>
A promise resolving to parsed address data or |
| StaticUrl | ||||||||||||||||||||||||||||||
StaticUrl(lat: number, lng: number, width: number, height: number, zoom: number)
|
||||||||||||||||||||||||||||||
|
Generates a static map URL for a specific latitude and longitude.
Parameters :
Returns :
string
The constructed URL for the static map image. |
| WaitForNear | |||||||||||||||
WaitForNear(center: Coordinates, radius: number)
|
|||||||||||||||
|
Waits until the current position is within a specified radius of the center coordinates. Shows a modal if the user is outside the radius, and waits until they are nearby.
Parameters :
Returns :
Promise<boolean>
A promise resolving to |
| Public GMAP_API_LOADED |
Default value : false
|
| Public OnPositionChanged |
Default value : this._positionChanged.asObservable()
|
| CanGeolocate |
getCanGeolocate()
|
|
Checks if geolocation services are available on the platform. |
| CurrentPosition |
getCurrentPosition()
|
|
Returns the currently watched position
Returns :
WatchPosition
|