rgeoserver 0.5.9 → 0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -1
- data/Gemfile +1 -7
- data/Gemfile.lock +147 -0
- data/README.rdoc +69 -78
- data/Rakefile +2 -1
- data/VERSION +1 -1
- data/bin/batch_load.rb +138 -0
- data/config/defaults.yml +17 -0
- data/examples/batch_demo.rb +170 -0
- data/examples/catalog_migration.rb +2 -2
- data/examples/cluster_demo.rb +1 -1
- data/examples/coverage_stores.rb +42 -0
- data/examples/demo_druid_workspace.rb +6 -0
- data/examples/deploy_dor_layer.rb +19 -0
- data/examples/sql_layer_demo.rb +1 -1
- data/lib/rgeoserver/catalog.rb +83 -86
- data/lib/rgeoserver/config.rb +11 -1
- data/lib/rgeoserver/coverage.rb +43 -15
- data/lib/rgeoserver/coveragestore.rb +46 -11
- data/lib/rgeoserver/datastore.rb +73 -62
- data/lib/rgeoserver/featuretype.rb +134 -71
- data/lib/rgeoserver/geoserver_url_helpers.rb +140 -10
- data/lib/rgeoserver/layer.rb +52 -16
- data/lib/rgeoserver/layergroup.rb +1 -2
- data/lib/rgeoserver/namespace.rb +1 -2
- data/lib/rgeoserver/resource.rb +37 -34
- data/lib/rgeoserver/rest_api_client.rb +33 -14
- data/lib/rgeoserver/style.rb +1 -2
- data/lib/rgeoserver/utils/boundingbox.rb +59 -16
- data/lib/rgeoserver/utils/metadata.rb +21 -0
- data/lib/rgeoserver/version.rb +1 -1
- data/lib/rgeoserver/wmsstore.rb +1 -6
- data/lib/rgeoserver/workspace.rb +23 -8
- data/lib/rgeoserver.rb +31 -38
- data/rgeoserver.gemspec +28 -20
- data/spec/fixtures/load_ex1.yml +45 -0
- data/spec/fixtures/load_ex2.yml +14 -0
- data/spec/functional/catalog_spec.rb +71 -0
- data/spec/functional/rest_api_client_spec.rb +215 -0
- data/spec/integration/geoserver_spec.rb +2 -2
- metadata +120 -66
- data/config/config_defaults.yml +0 -10
- data/examples/batch_example.rb +0 -105
@@ -0,0 +1,45 @@
|
|
1
|
+
example_vector:
|
2
|
+
layername: "Precincts_Jan262012_5"
|
3
|
+
filename: "branner/Precincts_Jan262012_5/Precincts_Jan262012_5.shp"
|
4
|
+
format: "Shapefile"
|
5
|
+
title: "US Precincts, 2008"
|
6
|
+
description: "This is a dataset developed by Prof. Jonathan Rodden at Stanford University showing precinct polygon data for the United States for the year 2008."
|
7
|
+
keywords: ["vector", "precinct", "political", "US", "voting", "2008", "elections", {
|
8
|
+
keyword: "California", language: en, vocabulary: "ISOTC211/19115:place"}]
|
9
|
+
metadata_links: [{
|
10
|
+
metadataType: TC211,
|
11
|
+
content: "http://purl.stanford.edu/catalog/aa111aa1111/iso19139.xml"}]
|
12
|
+
metadata:
|
13
|
+
druid: aa111aa1111
|
14
|
+
publisher: "Jonathan Rodden, Stanford University"
|
15
|
+
|
16
|
+
# This shapefile has ESPG:3313? which isn't included in the default GeoServer configuration
|
17
|
+
example_vector_broken_projection:
|
18
|
+
layername: urban2050_ca
|
19
|
+
filename: branner/urban2050_ca/urban2050_ca.shp
|
20
|
+
format: Shapefile
|
21
|
+
title: "Projected Urban Growth scenarios for 2050"
|
22
|
+
description: "By 2020, most forecasters agree, California will be home to between 43 and 46 million residents-up from 35 million today. Beyond 2020 the size of Californias population is less certain."
|
23
|
+
keywords: ["vector", "urban", "landis", {
|
24
|
+
keyword: "California", language: en, vocabulary: "ISOTC211/19115:place"}]
|
25
|
+
metadata_links: [{
|
26
|
+
metadataType: TC211,
|
27
|
+
content: "http://purl.stanford.edu/catalog/aa111aa1111/iso19139.xml"}]
|
28
|
+
metadata:
|
29
|
+
druid: aa111aa1111
|
30
|
+
publisher: Landis
|
31
|
+
|
32
|
+
example_raster:
|
33
|
+
layername: antietam_1867
|
34
|
+
filename: rumsey/g3881015alpha.tif
|
35
|
+
format: GeoTIFF
|
36
|
+
title: "U.S. Civil War battle of Antietam, 1867"
|
37
|
+
description: "Map shows the U.S. Civil War battle of Antietam. It indicates fortifications, roads, railroads, houses, names of residents, fences, drainage, vegetation, and relief by hachures."
|
38
|
+
keywords: ["civil war", "battles"]
|
39
|
+
metadata_links: [{
|
40
|
+
metadataType: TC211,
|
41
|
+
content: "http://purl.stanford.edu/catalog/bb222bb2222/iso19139.xml"}]
|
42
|
+
metadata:
|
43
|
+
druid: bb222bb2222
|
44
|
+
publisher: Unknown
|
45
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
example_vector:
|
2
|
+
layername: "bdelta_clip_veg"
|
3
|
+
filename: "branner/bdelta_clip_veg/bdelta_clip_veg.shp"
|
4
|
+
format: "Shapefile"
|
5
|
+
title: "Land cover, 2002 Forest and Range Assessment"
|
6
|
+
description: "CDF-FRAP compiled the 'best available' land cover data into a single data layer, to support the various analyses required for the 2002 Forest and Range Assessment. Typically the most current and detailed data were collected for various regions of the state or for unique mapping efforts (farmland, wetlands, riparian vegetation). Decision rules were developed that controlled which layers were given priority in areas of overlap. Cross-walks were used to compile the various sources into the common California Wildlife Wabitat Relationships (CWHR) system classification. Data sources had unique scale/resolution, multi-source data provided as 100m GRID. The original 1/2002 data used to support the Asessment is also available from the FRAP site - this record corresponds to the most recent updated version of the data (10/2002), which incorporates better data for the Mojave & NE Colorado Desert areas."
|
7
|
+
keywords: ["vector", "landcover", "bay area", "farmland", "wetlands", "riparian vegetation", {
|
8
|
+
keyword: "California", language: en, vocabulary: "ISOTC211/19115:place"}]
|
9
|
+
metadata_links: [{
|
10
|
+
metadataType: TC211,
|
11
|
+
content: "http://purl.stanford.edu/catalog/cc111cc1111/iso19139.xml"}]
|
12
|
+
metadata:
|
13
|
+
druid: cc111cc1111
|
14
|
+
publisher: "California Environmental Resource Evaluation System"
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'awesome_print'
|
3
|
+
|
4
|
+
describe RGeoServer::GeoServerUrlHelpers do
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
@c = RGeoServer::Catalog.new
|
8
|
+
@w = @c.get_workspace 'druid'
|
9
|
+
@w_default = @c.get_default_workspace
|
10
|
+
ap({ :catalog => @c, :workspace_druid => @w, :workspace_default => @w_default }) if $DEBUG
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "Init" do
|
14
|
+
it "catalog" do
|
15
|
+
@c.config.include?(:url).should == true
|
16
|
+
@c.headers.include?(:content_type).should == true
|
17
|
+
end
|
18
|
+
|
19
|
+
it "workspace" do
|
20
|
+
@w.name.should == 'druid'
|
21
|
+
@w_default.name.should == @w.name
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "#url_for" do
|
26
|
+
it "simple" do
|
27
|
+
@c.respond_to?('url_for').should == true
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe "Workspace" do
|
32
|
+
it "#get_workspaces as array" do
|
33
|
+
@w_all = @c.get_workspaces
|
34
|
+
@w_all.size.should > 0
|
35
|
+
end
|
36
|
+
|
37
|
+
it "#get_workspaces as block" do
|
38
|
+
@c.get_workspaces do |w|
|
39
|
+
w.name.length.should > 0
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "Layers" do
|
45
|
+
it "#get_layers" do
|
46
|
+
@c.get_layers.size.should > 0
|
47
|
+
@c.get_layers.each do |l|
|
48
|
+
# ap l.resource
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe "DataStore" do
|
54
|
+
it "#get_data_stores" do
|
55
|
+
@c.get_data_stores.size.should > 0
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe "CoverageStore" do
|
60
|
+
it "#get_coverage_stores" do
|
61
|
+
@c.get_coverage_stores.size.should > 0
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe "WMSStore" do
|
66
|
+
it "#get_wms_stores" do
|
67
|
+
@c.get_wms_stores.size.should > 0
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
@@ -0,0 +1,215 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'awesome_print'
|
3
|
+
|
4
|
+
describe RGeoServer::RestApiClient do
|
5
|
+
before(:each) do
|
6
|
+
@client = RGeoServer::Catalog.new
|
7
|
+
end
|
8
|
+
|
9
|
+
describe "REST API sequences" do
|
10
|
+
|
11
|
+
describe "basic" do
|
12
|
+
it "main" do
|
13
|
+
RGeoServer::RestApiClient::URI_SEQUENCES.each do |seq|
|
14
|
+
if not [[:about], [:layers, :styles]].include? seq
|
15
|
+
@client.url_for(Hash[seq.map {|k| [k, 'abc']}]).is_a?(String).should == true
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
it "exceptions" do
|
21
|
+
expect {
|
22
|
+
@client.url_for(:abc => "abc")
|
23
|
+
}.to raise_error ArgumentError
|
24
|
+
expect {
|
25
|
+
@client.url_for(:workspaces => nil, :format => "xyz")
|
26
|
+
}.to raise_error ArgumentError
|
27
|
+
|
28
|
+
RGeoServer::RestApiClient::URI_SEQUENCES.each do |seq|
|
29
|
+
if seq.size > 1
|
30
|
+
expect {
|
31
|
+
@client.url_for(Hash[seq.map {|k| [k, nil]}])
|
32
|
+
}.to raise_error ArgumentError
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
it "formats" do
|
39
|
+
@client.url_for(:workspaces => nil).should == "workspaces.xml"
|
40
|
+
@client.url_for('workspaces', {:format => :xml}).should == "workspaces.xml"
|
41
|
+
@client.url_for('workspaces', {:format => :html}).should == "workspaces.html"
|
42
|
+
@client.url_for('workspaces', {:format => :json}).should == "workspaces.json"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
describe "workspaces" do
|
48
|
+
it "main" do
|
49
|
+
@client.url_for(:workspaces => nil).should == "workspaces.xml"
|
50
|
+
@client.url_for(:workspaces => "druid").should == "workspaces/druid.xml"
|
51
|
+
@client.url_for(:workspaces => "default").should == "workspaces/default.xml"
|
52
|
+
end
|
53
|
+
|
54
|
+
it "exceptions" do
|
55
|
+
true.should == true
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe "datastores" do
|
60
|
+
it "main" do
|
61
|
+
what = {:workspaces => "druid", :datastores => nil}
|
62
|
+
base = "workspaces/druid/datastores"
|
63
|
+
@client.url_for(what).should == base + ".xml"
|
64
|
+
what[:datastores] = "abc"
|
65
|
+
@client.url_for(what).should == base + "/abc.xml"
|
66
|
+
@client.url_for(what.merge({:file => nil})).should == base + "/abc/file.xml"
|
67
|
+
@client.url_for(what.merge({:external => nil})).should == base + "/abc/external.xml"
|
68
|
+
@client.url_for(what.merge({:url => nil})).should == base + "/abc/url.xml"
|
69
|
+
end
|
70
|
+
|
71
|
+
it "exceptions" do
|
72
|
+
expect {
|
73
|
+
@client.url_for(:datastores => nil)
|
74
|
+
}.to raise_error ArgumentError
|
75
|
+
expect {
|
76
|
+
@client.url_for(:datastores => "abc")
|
77
|
+
}.to raise_error ArgumentError
|
78
|
+
expect {
|
79
|
+
@client.url_for(:workspaces => nil, :datastores => "abc")
|
80
|
+
}.to raise_error ArgumentError
|
81
|
+
expect {
|
82
|
+
@client.url_for(:workspaces => nil, :datastores => "abc", :file => 'abc')
|
83
|
+
}.to raise_error ArgumentError
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
describe "featuretypes" do
|
88
|
+
it "main" do
|
89
|
+
what = {:workspaces => "druid", :datastores => "abc", :featuretypes => nil}
|
90
|
+
base = "workspaces/druid/datastores/abc/featuretypes"
|
91
|
+
@client.url_for(what).should == base + ".xml"
|
92
|
+
what[:featuretypes] = "xyz"
|
93
|
+
@client.url_for(what).should == base + "/xyz.xml"
|
94
|
+
end
|
95
|
+
|
96
|
+
it "exceptions" do
|
97
|
+
expect {
|
98
|
+
@client.url_for(:featuretypes => 'abc')
|
99
|
+
}.to raise_error ArgumentError
|
100
|
+
expect {
|
101
|
+
@client.url_for(:workspaces => nil, :featuretypes => 'abc')
|
102
|
+
}.to raise_error ArgumentError
|
103
|
+
expect {
|
104
|
+
@client.url_for(:datastores => nil, :featuretypes => 'abc')
|
105
|
+
}.to raise_error ArgumentError
|
106
|
+
expect {
|
107
|
+
@client.url_for(:workspaces => nil, :datastores => nil, :featuretypes => 'abc')
|
108
|
+
}.to raise_error ArgumentError
|
109
|
+
expect {
|
110
|
+
@client.url_for(:workspaces => 'abc', :datastores => nil, :featuretypes => 'abc')
|
111
|
+
}.to raise_error ArgumentError
|
112
|
+
expect {
|
113
|
+
@client.url_for(:workspaces => nil, :datastores => "abc", :featuretypes => 'abc')
|
114
|
+
}.to raise_error ArgumentError
|
115
|
+
end
|
116
|
+
|
117
|
+
end
|
118
|
+
|
119
|
+
describe "layers" do
|
120
|
+
it "main" do
|
121
|
+
@client.url_for(:layers => nil).should == "layers.xml"
|
122
|
+
@client.url_for(:layers => "abc").should == "layers/abc.xml"
|
123
|
+
@client.url_for(:layers => "abc", :styles => nil).should == "layers/abc/styles.xml"
|
124
|
+
end
|
125
|
+
|
126
|
+
it "exceptions" do
|
127
|
+
expect {
|
128
|
+
@client.url_for(:layers => "abc", :styles => 'xyz')
|
129
|
+
}.to raise_error ArgumentError
|
130
|
+
expect {
|
131
|
+
@client.url_for(:workspaces => "druid", :layers => "abc")
|
132
|
+
}.to raise_error ArgumentError
|
133
|
+
expect {
|
134
|
+
@client.url_for(:workspaces => nil, :layers => "abc")
|
135
|
+
}.to raise_error ArgumentError
|
136
|
+
expect {
|
137
|
+
@client.url_for(:workspaces => "druid", :layers => "abc")
|
138
|
+
}.to raise_error ArgumentError
|
139
|
+
end
|
140
|
+
|
141
|
+
end
|
142
|
+
|
143
|
+
describe "layergroups" do
|
144
|
+
it "main" do
|
145
|
+
base = "layergroups"
|
146
|
+
@client.url_for({:layergroups => nil}).should == base + ".xml"
|
147
|
+
@client.url_for({:layergroups => "abc"}).should == base + "/abc.xml"
|
148
|
+
end
|
149
|
+
|
150
|
+
it "workspace" do
|
151
|
+
what = {:workspaces => "druid", :layergroups => nil}
|
152
|
+
base = "workspaces/druid/layergroups"
|
153
|
+
@client.url_for(what).should == base + ".xml"
|
154
|
+
what[:layergroups] = "abc"
|
155
|
+
@client.url_for(what).should == base + "/abc.xml"
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
describe "namespaces" do
|
160
|
+
it "main" do
|
161
|
+
@client.url_for(:namespaces => nil).should == "namespaces.xml"
|
162
|
+
@client.url_for(:namespaces => "abc").should == "namespaces/abc.xml"
|
163
|
+
@client.url_for(:namespaces => "default").should == "namespaces/default.xml"
|
164
|
+
end
|
165
|
+
|
166
|
+
end
|
167
|
+
|
168
|
+
describe "coverages" do
|
169
|
+
it "main" do
|
170
|
+
what = {:workspaces => "druid", :coveragestores => "abc", :coverages => nil}
|
171
|
+
base = "workspaces/druid/coveragestores/abc/coverages"
|
172
|
+
@client.url_for(what).should == base + ".xml"
|
173
|
+
what[:coverages] = "xyz"
|
174
|
+
@client.url_for(what).should == base + "/xyz.xml"
|
175
|
+
end
|
176
|
+
|
177
|
+
it "exceptions" do
|
178
|
+
expect {
|
179
|
+
@client.url_for(:coverages => nil)
|
180
|
+
}.to raise_error ArgumentError
|
181
|
+
expect {
|
182
|
+
@client.url_for(:workspaces => "druid", :coverages => nil)
|
183
|
+
}.to raise_error ArgumentError
|
184
|
+
expect {
|
185
|
+
@client.url_for(:workspaces => "druid", :coverages => "abc")
|
186
|
+
}.to raise_error ArgumentError
|
187
|
+
expect {
|
188
|
+
@client.url_for(:workspaces => "druid", :coveragestores => nil, :coverages => "abc")
|
189
|
+
}.to raise_error ArgumentError
|
190
|
+
end
|
191
|
+
|
192
|
+
end
|
193
|
+
|
194
|
+
describe "about" do
|
195
|
+
it "main" do
|
196
|
+
@client.url_for(:about => :version).should == "about/version.xml"
|
197
|
+
@client.url_for(:about => :manifest).should == "about/manifest.xml"
|
198
|
+
end
|
199
|
+
|
200
|
+
it "exceptions" do
|
201
|
+
expect {
|
202
|
+
@client.url_for(:about => nil)
|
203
|
+
}.to raise_error ArgumentError
|
204
|
+
expect {
|
205
|
+
@client.url_for(:about => 'abc')
|
206
|
+
}.to raise_error ArgumentError
|
207
|
+
expect {
|
208
|
+
@client.url_for(:about => 'version')
|
209
|
+
}.to raise_error ArgumentError
|
210
|
+
end
|
211
|
+
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
end
|
@@ -260,7 +260,7 @@ describe "Integration test against a GeoServer instance", :integration => true d
|
|
260
260
|
:srs => {:number => 4326 },
|
261
261
|
:zoomStart => 1,
|
262
262
|
:zoomStop => 12,
|
263
|
-
:
|
263
|
+
:tileFormat => 'image/png',
|
264
264
|
:threadCount => 1
|
265
265
|
}
|
266
266
|
lyr.seed :issue, options
|
@@ -273,7 +273,7 @@ describe "Integration test against a GeoServer instance", :integration => true d
|
|
273
273
|
:srs => {:number => 4326 },
|
274
274
|
:zoomStart => 0,
|
275
275
|
:zoomStop => 2,
|
276
|
-
:
|
276
|
+
:tileFormat => 'image/png',
|
277
277
|
:threadCount => 1,
|
278
278
|
:bounds => {
|
279
279
|
:coords => [
|