Module: Neography::Rest::Spatial
Instance Method Summary
collapse
-
#add_editable_layer(layer, format = "WKT", node_property_name = "wkt") ⇒ Object
-
#add_geometry_to_layer(layer, geometry) ⇒ Object
-
#add_node_to_layer(layer, node) ⇒ Object
-
#add_node_to_spatial_index(index, id) ⇒ Object
-
#add_point_layer(layer, lat = nil, lon = nil) ⇒ Object
-
#create_spatial_index(name, type = nil, lat = nil, lon = nil) ⇒ Object
-
#edit_geometry_from_layer(layer, geometry, node) ⇒ Object
-
#find_geometries_in_bbox(layer, minx, maxx, miny, maxy) ⇒ Object
-
#find_geometries_within_distance(layer, pointx, pointy, distance) ⇒ Object
-
#get_layer(layer) ⇒ Object
-
#get_spatial ⇒ Object
Methods included from Helpers
#encode, #escape, #get_id, #json_content_type, #parse_depth, #parse_direction, #parse_order, #parse_type, #parse_uniqueness
Instance Method Details
#add_editable_layer(layer, format = "WKT", node_property_name = "wkt") ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
|
# 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) ⇒ Object
46
47
48
49
50
51
52
53
54
55
|
# 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) ⇒ Object
69
70
71
72
73
74
75
76
77
78
|
# 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) ⇒ Object
123
124
125
126
127
128
129
130
131
132
133
|
# 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) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
|
# 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) ⇒ Object
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
# 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) ⇒ Object
57
58
59
60
61
62
63
64
65
66
67
|
# 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) ⇒ Object
80
81
82
83
84
85
86
87
88
89
90
91
92
|
# 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) ⇒ Object
94
95
96
97
98
99
100
101
102
103
104
105
|
# 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) ⇒ Object
36
37
38
39
40
41
42
43
44
|
# 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 ⇒ Object
6
7
8
|
# File 'lib/neography/rest/spatial.rb', line 6
def get_spatial
@connection.get("/ext/SpatialPlugin")
end
|