module Neography::Rest::Spatial
Public Instance Methods
add_editable_layer(layer, format = "WKT", node_property_name = "wkt")
click to toggle source
# File lib/neography/rest/spatial.rb, line 23 def add_editable_layer(layer, format = "WKT", node_property_name = "wkt") options = { :body => { :layer => layer, :format => format, :nodePropertyName => node_property_name }.to_json, :headers => json_content_type.merge({'Accept' => 'application/json;charset=UTF-8'}) } @connection.post("/ext/SpatialPlugin/graphdb/addEditableLayer", options) end
add_geometry_to_layer(layer, geometry)
click to toggle source
# File lib/neography/rest/spatial.rb, line 46 def add_geometry_to_layer(layer, geometry) options = { :body => { :layer => layer, :geometry => geometry }.to_json, :headers => json_content_type.merge({'Accept' => 'application/json;charset=UTF-8'}) } @connection.post("/ext/SpatialPlugin/graphdb/addGeometryWKTToLayer", options) end
add_node_to_layer(layer, node)
click to toggle source
# File lib/neography/rest/spatial.rb, line 69 def add_node_to_layer(layer, node) options = { :body => { :layer => layer, :node => get_id(node) }.to_json, :headers => json_content_type.merge({'Accept' => 'application/json;charset=UTF-8'}) } @connection.post("/ext/SpatialPlugin/graphdb/addNodeToLayer", options) end
add_node_to_spatial_index(index, id)
click to toggle source
# File lib/neography/rest/spatial.rb, line 123 def add_node_to_spatial_index(index, id) options = { :body => { :uri => @connection.configuration + "/node/#{get_id(id)}", :key => "k", :value => "v" }.to_json, :headers => json_content_type.merge({'Accept' => 'application/json;charset=UTF-8'}) } @connection.post("/index/node/%{index}" % {:index => index}, options) end
add_point_layer(layer, lat = nil, lon = nil)
click to toggle source
# File lib/neography/rest/spatial.rb, line 10 def add_point_layer(layer, lat = nil, lon = nil) options = { :body => { :layer => layer, :lat => lat || "lat", :lon => lon || "lon" }.to_json, :headers => json_content_type.merge({'Accept' => 'application/json;charset=UTF-8'}) } @connection.post("/ext/SpatialPlugin/graphdb/addSimplePointLayer", options) end
create_spatial_index(name, type = nil, lat = nil, lon = nil)
click to toggle source
# File lib/neography/rest/spatial.rb, line 107 def create_spatial_index(name, type = nil, lat = nil, lon = nil) options = { :body => { :name => name, :config => { :provider => "spatial", :geometry_type => type || "point", :lat => lat || "lat", :lon => lon || "lon" } }.to_json, :headers => json_content_type.merge({'Accept' => 'application/json;charset=UTF-8'}) } @connection.post("/index/node", options) end
edit_geometry_from_layer(layer, geometry, node)
click to toggle source
# File lib/neography/rest/spatial.rb, line 57 def edit_geometry_from_layer(layer, geometry, node) options = { :body => { :layer => layer, :geometry => geometry, :geometryNodeId => get_id(node) }.to_json, :headers => json_content_type.merge({'Accept' => 'application/json;charset=UTF-8'}) } @connection.post("/ext/SpatialPlugin/graphdb/updateGeometryFromWKT", options) end
find_geometries_in_bbox(layer, minx, maxx, miny, maxy)
click to toggle source
# File lib/neography/rest/spatial.rb, line 80 def find_geometries_in_bbox(layer, minx, maxx, miny, maxy) options = { :body => { :layer => layer, :minx => minx, :maxx => maxx, :miny => miny, :maxy => maxy }.to_json, :headers => json_content_type.merge({'Accept' => 'application/json;charset=UTF-8'}) } @connection.post("/ext/SpatialPlugin/graphdb/findGeometriesInBBox", options) end
find_geometries_within_distance(layer, pointx, pointy, distance)
click to toggle source
# File lib/neography/rest/spatial.rb, line 94 def find_geometries_within_distance(layer, pointx, pointy, distance) options = { :body => { :layer => layer, :pointX => pointx, :pointY => pointy, :distanceInKm => distance }.to_json, :headers => json_content_type.merge({'Accept' => 'application/json;charset=UTF-8'}) } @connection.post("/ext/SpatialPlugin/graphdb/findGeometriesWithinDistance", options) end
get_layer(layer)
click to toggle source
# File lib/neography/rest/spatial.rb, line 36 def get_layer(layer) options = { :body => { :layer => layer }.to_json, :headers => json_content_type.merge({'Accept' => 'application/json;charset=UTF-8'}) } @connection.post("/ext/SpatialPlugin/graphdb/getLayer", options) end
get_spatial()
click to toggle source
# File lib/neography/rest/spatial.rb, line 6 def get_spatial @connection.get("/ext/SpatialPlugin") end