- 最新
- 最多得票
- 最多評論
Is there no way to query a particular GeoFence? Only submit a position query to an entire Collection?
This is correct. You currently can only evaluate against a geofence collection.
If (1), are the outline and assumptions below correct?
Yes
if (2), is this not terribly inefficient, particularly when the Collection can contain <= 50,000 fences?
We have designed geofence evaluation to be efficient, even when dealing with a large number of geofences. The value of evaluating against multiple geofences at once, is you are only charged for a single evaluation, even if it's against 50k geofences, so from the customer side, there is no downside to evaluating a lot of geofences at once, because you aren't billed for it.
HOWEVER -- the call to BatchEvaluateGeofences() tests the input [x,y] coordinates against every single geofence in the collection. I know exactly which one I want -- I created it specifically for this purpose in the user profile. Is there no way to test against a particular fence? Why have the individual fences be addressable at all? This seems like a terrible way to implement a very very basic use-case functionality for a location service. Is it the only way?
The question of why have the fences be addressable at all comes from the evaluation result which is provided to Amazon EventBridge. The event will contain the name of the geofence, allowing you to reference back to the dynamodb result for the user search result. This result is provided async from the BatchEvaluateGeofence command however, so you will need a listener on Amazon EventBridge in order to get back the evaluation result. A common way of doing this is using SQS + Lambda.
Hope this is helpful.
*** Update 10/5/2023 *** I was able to take this thread offline and get some excellent feedback from AWS. I'm sharing the outline of the conversation because surely there must be other people struggling with this and this thread might be the answer you were looking for.
----> Summary <----
MFZ -- miles from zip -- like you might see on a Craigslist apartment search -- you can search for apartments by price or size or whatever, and then filter the results using a MFZ search box
My approach was to create a geofence for each user when they first use the MFZ search box -- the user enters a 'zip_home' and 'zip_radius' and that's enough to create a circle. The user then submits a search. Testing against the geofence cannot be done in the initial DDB query because the conditional expression isn't beefy enough, so the results have to be processed in two rounds. In round (1) I get the bulk results back from DDB -- say all the apartments that match the price / size criteria -- but I still haven't filtered for location. I could iterate over the list and preselect those with zip codes exactly matching the user's zip_home -- but because a geofence exists, I have to test each returned result against it. So round (2) is to go over the list and test each valid apartment against the user's geofence.
I have to submit the coordinates of each apartment (which can be predetermined using getLocationInfo and stored in each apartment item) to the GeoFence Collection. Not to the user's individual geofence, which I know. But to the whole collection. This is problem #1
Problem #2 -- the results are delivered back to me asyncronously? So the lambda has to wait until al the results are back, then iterate over the result set and eliminate the apartments that fall outside the geofence? Does that sound correct? And if so -- is that a costly, inefficient, and ultimately very slow solution?
----> Answer from AWS <----
While you certainly can use Geofences for this, it feels like the async nature may pose a problem. Geofence collections are really designed to be used with our trackers, and so an event-driven async design works pretty well for that. For what you are looking to do (which is basically point in polygon analysis) we don't really support that. We did recently release a feature that allows you to search for trackers within a bounding box, but that assumes that you create each location as a tracker, which adds additional overhead.
---> BOTTOM LINE <--- It looks like I'm in trouble. I will need to use hook in a 3rd party service for this, if I want to continue using AWS at all. AWS Location Service does not support creating a circle/polygon on a map and efficiently testing DB results to see if they fall within the region.
相關內容
- AWS 官方已更新 2 年前
- AWS 官方已更新 2 年前