Database Reference
In-Depth Information
Figure 7-12. Searching for Locations within a certain distance of the User location
Listing 7-47. returnLocationsWithinDistance in the LocationService
public List<MappedLocation> returnLocationsWithinDistance(double lat, double lon, double distance,
string locationType)
{
var q = string.Format(distanceQueryAsString(lat, lon, distance));
List<MappedLocation> mappedLocations = _graphClient.Cypher
.Start(new { n = Node.ByIndexQuery("geom", q) })
.Where(" n.type = {locationType} ")
.WithParam("locationType", locationType)
.Return(() => Return.As<MappedLocation>("{locationId: n.locationId, address: n.address , " +
" city: n.city , state: n.state, zip: n.zip , name: n.name, lat: n.lat , lon: n.lon}"))
.Results.ToList();
addDistanceTo(mappedLocations, lat, lon);
return mappedLocations;
}
 
Search WWH ::




Custom Search