public async Task <ActionResult> radiusQueryAsync(radiusQuery query) { var centerPoint = new GeoPoint(query.lat, query.lng); var radius = query.miles * 1609.34; var attributesToGet = new List <string> { _config.RangeKeyAttributeName, _config.GeoJsonAttributeName // "zipcode", // "Title" }; var radReq = new QueryRadiusRequest(centerPoint, radius); radReq.QueryRequest.AttributesToGet = attributesToGet; // radReq.QueryRequest.TableName = _config.TableName; var result = await _geoDataManager.QueryRadiusAsync(radReq); var dtos = GetResultsFromQuery(result); return(Json(dtos)); }
public async Task <ActionResult> Index(Dynamo dynamo) { SetupGeoDataManager(); if (!ModelState.IsValid) { return(Json("Bad Request")); } ActionResult response; int miles = 0; if (ViewBag.distance == "05 miles") { miles = 5; } else if (ViewBag.distance == "10 miles") { miles = 10; } else { miles = 15; }; double lat = dynamo.lat; double lng = dynamo.lng; var radiusquery = new radiusQuery(); radiusquery.lat = dynamo.lat; radiusquery.lng = dynamo.lng; radiusquery.miles = miles; response = await radiusQueryAsync(radiusquery); return(response); }