Namespace Amazon.CDK.AWS.Location.Alpha
AWS::Location Construct Library
---The APIs of higher level constructs in this module are experimental and under active development.
They are subject to non-backward compatible changes or removal in any future version. These are
not subject to the <a href="https://semver.org/">Semantic Versioning</a> model and breaking changes will be
announced in the release notes. This means that while you may use them, you may need to update
your source code when upgrading to a newer version of this package.
This module is part of the AWS Cloud Development Kit project.
Amazon Location Service lets you add location data and functionality to applications, which includes capabilities such as maps, points of interest, geocoding, routing, geofences, and tracking. Amazon Location provides location-based services (LBS) using high-quality data from global, trusted providers Esri and HERE. With affordable data, tracking and geofencing capabilities, and built-in metrics for health monitoring, you can build sophisticated location-enabled applications.
Geofence Collection
Geofence collection resources allow you to store and manage geofences—virtual boundaries on a map. You can evaluate locations against a geofence collection resource and get notifications when the location update crosses the boundary of any of the geofences in the geofence collection.
Key key;
new GeofenceCollection(this, "GeofenceCollection", new GeofenceCollectionProps {
GeofenceCollectionName = "MyGeofenceCollection", // optional, defaults to a generated name
KmsKey = key
});
Use the grant()
or grantRead()
method to grant the given identity permissions to perform actions
on the geofence collection:
Role role;
var geofenceCollection = new GeofenceCollection(this, "GeofenceCollection", new GeofenceCollectionProps {
GeofenceCollectionName = "MyGeofenceCollection"
});
geofenceCollection.GrantRead(role);
Tracker
A tracker stores position updates for a collection of devices. The tracker can be used to query the devices' current location or location history. It stores the updates, but reduces storage space and visual noise by filtering the locations before storing them.
For more information, see Trackers.
To create a tracker, define a Tracker
:
Key key;
new Tracker(this, "Tracker", new TrackerProps {
TrackerName = "MyTracker", // optional, defaults to a generated name
KmsKey = key
});
Use the grant()
, grantUpdateDevicePositions()
or grantRead()
method to grant the given identity permissions to perform actions
on the geofence collection:
Role role;
var tracker = new Tracker(this, "Tracker", new TrackerProps {
TrackerName = "MyTracker"
});
tracker.GrantRead(role);
If you want to associate a tracker with geofence collections, define a geofenceCollections
property or use the addGeofenceCollections()
method.
GeofenceCollection geofenceCollection;
GeofenceCollection geofenceCollectionForAdd;
Tracker tracker;
var tracker = new Tracker(this, "Tracker", new TrackerProps {
TrackerName = "MyTracker",
GeofenceCollections = new [] { geofenceCollection }
});
tracker.AddGeofenceCollections(geofenceCollectionForAdd);
Legacy Resources
AWS has released new Enhanced Places, Routes, and Maps. Since these use AWS-managed resources, users no longer need to create Maps, Places, and Routes resources themselves.
As a result, the following constructs are now considered legacy.
For more information, see developer guide.
Map
The Amazon Location Service Map resource gives you access to the underlying basemap data for a map. You use the Map resource with a map rendering library to add an interactive map to your application. You can add other functionality to your map, such as markers (or pins), routes, and polygon areas, as needed for your application.
For information about how to use map resources in practice, see Using Amazon Location Maps in your application.
To create a map, define a Map
:
new Map(this, "Map", new MapProps {
MapName = "my-map",
Style = Style.VECTOR_ESRI_NAVIGATION,
CustomLayers = new [] { CustomLayer.POI }
});
Use the grant()
or grantRendering()
method to grant the given identity permissions to perform actions
on the map:
Role role;
var map = new Map(this, "Map", new MapProps {
Style = Style.VECTOR_ESRI_NAVIGATION
});
map.GrantRendering(role);
Place Index
A key function of Amazon Location Service is the ability to search the geolocation information. Amazon Location provides this functionality via the Place index resource. The place index includes which data provider to use for the search.
To create a place index, define a PlaceIndex
:
new PlaceIndex(this, "PlaceIndex", new PlaceIndexProps {
PlaceIndexName = "MyPlaceIndex", // optional, defaults to a generated name
DataSource = DataSource.HERE
});
Use the grant()
or grantSearch()
method to grant the given identity permissions to perform actions
on the place index:
Role role;
var placeIndex = new PlaceIndex(this, "PlaceIndex");
placeIndex.GrantSearch(role);
Route Calculator
Route calculator resources allow you to find routes and estimate travel time based on up-to-date road network and live traffic information from your chosen data provider.
For more information, see Routes.
To create a route calculator, define a RouteCalculator
:
new RouteCalculator(this, "RouteCalculator", new RouteCalculatorProps {
RouteCalculatorName = "MyRouteCalculator", // optional, defaults to a generated name
DataSource = DataSource.ESRI
});
Use the grant()
or grantRead()
method to grant the given identity permissions to perform actions
on the route calculator:
Role role;
var routeCalculator = new RouteCalculator(this, "RouteCalculator", new RouteCalculatorProps {
DataSource = DataSource.ESRI
});
routeCalculator.GrantRead(role);
Classes
Custom |
(experimental) An additional layer you can enable for a map style. |
Data |
(experimental) Data source for a place index. |
Geofence |
(experimental) A Geofence Collection. |
Geofence |
(experimental) Properties for a geofence collection. |
Intended |
(experimental) Intend use for the results of an operation. |
Map | (experimental) The Amazon Location Service Map. |
Map |
(experimental) Properties for the Amazon Location Service Map. |
Place |
(experimental) A Place Index. |
Place |
(experimental) Properties for a place index. |
Political |
(experimental) The map political view. |
Position |
(experimental) The position filtering for the tracker resource. |
Route |
(experimental) A Route Calculator. |
Route |
(experimental) Properties for a route calculator. |
Style | (experimental) The map style selected from an available data provider. |
Tracker | (experimental) A Tracker. |
Tracker |
(experimental) Properties for a tracker. |
Interfaces
IGeofence |
(experimental) A Geofence Collection. |
IGeofence |
(experimental) Properties for a geofence collection. |
IMap | (experimental) Represents the Amazon Location Service Map. |
IMap |
(experimental) Properties for the Amazon Location Service Map. |
IPlace |
(experimental) A Place Index. |
IPlace |
(experimental) Properties for a place index. |
IRoute |
(experimental) A Route Calculator. |
IRoute |
(experimental) Properties for a route calculator. |
ITracker | (experimental) A Tracker. |
ITracker |
(experimental) Properties for a tracker. |