Package software.amazon.awscdk.services.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 Semantic Versioning 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; GeofenceCollection.Builder.create(this, "GeofenceCollection") .geofenceCollectionName("MyGeofenceCollection") // optional, defaults to a generated name .kmsKey(key) .build();
Use the grant()
or grantRead()
method to grant the given identity permissions to perform actions
on the geofence collection:
Role role; GeofenceCollection geofenceCollection = GeofenceCollection.Builder.create(this, "GeofenceCollection") .geofenceCollectionName("MyGeofenceCollection") .build(); 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; Tracker.Builder.create(this, "Tracker") .trackerName("MyTracker") // optional, defaults to a generated name .kmsKey(key) .build();
Use the grant()
, grantUpdateDevicePositions()
or grantRead()
method to grant the given identity permissions to perform actions
on the geofence collection:
Role role; Tracker tracker = Tracker.Builder.create(this, "Tracker") .trackerName("MyTracker") .build(); 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; Tracker tracker = Tracker.Builder.create(this, "Tracker") .trackerName("MyTracker") .geofenceCollections(List.of(geofenceCollection)) .build(); 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
:
Map.Builder.create(this, "Map") .mapName("my-map") .style(Style.VECTOR_ESRI_NAVIGATION) .customLayers(List.of(CustomLayer.POI)) .build();
Use the grant()
or grantRendering()
method to grant the given identity permissions to perform actions
on the map:
Role role; Map map = Map.Builder.create(this, "Map") .style(Style.VECTOR_ESRI_NAVIGATION) .build(); 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
:
PlaceIndex.Builder.create(this, "PlaceIndex") .placeIndexName("MyPlaceIndex") // optional, defaults to a generated name .dataSource(DataSource.HERE) .build();
Use the grant()
or grantSearch()
method to grant the given identity permissions to perform actions
on the place index:
Role role; PlaceIndex 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
:
RouteCalculator.Builder.create(this, "RouteCalculator") .routeCalculatorName("MyRouteCalculator") // optional, defaults to a generated name .dataSource(DataSource.ESRI) .build();
Use the grant()
or grantRead()
method to grant the given identity permissions to perform actions
on the route calculator:
Role role; RouteCalculator routeCalculator = RouteCalculator.Builder.create(this, "RouteCalculator") .dataSource(DataSource.ESRI) .build(); routeCalculator.grantRead(role);
-
ClassDescription(experimental) An additional layer you can enable for a map style.(experimental) Data source for a place index.(experimental) A Geofence Collection.(experimental) A fluent builder for
GeofenceCollection
.(experimental) Properties for a geofence collection.A builder forGeofenceCollectionProps
An implementation forGeofenceCollectionProps
(experimental) A Geofence Collection.Internal default implementation forIGeofenceCollection
.A proxy class which represents a concrete javascript instance of this type.(experimental) Represents the Amazon Location Service Map.Internal default implementation forIMap
.A proxy class which represents a concrete javascript instance of this type.(experimental) Intend use for the results of an operation.(experimental) A Place Index.Internal default implementation forIPlaceIndex
.A proxy class which represents a concrete javascript instance of this type.(experimental) A Route Calculator.Internal default implementation forIRouteCalculator
.A proxy class which represents a concrete javascript instance of this type.(experimental) A Tracker.Internal default implementation forITracker
.A proxy class which represents a concrete javascript instance of this type.(experimental) The Amazon Location Service Map.(experimental) A fluent builder forMap
.(experimental) Properties for the Amazon Location Service Map.A builder forMapProps
An implementation forMapProps
(experimental) A Place Index.(experimental) A fluent builder forPlaceIndex
.(experimental) Properties for a place index.A builder forPlaceIndexProps
An implementation forPlaceIndexProps
(experimental) The map political view.(experimental) The position filtering for the tracker resource.(experimental) A Route Calculator.(experimental) A fluent builder forRouteCalculator
.(experimental) Properties for a route calculator.A builder forRouteCalculatorProps
An implementation forRouteCalculatorProps
(experimental) The map style selected from an available data provider.(experimental) A Tracker.(experimental) A fluent builder forTracker
.(experimental) Properties for a tracker.A builder forTrackerProps
An implementation forTrackerProps