Last active
August 29, 2015 14:02
-
-
Save tomcorbett/1968c204d5153646173a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* I took this code out of a controller I am using in Laravel so will have to fill in the blanks, include Neo4J etc. | |
*/ | |
$client = new Client('localhost', '7474'); | |
echo "<br /><br />Layer Created<br />"; | |
$layer = $client->makeSimplePointLayer('test', 'latitude', 'longitude'); | |
$layerSaved = $layer->save(); | |
echo "<pre>"; | |
var_dump($layer, $layerSaved); | |
echo "</pre><br /><br />Node Created<br />"; | |
//exit; | |
$node = $client->makeNode(array( | |
'name' => 'testing', | |
'value' => uniqid(), | |
'longitude' => -50, | |
'latitude' => 30 | |
)); | |
$nodeSaved = $node->save(); | |
echo "<pre>"; | |
var_dump($node, $nodeSaved); | |
echo "</pre><br /><br />Point Added To Layer:<br />"; | |
$result = $layer->add($node); | |
echo "<pre>"; | |
var_dump($result); | |
echo "</pre><br /><br />Getting within distance<br />"; | |
$nodes = $layer->findNodesWithinDistance(25, -80, 1000000000); | |
echo "<pre>"; | |
var_dump($nodes, $nodes->count()); | |
echo "</pre><br /><br />Getting within BBox"; | |
$nodes = $layer->findNodesWithinBBox(-90, 90, -180, 180); | |
echo "<pre>"; | |
var_dump($nodes, $nodes->count()); | |
echo "</pre>"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment