ArcGISLocation constructor
Creates a location object with timestamp and additional source properties.
An ArcGISLocation can be created from a variety of sources and using
different technologies. By supplying
ArcGISLocation.additionalSourceProperties
you can allow users of this
ArcGISLocation to find out how the data was captured.
Information should be provided as a set of key-value pairs, where the
String key describes the type of data held in the dynamic
value.
Values must be basic data types such as string, floating point, integer,
boolean or date. You can use any string for the key - but this API
recognizes a number of well known keys which should be used if available.
See LocationSourcePropertiesKeys:
- "floor" (an integer value). The floor number of the ArcGISLocation when in a building. Use LocationSourcePropertiesKeys.floor to reference this key.
- "satelliteCount" (an integer value). The number of satellites used to fix the ArcGISLocation. Use LocationSourcePropertiesKeys.satelliteCount to reference this key.
- "transmitterCount" (an integer value). The number of transmitters used to create an indoor positioning system (IPS) position. Use LocationSourcePropertiesKeys.transmitterCount to reference this key.
- "positionSource" (a string value). This key can be used to indicate the position source: GNSS, AppleIPS, BLE, WIFI, CELL, IP. GNSS indicates global navigation satellite system and AppleIPS is Apple’s indoor positioning technology. It is possible to have multiple position sources. In that case positionSource is a list with comma-separated values.
- "floorLevelId" (a string value). Unique ID of the feature stored in the levels ArcGISFeatureTable in accordance with the ArcGIS Indoors Information Model. Use LocationSourcePropertiesKeys.floorLevelId to reference this key. Keys are case-sensitive.
Parameters:
timestamp
— A timestamp when location was received.position
— A point geometry object.horizontalAccuracy
— The horizontal accuracy in meters. Positive values or NaN are supported.verticalAccuracy
— The vertical accuracy in meters. Positive values or NaN are supported.speed
— The location's speed in meters per second.course
— The location's course in degrees (clockwise), 0 being true North.lastKnown
— Indicates whether this is an outdated device position retrieved and cached earlier and therefore not guaranteed to represent the current location. Setting this to true will render with the LocationDisplay.acquiringSymbol, typically a grayed out location symbol.additionalSourceProperties
— A set of key-value pairs providing additional meta-data and properties about the source of this ArcGISLocation.
Implementation
factory ArcGISLocation({
DateTime? timestamp,
required ArcGISPoint position,
required double horizontalAccuracy,
required double verticalAccuracy,
required double speed,
required double course,
bool lastKnown = false,
Map<String, dynamic> additionalSourceProperties = const {},
}) {
_initializeArcGISEnvironmentIfNeeded();
final coreTimestamp = timestamp?.toArcGIS();
final coreAdditionalSourceProperties =
additionalSourceProperties.toDictionary(
keyType: _ElementType.string,
valueType: _ElementType.variant,
);
final handle = _withThrowingErrorHandler((errorHandler) {
return runtimecore.RT_Location_createWithAdditionalSourceProperties(
coreTimestamp?._handle ?? ffi.nullptr,
position._handle,
horizontalAccuracy,
verticalAccuracy,
speed,
course,
lastKnown,
coreAdditionalSourceProperties._handle,
errorHandler,
);
});
final ArcGISLocation object = ArcGISLocation._withHandle(handle);
object._timestamp.cache(timestamp);
object._additionalSourceProperties.value
.setCache(additionalSourceProperties);
return object;
}