Using AWS SDK to help call and allow a user create a tracker API in JavaScript?

113 Views Asked by At

Ive been trying to create a form where users can provide a name and location then create a tracker, to be used alongside Location Services Maps. I fee like i am close but am not sure why its not working nor rendering.

enter image description here

1

There are 1 best solutions below

2
On

A few initial thoughts based on the code snippet you shared:

  • I don't know enough about your use case, you wouldn't need to have more than one tracker per asset type when tracking moving objects. If that's the case for you, create trackers using AWS CLI or AWS Console.
  • If you'd like to create trackers using the JavaScript SDK, first, you need to authenticate your request. See Prerequisites for using Amazon Location Service and Geofencing and Tracking to get more information.
  • Check your input parameters (params) against the CreateTracker API requirements and make sure you're using the right parameters and passing the right values.
  • Check your browser's console and post the errors you're getting here to help me better understand the issue.
  • Note that createTracker creates a new tracker that does not have any data - this means that there is nothing to render yet. To track your assets, you'll need to send position updates to the tracker. See Start Tracking for an example.

Share a bit more about your use case, i.e., what is it you're trying to do. That'll help me better understand the problem.

UPDATE: here is what I'd do for your use case:

Hope this helps.