After some trial and error and help from the experts in the Neo4j google group all my problems are now solved :)
Neo4jClient can be used to query withinDistance as below. Unfortunately withinDistance couldn't handle attaching parameters in the normal way so you would probably want to check your latitude, longitude and distance before using them. Also those metrics have to be doubles in order for the query to work.
var queryString = string.Format("withinDistance:[" + latitude + ", " + longitude + ", " + distance + "]"); var graphResults = graphClient.Cypher .Start(new { city = Node.ByIndexQuery("geom", queryString) }) .Where("city:City") .Return((city) => new { Entity = city.As<CityEntity>() }) .Limit(1) .Results;
Cypher cannot be used to return distance, you have to calculate it yourself. Obviously you should be able to use
REST http://localhost:7474/db/data/index/node/geom?query=withinDistance:[60.0,15.0,100.0]&ordering=score
to get the score (distance) but I didn't get that working and I want to user cypher.No there isn't but limit the result to 1 as in the query above and you will be fine.
A last note regarding this subject is that you should not add your nodes to the spatial layer just the spatial index. I had a lot of problems and strange exceptions before figure this one out.