arcserver.rb 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.travis.yml +12 -0
  4. data/Gemfile +7 -0
  5. data/Gemfile.lock +274 -0
  6. data/LICENSE +20 -20
  7. data/README.md +160 -0
  8. data/Rakefile +9 -62
  9. data/arcserver.rb.gemspec +35 -0
  10. data/lib/arcserver.rb +33 -7
  11. data/lib/arcserver/Identifiable.rb +10 -0
  12. data/lib/arcserver/Queryable.rb +10 -0
  13. data/lib/arcserver/feature_server.rb +19 -0
  14. data/lib/arcserver/geometry/geometry.rb +91 -0
  15. data/lib/arcserver/geometry_service.rb +18 -0
  16. data/lib/arcserver/gp_server.rb +20 -0
  17. data/lib/arcserver/graphics/feature.rb +23 -0
  18. data/lib/arcserver/graphics/feature_set.rb +26 -0
  19. data/lib/arcserver/map_server.rb +34 -40
  20. data/lib/arcserver/rest/feature_server.rb +30 -0
  21. data/lib/arcserver/rest/geometry_service.rb +54 -0
  22. data/lib/arcserver/rest/gp_server.rb +80 -0
  23. data/lib/arcserver/rest/identify.rb +66 -0
  24. data/lib/arcserver/rest/map_server.rb +230 -230
  25. data/lib/arcserver/rest/query.rb +68 -0
  26. data/lib/arcserver/url_helper.rb +31 -25
  27. data/lib/arcserver/util/legend_image.rb +0 -0
  28. data/lib/arcserver/version.rb +6 -6
  29. data/spec/custom_spec.rb +50 -0
  30. data/spec/factories/feature.rb +21 -0
  31. data/spec/feature_server_spec.rb +52 -0
  32. data/spec/feature_spec.rb +20 -0
  33. data/spec/geometry_service_spec.rb +31 -0
  34. data/spec/geometry_spec.rb +80 -0
  35. data/spec/gp_server_spec.rb +57 -0
  36. data/spec/identify_spec.rb +21 -0
  37. data/spec/query_spec.rb +38 -0
  38. data/spec/shared_context.rb +17 -0
  39. data/spec/spec_helper.rb +15 -0
  40. metadata +217 -158
  41. data/README.rdoc +0 -57
  42. data/lib/arcserver/soap/map_server.rb +0 -263
  43. data/test/functional/soap/map_server_test.rb +0 -193
  44. data/test/test_helper.rb +0 -25
  45. data/test/unit/map_server_test.rb +0 -61
  46. data/test/unit/url_helper_test.rb +0 -54
  47. data/test/unit/util/legend_image_test.rb +0 -69
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0580a4cf8a670d854075a114b3fcfeb5fccd5870
4
+ data.tar.gz: 0fb023619950781916f907879555b0644a666a0c
5
+ SHA512:
6
+ metadata.gz: 986d032ccc0529bdb992a90668bdfd6abc321fbdfe3a30e7afabf357ccbf1a1d94893c777422b45353f5090a7a38f074bc8114a695dfbe2056667989c3a77b65
7
+ data.tar.gz: ef320fcb0ff7b3d10701ec603d6ba19574dfbbfefd386613d77a97314740b8807b4a4433ddb0703b5ab27cfafa9ccbf4cb85510edfb78c27fd35a0aa3b6d22c6
@@ -0,0 +1,10 @@
1
+ *.sw?
2
+ .DS_Store
3
+ coverage
4
+ rdoc
5
+ doc
6
+ .yardoc
7
+ doc
8
+ pkg
9
+ nbproject
10
+ .idea
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.0
4
+ - 2.0.0
5
+ - 1.9.3
6
+ - jruby-19mode
7
+ - rbx
8
+ - ruby-head
9
+ - jruby-head
10
+ matrix:
11
+ allow_failures:
12
+ - rvm: rbx
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ platforms :rbx do
4
+ gem 'rubysl'
5
+ end
6
+
7
+ gemspec
@@ -0,0 +1,274 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ arcserver.rb (0.1.5)
5
+ activesupport
6
+ httparty
7
+ httpclient
8
+ json
9
+ nokogiri
10
+ rufus-scheduler
11
+
12
+ GEM
13
+ remote: https://rubygems.org/
14
+ specs:
15
+ activesupport (3.2.16)
16
+ i18n (~> 0.6, >= 0.6.4)
17
+ multi_json (~> 1.0)
18
+ atomic (1.1.14)
19
+ atomic (1.1.14-java)
20
+ diff-lcs (1.2.5)
21
+ factory_girl (4.3.0)
22
+ activesupport (>= 3.0.0)
23
+ ffi2-generators (0.1.1)
24
+ httparty (0.12.0)
25
+ json (~> 1.8)
26
+ multi_xml (>= 0.5.2)
27
+ httpclient (2.3.4.1)
28
+ i18n (0.6.9)
29
+ json (1.8.1)
30
+ json (1.8.1-java)
31
+ mini_portile (0.5.2)
32
+ multi_json (1.8.2)
33
+ multi_xml (0.5.5)
34
+ nokogiri (1.6.1)
35
+ mini_portile (~> 0.5.0)
36
+ nokogiri (1.6.1-java)
37
+ mini_portile (~> 0.5.0)
38
+ rake (10.1.0)
39
+ rdoc (3.12.2)
40
+ json (~> 1.4)
41
+ rspec (2.14.1)
42
+ rspec-core (~> 2.14.0)
43
+ rspec-expectations (~> 2.14.0)
44
+ rspec-mocks (~> 2.14.0)
45
+ rspec-core (2.14.7)
46
+ rspec-expectations (2.14.4)
47
+ diff-lcs (>= 1.1.3, < 2.0)
48
+ rspec-mocks (2.14.4)
49
+ rubysl (2.0.15)
50
+ rubysl-abbrev (~> 2.0)
51
+ rubysl-base64 (~> 2.0)
52
+ rubysl-benchmark (~> 2.0)
53
+ rubysl-bigdecimal (~> 2.0)
54
+ rubysl-cgi (~> 2.0)
55
+ rubysl-cgi-session (~> 2.0)
56
+ rubysl-cmath (~> 2.0)
57
+ rubysl-complex (~> 2.0)
58
+ rubysl-continuation (~> 2.0)
59
+ rubysl-coverage (~> 2.0)
60
+ rubysl-csv (~> 2.0)
61
+ rubysl-curses (~> 2.0)
62
+ rubysl-date (~> 2.0)
63
+ rubysl-delegate (~> 2.0)
64
+ rubysl-digest (~> 2.0)
65
+ rubysl-drb (~> 2.0)
66
+ rubysl-e2mmap (~> 2.0)
67
+ rubysl-english (~> 2.0)
68
+ rubysl-enumerator (~> 2.0)
69
+ rubysl-erb (~> 2.0)
70
+ rubysl-etc (~> 2.0)
71
+ rubysl-expect (~> 2.0)
72
+ rubysl-fcntl (~> 2.0)
73
+ rubysl-fiber (~> 2.0)
74
+ rubysl-fileutils (~> 2.0)
75
+ rubysl-find (~> 2.0)
76
+ rubysl-forwardable (~> 2.0)
77
+ rubysl-getoptlong (~> 2.0)
78
+ rubysl-gserver (~> 2.0)
79
+ rubysl-io-console (~> 2.0)
80
+ rubysl-io-nonblock (~> 2.0)
81
+ rubysl-io-wait (~> 2.0)
82
+ rubysl-ipaddr (~> 2.0)
83
+ rubysl-irb (~> 2.0)
84
+ rubysl-logger (~> 2.0)
85
+ rubysl-mathn (~> 2.0)
86
+ rubysl-matrix (~> 2.0)
87
+ rubysl-mkmf (~> 2.0)
88
+ rubysl-monitor (~> 2.0)
89
+ rubysl-mutex_m (~> 2.0)
90
+ rubysl-net-ftp (~> 2.0)
91
+ rubysl-net-http (~> 2.0)
92
+ rubysl-net-imap (~> 2.0)
93
+ rubysl-net-pop (~> 2.0)
94
+ rubysl-net-protocol (~> 2.0)
95
+ rubysl-net-smtp (~> 2.0)
96
+ rubysl-net-telnet (~> 2.0)
97
+ rubysl-nkf (~> 2.0)
98
+ rubysl-observer (~> 2.0)
99
+ rubysl-open-uri (~> 2.0)
100
+ rubysl-open3 (~> 2.0)
101
+ rubysl-openssl (~> 2.0)
102
+ rubysl-optparse (~> 2.0)
103
+ rubysl-ostruct (~> 2.0)
104
+ rubysl-pathname (~> 2.0)
105
+ rubysl-prettyprint (~> 2.0)
106
+ rubysl-prime (~> 2.0)
107
+ rubysl-profile (~> 2.0)
108
+ rubysl-profiler (~> 2.0)
109
+ rubysl-pstore (~> 2.0)
110
+ rubysl-pty (~> 2.0)
111
+ rubysl-rational (~> 2.0)
112
+ rubysl-readline (~> 2.0)
113
+ rubysl-resolv (~> 2.0)
114
+ rubysl-rexml (~> 2.0)
115
+ rubysl-rinda (~> 2.0)
116
+ rubysl-rss (~> 2.0)
117
+ rubysl-scanf (~> 2.0)
118
+ rubysl-securerandom (~> 2.0)
119
+ rubysl-set (~> 2.0)
120
+ rubysl-shellwords (~> 2.0)
121
+ rubysl-singleton (~> 2.0)
122
+ rubysl-socket (~> 2.0)
123
+ rubysl-stringio (~> 2.0)
124
+ rubysl-strscan (~> 2.0)
125
+ rubysl-sync (~> 2.0)
126
+ rubysl-syslog (~> 2.0)
127
+ rubysl-tempfile (~> 2.0)
128
+ rubysl-thread (~> 2.0)
129
+ rubysl-thwait (~> 2.0)
130
+ rubysl-time (~> 2.0)
131
+ rubysl-timeout (~> 2.0)
132
+ rubysl-tmpdir (~> 2.0)
133
+ rubysl-tsort (~> 2.0)
134
+ rubysl-un (~> 2.0)
135
+ rubysl-uri (~> 2.0)
136
+ rubysl-weakref (~> 2.0)
137
+ rubysl-webrick (~> 2.0)
138
+ rubysl-xmlrpc (~> 2.0)
139
+ rubysl-yaml (~> 2.0)
140
+ rubysl-zlib (~> 2.0)
141
+ rubysl-abbrev (2.0.4)
142
+ rubysl-base64 (2.0.0)
143
+ rubysl-benchmark (2.0.1)
144
+ rubysl-bigdecimal (2.0.2)
145
+ rubysl-cgi (2.0.1)
146
+ rubysl-cgi-session (2.0.1)
147
+ rubysl-cmath (2.0.0)
148
+ rubysl-complex (2.0.0)
149
+ rubysl-continuation (2.0.0)
150
+ rubysl-coverage (2.0.3)
151
+ rubysl-csv (2.0.2)
152
+ rubysl-english (~> 2.0)
153
+ rubysl-curses (2.0.1)
154
+ rubysl-date (2.0.6)
155
+ rubysl-delegate (2.0.1)
156
+ rubysl-digest (2.0.3)
157
+ rubysl-drb (2.0.1)
158
+ rubysl-e2mmap (2.0.0)
159
+ rubysl-english (2.0.0)
160
+ rubysl-enumerator (2.0.0)
161
+ rubysl-erb (2.0.1)
162
+ rubysl-etc (2.0.3)
163
+ ffi2-generators (~> 0.1)
164
+ rubysl-expect (2.0.0)
165
+ rubysl-fcntl (2.0.4)
166
+ ffi2-generators (~> 0.1)
167
+ rubysl-fiber (2.0.0)
168
+ rubysl-fileutils (2.0.3)
169
+ rubysl-find (2.0.1)
170
+ rubysl-forwardable (2.0.1)
171
+ rubysl-getoptlong (2.0.0)
172
+ rubysl-gserver (2.0.0)
173
+ rubysl-socket (~> 2.0)
174
+ rubysl-thread (~> 2.0)
175
+ rubysl-io-console (2.0.0)
176
+ rubysl-io-nonblock (2.0.0)
177
+ rubysl-io-wait (2.0.0)
178
+ rubysl-ipaddr (2.0.0)
179
+ rubysl-irb (2.0.4)
180
+ rubysl-e2mmap (~> 2.0)
181
+ rubysl-mathn (~> 2.0)
182
+ rubysl-readline (~> 2.0)
183
+ rubysl-thread (~> 2.0)
184
+ rubysl-logger (2.0.0)
185
+ rubysl-mathn (2.0.0)
186
+ rubysl-matrix (2.1.0)
187
+ rubysl-e2mmap (~> 2.0)
188
+ rubysl-mkmf (2.0.1)
189
+ rubysl-fileutils (~> 2.0)
190
+ rubysl-shellwords (~> 2.0)
191
+ rubysl-monitor (2.0.0)
192
+ rubysl-mutex_m (2.0.0)
193
+ rubysl-net-ftp (2.0.1)
194
+ rubysl-net-http (2.0.4)
195
+ rubysl-cgi (~> 2.0)
196
+ rubysl-erb (~> 2.0)
197
+ rubysl-singleton (~> 2.0)
198
+ rubysl-net-imap (2.0.1)
199
+ rubysl-net-pop (2.0.1)
200
+ rubysl-net-protocol (2.0.1)
201
+ rubysl-net-smtp (2.0.1)
202
+ rubysl-net-telnet (2.0.0)
203
+ rubysl-nkf (2.0.1)
204
+ rubysl-observer (2.0.0)
205
+ rubysl-open-uri (2.0.0)
206
+ rubysl-open3 (2.0.0)
207
+ rubysl-openssl (2.1.0)
208
+ rubysl-optparse (2.0.1)
209
+ rubysl-shellwords (~> 2.0)
210
+ rubysl-ostruct (2.0.4)
211
+ rubysl-pathname (2.0.0)
212
+ rubysl-prettyprint (2.0.2)
213
+ rubysl-prime (2.0.1)
214
+ rubysl-profile (2.0.0)
215
+ rubysl-profiler (2.0.1)
216
+ rubysl-pstore (2.0.0)
217
+ rubysl-pty (2.0.2)
218
+ rubysl-rational (2.0.1)
219
+ rubysl-readline (2.0.2)
220
+ rubysl-resolv (2.1.0)
221
+ rubysl-rexml (2.0.2)
222
+ rubysl-rinda (2.0.1)
223
+ rubysl-rss (2.0.0)
224
+ rubysl-scanf (2.0.0)
225
+ rubysl-securerandom (2.0.0)
226
+ rubysl-set (2.0.1)
227
+ rubysl-shellwords (2.0.0)
228
+ rubysl-singleton (2.0.0)
229
+ rubysl-socket (2.0.1)
230
+ rubysl-stringio (2.0.0)
231
+ rubysl-strscan (2.0.0)
232
+ rubysl-sync (2.0.0)
233
+ rubysl-syslog (2.0.1)
234
+ ffi2-generators (~> 0.1)
235
+ rubysl-tempfile (2.0.1)
236
+ rubysl-thread (2.0.2)
237
+ rubysl-thwait (2.0.0)
238
+ rubysl-time (2.0.3)
239
+ rubysl-timeout (2.0.0)
240
+ rubysl-tmpdir (2.0.0)
241
+ rubysl-tsort (2.0.1)
242
+ rubysl-un (2.0.0)
243
+ rubysl-fileutils (~> 2.0)
244
+ rubysl-optparse (~> 2.0)
245
+ rubysl-uri (2.0.0)
246
+ rubysl-weakref (2.0.0)
247
+ rubysl-webrick (2.0.0)
248
+ rubysl-xmlrpc (2.0.0)
249
+ rubysl-yaml (2.0.4)
250
+ rubysl-zlib (2.0.1)
251
+ rufus-scheduler (3.0.3)
252
+ tzinfo
253
+ sdoc (0.3.20)
254
+ json (>= 1.1.3)
255
+ rdoc (~> 3.10)
256
+ thread_safe (0.1.3)
257
+ atomic
258
+ thread_safe (0.1.3-java)
259
+ atomic
260
+ tzinfo (1.1.0)
261
+ thread_safe (~> 0.1)
262
+
263
+ PLATFORMS
264
+ java
265
+ ruby
266
+
267
+ DEPENDENCIES
268
+ arcserver.rb!
269
+ bundler
270
+ factory_girl
271
+ rake
272
+ rspec
273
+ rubysl
274
+ sdoc
data/LICENSE CHANGED
@@ -1,20 +1,20 @@
1
- Copyright (c) 2009 Colin Casey
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ Copyright (c) 2009 Colin Casey
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,160 @@
1
+ # Arcserver.rb
2
+
3
+ Arcserver.rb is an interface for interacting with ESRI ArcGIS Server REST APIs from Ruby.
4
+
5
+ [ArcGIS rest specification](http://www.esri.com/library/whitepapers/pdfs/geoservices-rest-spec.pdf)
6
+
7
+
8
+ [![Build Status](https://travis-ci.org/lukefx/arcserver.rb.png?branch=master)](https://travis-ci.org/lukefx/arcserver.rb)
9
+ [![Code Climate](https://codeclimate.com/github/lukefx/arcserver.rb.png)](https://codeclimate.com/github/lukefx/arcserver.rb)
10
+
11
+ ## Installation
12
+
13
+ [sudo] gem install arcserver.rb
14
+
15
+ If you want to use it in with Bundler add to your Gemfile
16
+
17
+ gem 'arcserver.rb', '~> 0.1.5'
18
+
19
+ ## Quick Example
20
+
21
+ ```ruby
22
+ require 'arcserver'
23
+ ```
24
+
25
+ Connect to a map server instance using either its REST url
26
+
27
+ ```ruby
28
+ map_server = ArcServer::MapServer.new('http://sampleserver1.arcgisonline.com/ArcGIS/services/Portland/ESRI_LandBase_WebMercator/MapServer')
29
+ ```
30
+
31
+ and export an image
32
+
33
+ ```ruby
34
+ puts map_server.export
35
+ ```
36
+
37
+ Query for retreive some features, the result will be a FeatureSet, which is a wrapper for the layer information and the features found
38
+
39
+ ```ruby
40
+ query = ArcServer::REST::Query.new({ where: "district='4'", outFields: "*" })
41
+ feature_set = query.execute('0', "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer")
42
+
43
+ puts feature_set.features
44
+ ```
45
+
46
+ Or directly within a MapServer or FeatureServer and his Layer number
47
+
48
+ ```ruby
49
+ feature_server = ArcServer::FeatureServer.new("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer")
50
+ feature_set = feature_server.query('0', { where: "district='Lugano'", outFields: "*" })
51
+ ```
52
+
53
+ Query is possible in different ways, like through geometry
54
+
55
+ ```ruby
56
+ feature_server = ArcServer::FeatureServer.new("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer")
57
+ feature_set = feature_server.query('0', { geometryType: 'esriGeometryEnvelope', geometry: '{"xmin":997878.8354556253,"ymin":5783588.635939264,"xmax":998147.5593831083,"ymax":5783767.785224252,"spatialReference":{"wkid":102100}}', outFields: "*", inSR: 102100, outSR: 102100 })
58
+
59
+ puts feature_set.features
60
+ ```
61
+
62
+ An Identify operation is a query but applied to all layers in the MapServer
63
+
64
+ ```ruby
65
+ map_server = ArcServer::MapServer.new("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer")
66
+ results = map_server.identify({ geometryType: "esriGeometryPoint", geometry: "-120,40", tolerance: "10", mapExtent: "-119,38,-121,41", imageDisplay: "400,300,96" })
67
+
68
+ puts results # each results has its own feature and metadata
69
+ ```
70
+
71
+ A feature is a simple class with Geometry and attributes, create one is easy
72
+
73
+ ```ruby
74
+ f = ArcServer::Graphics::Feature.new({ geometry: { x: 997986.5006082746, y: 5783631.06234916, spatialReference: { wkid: 102100 }}, attributes: {status:1,req_id:"12345",req_type:"Graffiti Complaint – Private Property",req_date:"30.09.2013",req_time:"14:00",address:"via dei matti 0",district:"4"} })
75
+ ```
76
+
77
+ Once you have a feature, it's ready to be saved on a feature layer
78
+
79
+ ```ruby
80
+ fs = ArcServer::FeatureServer.new("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer")
81
+ results = fs.applyEdits('0', [ f ], [], []) # adds, updates, deletes
82
+ ```
83
+
84
+ You can simply edit a feature if you have an objectId, maybe retrieved with a Query
85
+
86
+ ```ruby
87
+ f = ArcServer::Graphics::Feature.new({ attributes: { objectId: 12345, address: "via dei matti 0", district: "4"} })
88
+ results = fs.applyEdits('0', [], [ f ], []) # adds, updates, deletes
89
+ ```
90
+
91
+ And if you want to delete some features?
92
+
93
+ ```ruby
94
+ feature_server = ArcServer::FeatureServer.new("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer")
95
+ feature_set = feature_server.query('0', { geometryType: 'esriGeometryEnvelope', geometry: '{"xmin":997878.8354556253,"ymin":5783588.635939264,"xmax":998147.5593831083,"ymax":5783767.785224252,"spatialReference":{"wkid":102100}}', outFields: "*", inSR: 102100, outSR: 102100 })
96
+ # we have to create an array of ids like this: '80012, 93002'
97
+ deletes = feature_set.features.map { |f| f.attributes[:objectid] }.join(',')
98
+ results = feature_server.applyEdits('0', [], [], deletes)
99
+ ```
100
+
101
+ ## GeoProcessing Tool
102
+
103
+ Geoprocessing is a fundamental part of enterprise GIS operations. Geoprocessing provides the data analysis, data management, and data conversion tools necessary for all GIS users.
104
+
105
+ The ArcGIS Server supports two types of GPServer: Sync and Async.
106
+
107
+ The message in a bottle example, sync
108
+
109
+ ```ruby
110
+ gp = ArcServer::GPServer.new("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_Currents_World/GPServer/MessageInABottle")
111
+
112
+ feature = ArcServer::Graphics::Feature.new({ geometry: ArcServer::Geometry::Point.new({ x: -76.2890625, y: 35.859375, spatialReference: { wkid: 4326 } }) })
113
+
114
+ feature_set = ArcServer::Graphics::FeatureSet.new({ features: [ feature ] })
115
+
116
+ params = { Input_Point: feature_set.to_json, Days: 1 }
117
+ results = gp.execute(params)
118
+
119
+ puts results # => {"paramName"=>"Output", "dataType"=>"GPFeatureRecordSetLayer", "value"=>{"geometryType"=>"esriGeometryPolyline", "spatialReference"=>{"wkid"=>4326}, "features"=>[{"attributes"=>{"FID"=>1, "FNODE_"=>0, "Shape_Length"=>0.19891537566450523}, "geometry"=>{"paths"=>[[[-76.2890625, 35.859375], [-76.09141540527344, 35.88180160522461]]]}}], "exceededTransferLimit"=>false}}
120
+ ```
121
+
122
+ Example for async service:
123
+
124
+ ```ruby
125
+ gp = ArcServer::GPServer.new("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task")
126
+
127
+ params = { Web_Map_as_JSON: '{ ... super long map in json ... }', Format: 'JPG', Layout_Template: 'MAP_ONLY' }
128
+ gp.submitJob(params) do |results|
129
+ puts results['Output_File']['url'] # => http://sampleserver6.arcgisonline.com ... /map.jpg
130
+ end
131
+ ```
132
+
133
+ ## Contributors
134
+
135
+ This is a fork of arcserver.rb originally written by:
136
+
137
+ * Colin Casey
138
+ * Glenn Goodrich
139
+
140
+ ## Contribute
141
+
142
+ If you'd like to hack on arcserver.rb, start by forking my repo on GitHub:
143
+
144
+ http://github.com/lukefx/arcserver.rb
145
+
146
+ To get all of the dependencies, install the gem first. The best way to get your changes merged back into core is as follows:
147
+
148
+ 1. Clone your fork
149
+ 2. Create a thoughtfully named topic branch to contain your change
150
+ 3. Hack away
151
+ 4. Add tests and make sure everything still passes by running rake
152
+ 5. If you are adding new functionality, document it in the README
153
+ 6. Do not change the version number, I will do that on my end
154
+ 7. If necessary, rebase your commits into logical chunks, without errors
155
+ 8. Push the branch up to GitHub
156
+ 9. Send me a pull request for your branch
157
+
158
+ ## Copyright
159
+
160
+ Copyright (c) 2010 Colin Casey. See LICENSE for details.