I have a table with the following data:
place_id | lat_part | lat | lon_part | lon
And the following is the schema:
tb_places = Table.create('places', schema=[
HashKey('place_id', data_type="S"),
], throughput={
'read': 1,
'write': 1,
},
global_indexes= [
GlobalAllIndex('lat_index', parts=[
HashKey('lat_part', data_type="S"),
RangeKey('lat', data_type="N"),
]),
GlobalAllIndex('lon_index', parts=[
HashKey('lon_part', data_type="S"),
RangeKey('lon', data_type="N"),
])
],
connection=cm.db
)
And now I want to do a query to find the place that is within 0.003 difference in lat and lon with given (gLat,gLon)
ie in mysql terms:
SELECT * FROM places WHERE lat_part = "9" AND
(lat >= gLat - 0.003 AND lat <= gLat + 0.003) AND
(lon >= gLon - 0.003 AND lon <= gLon + 0.003)
Aucun commentaire:
Enregistrer un commentaire