Book Image

Neo4j Cookbook

By : Ankur goel, Ankur Goel
Book Image

Neo4j Cookbook

By: Ankur goel, Ankur Goel

Overview of this book

Table of Contents (17 chapters)
Neo4j Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Finding geometries within a distance


In this recipe, you will learn how to find all the geometries within a distance using the spatial REST interface.

Getting ready

Perform the following steps to get started with this recipe:

  1. Install Neo4j using the recipes from Chapter 1, Getting Started with Neo4j. This installation process will depend on your preference for your machine OS type.

  2. Install the Neo4j Spatial plugin using the Installing the Neo4j Spatial extension, recipe from this chapter.

  3. Restart the Neo4j graph database server using the following command:

    $NEO4J_ROOT_DIR/bin/neo4j restart
    

How to do it...

In this recipe, we will use the http://<neo4j_server_ip>:<port>/db/data/ext/SpatialPlugin/graphdb/findGeometriesWithinDistance endpoint to find all the geometries within a certain distance.

Let's find all the geometries between the specified distance using the following information:

"pointX" : -116.67,
"pointY" : 46.89,
"distanceinKm" : 500,
url = "http://<neo4j_server_ip>:&lt...