How to create Maps and Geofence using Amazon Location Service?

Reading Time: 8 minutes

AWS is previewing its latest service – Amazon Location Service. Yes, you read it right! AWS is now into geo-based services too! This blog covers everything that you should know about this new service including how to create a map and Geofence Collections!

Introducing Amazon Location Service

AWS announced the preview of Amazon Location Service during Amazon’s recent virtual event re: Invent. Using this service, you can add location-based features to your web-based and mobile applications including displaying maps, validating addresses, performing geocoding, tracking the movement of packages and devices, and much more!  Amazon location service provides features including affordable data, tracking and geofencing capabilities, and built-in metrics for health monitoring, which can help you in building sophisticated location-enabled applications. 

The AWS service is built on high-quality geospatial data from Esri and HERE Technologies. These two are the biggest location data providers in the world. AWS has plans to add more partners in the future. 

Amazon Location Service is fully integrated with services such as AWS CloudTrail, Amazon CloudWatch, Amazon EventBridge, and AWS IAM. 

As of now, Amazon Location is available in the following regions:

“Priced at a fraction of common alternatives, Amazon Location Service gives you access to maps and location-based services from multiple providers on an economical, pay-as-you-go basis,” according to AWS Chief Evangelist Jeff Barr.

AWS promises that Location will be more affordable, with a variety of pricing plans with a free three-month trial, that starts at $0.04 for retrieving 1,000 map tiles, this is quite reasonable overall.

Resources provided by Amazon Location Services

Let’s discuss all types of resources that Amazon Location Service makes available. Here is the list:

Maps – We can create maps using data from AWS partners. As of now, you can choose between Esri and HERE Technologies. Once you create a map, you can retrieve a tile. You will use Mapbox GL, Tangram, or another library to retrieve a tile.

Place Indexes – We can choose between indexes provided by Esri and HERE Technologies. The indexes support the SearchPlaceIndexForPosition function which returns places, such as residential addresses or points of interest (often known as POI) that are closest to the position that you supply, while also performing reverse geocoding to turn the position (a pair of coordinates) into a legible address. Indexes also support the SearchPlaceIndexForText function, which searches for addresses, businesses, and points of interest using free-form text such as an address, a name, a city, or a region.

Trackers –Trackers receive location updates from one or more devices and can be queried for the current position or location history of a device. Trackers can be linked to Geofence Collections to implement monitoring of devices as they move in and out of geofences.

Geofence Collections – Each collection contains a list of geofences that define geographic boundaries. 

Routing (coming soon) – Amazon Location Service Routes lets you find routes and estimate travel time based on the up-to-date roadway and live traffic information. Build features that allow your application to request the travel time, distance, and directions between any two locations.

Common use cases for using Amazon Location Service

Amazon Location Service lets you build a range of applications, from asset tracking to location-based marketing. 

The following are common use cases:

User Engagement and geomarketing – You can use location data to build solutions that improve user engagement with marketing to target customers. For example, Amazon Location can trigger an event that prompts a notification when a customer who ordered a pizza on their mobile app is nearby. You can also build geomarketing features so that retailers can send discount codes or digital flyers to customers who are near target stores.

Asset tracking – You can build a number of solutions that optimize remote staffing, secure shipments en-route, and maximize dispatch efficiency. You can build asset-tracking features to help businesses understand the current and historical locations of their products, personnel, and infrastructure.

Delivery – You can Integrate location features into delivery applications to store, track, and coordinate the departure location, delivery vehicles, and their destination. For example, a grocery delivery application with Amazon Location features built-in has location tracking and geofencing capabilities that can automatically notify a grocery shop owner when a delivery driver is nearby. This reduces the wait time.

Create a map using Amazon Location Service

Login into the AWS Management Console and make sure that you will choose the region which supports Amazon Location Service. 

Note – If you will try to access the Amazon Location service from the unsupported region, you will get a message as shown in the following screenshot:

How to create Maps and Geofence using Amazon Location Service?

Now Let’s choose US East (N. Virginia)  to get started with Amazon Location

Then search for Amazon Location Service in the search box of the AWS console as shown in the below screenshot:

How to create Maps and Geofence using Amazon Location Service?

Select the Amazon Location Service from the search result. 

You will get the screen as shown in the following screenshot. 

How to create Maps and Geofence using Amazon Location Service?

In the above screen, you can either click Try it! to create a set of starter resources, or you can open up the navigation on the left and create them one-by-one.

We will open up the navigation on the left and create a map by following steps as shown in the following screenshot:

How to create Maps and Geofence using Amazon Location Service?

Then click Create map to proceed, you will the screen as shown in the following screenshot:

How to create Maps and Geofence using Amazon Location Service?

Add the map name and description as shown in the above screenshot. Also, select the map type from the provided list by both data providers – Esri or HERE.

How to create Maps and Geofence using Amazon Location Service?

And click on Create Map button (as shown in the above screenshot) to create the map. It will show you the following screen with the details of your map including the name of the map, data source, description, ARN, and map style.

You can also see the preview of the map as shown in the below screenshot:

How to create Maps and Geofence using Amazon Location Service?

If you will click on the Maps in the the navigation on the left, you will now able the list of created maps also as shown in the following screenshot:

Now our map is ready to embed  in the application. We can include this map using several options including the Amplify JavaScript SDK, the Amplify Android SDK, the Amplify iOS SDK, Tangram, and Mapbox GL. We will discuss more about how to embed Map into the web or mobile application in our upcoming blog. Stay tuned to keep getting all updates about our upcoming new blogs!

Create and monitor geofences using Amazon Location Service

Assume that we want to track the position of devices so that we can be notified when they enter or exit a given region. Let’s use a GeoJSON editing tool such as geojson.io to create a geofence that is built from polygons, and save (download) the resulting file as GeoJSON. You will get a map.geojson file. We will be using this file in the next step to create a geofence collection.

How to create Maps and Geofence using Amazon Location Service?

Let’s create a geofence collection using the download file. Click on the Create and monitor geofences in the left-side navigation as shown in the following screenshot. Click on the

You will get the following screen. 

Click on the Browse files button and upload a GeoJSON file that we have created and downloaded in the previous step. Enter a name and description and click on

You will get the following screen. In this screen you can select an existing tracker or create a new one, this tracker will be linked to the previously selected geofence collection. We will choose to create new tracker as shown in the following screenshot

 Enter a name and description and click on 

Now this step is to arrange for the tracker to send events to Amazon EventBridge so that we can monitor them in CloudWatch Logs. we will leave the settings as-is, and click Next to proceed:

Quickly review all choices, and click Finalize to move ahead. You will get the following screen. And our Geofence monitoring is active!

How to create Maps and Geofence using Amazon Location Service?

As we have seen, it is very easy to create a map or a geofence using Amazon Location Service. In our next blog, we will demonstrate how to embed maps and geofences in our web application. 

Best Practices for Amazon Location Service

The following best practices for Amazon Location Service can help manage or avoid security risks, and can help you with proper resource management and cost management:

Best practices for security:

  • Manage, control, or limit access to your Amazon Location resources using identity federation, IAM users, and IAM roles. 
  • Follow the Principle of Least Privilege when granting access to resources. 
  • Take advantage of monitoring and logging tools like AWS CloudTrail.
  • Use secure connections, such as those that begin with https://.

Best practices for resource management:

  • Select regional endpoints that are central to your expected user base to ensure the best experience for them.
  • Be sure to use Amazon Location resources in accordance with the terms of use agreement of the third-party provider. 

Best practices for cost management:

  • Use monitoring tools such as Amazon CloudWatch to track your resource usage and set alerts that notify you when cost or usage is going to exceed your specified limits.

Conclusion

In this blog, you have discussed all important topics about Amazon Location Service and also seen how easily we can create a map using Amazon Location Service and embed it in the application. As of now  Amazon Location Service may not be as fully featured as the Google Maps Platform, but AWS promises that Location will be more affordable, with a variety of pricing plans.

As it is a just released new service, there is a learning curve in the beginning. Once you are familiar with it, it is very helpful and easy to implement.

We will discuss more about how to embed Map into the web or mobile application in our upcoming blog. Stay tuned to keep getting all updates about our upcoming new blogs on AWS’s newly launched services.

Meanwhile …

Keep Exploring -> Keep Learning -> Keep Mastering

This blog is part of our effort toward building a knowledgeable and kick-ass tech community. At Workfall, we strive to provide the best tech and pay opportunities to AWS-certified talents. If you’re looking to work with global clients, and build kick-ass products while making big bucks doing so, give it a shot at workfall.com/partner today.

Back To Top