如何使用 AWS lambda 和 dynamo db 创建地理空间模块
How to create geospatial module with AWS lambda and dynamo db
首先感谢您花时间阅读我的问题。
我的计划是在 dynamodb 中的人员记录中添加纬度和经度记录,然后使用地理库(最好用 nodejs 编写)来计算给定半径内附近的人员。例如,计划是 return 仅来自这 50 英里半径的人员。
到目前为止,我尝试过的唯一地理库允许我将纬度和经度传递给它并确认它是否在给定的半径内。这个问题是我必须循环整个 dynamodb table 才能得到结果。是否有一种相反的功能,我将一个经纬度点和半径传递给地理库,然后地理库将一些纬度和经度边界传递给我,这样我就可以轻松地将它查询到 dynamodb(ex. (lat<: latboundary1 AND lat>:latboundary 2) AND (long<:longboundary1 AND long>:longboundary 2) )
This nodejs library提供了一个根据点和半径计算边界框的函数。您可以使用返回的 SW 和 NE 点进行查询。
.boundingCoordinates(distance, radius, inKilometers): Calculates the bounding coordinates of distance from the point and returns an array with the SW and NE points of the bounding box . If radius is not provided, the radius of the Earth will be used. The distance is calculated in miles unless inKilometers is true
首先感谢您花时间阅读我的问题。
我的计划是在 dynamodb 中的人员记录中添加纬度和经度记录,然后使用地理库(最好用 nodejs 编写)来计算给定半径内附近的人员。例如,计划是 return 仅来自这 50 英里半径的人员。
到目前为止,我尝试过的唯一地理库允许我将纬度和经度传递给它并确认它是否在给定的半径内。这个问题是我必须循环整个 dynamodb table 才能得到结果。是否有一种相反的功能,我将一个经纬度点和半径传递给地理库,然后地理库将一些纬度和经度边界传递给我,这样我就可以轻松地将它查询到 dynamodb(ex. (lat<: latboundary1 AND lat>:latboundary 2) AND (long<:longboundary1 AND long>:longboundary 2) )
This nodejs library提供了一个根据点和半径计算边界框的函数。您可以使用返回的 SW 和 NE 点进行查询。
.boundingCoordinates(distance, radius, inKilometers): Calculates the bounding coordinates of distance from the point and returns an array with the SW and NE points of the bounding box . If radius is not provided, the radius of the Earth will be used. The distance is calculated in miles unless inKilometers is true