wms_getcapabilities 0.1.0.1 → 0.1.0.2
Sign up to get free protection for your applications and to get access to all the features.
data/examples/test.rb
CHANGED
@@ -1,12 +1,24 @@
|
|
1
1
|
module WmsGetcapabilities
|
2
2
|
class Layer
|
3
|
-
attr_accessor :name, :title, :crs, :bbox
|
4
|
-
|
5
|
-
def initialize(name, title, crs, bbox)
|
3
|
+
attr_accessor :name, :title, :crs, :bbox, :description
|
4
|
+
|
5
|
+
def initialize(name, title, crs, bbox, description)
|
6
6
|
@name = name
|
7
7
|
@title = title
|
8
8
|
@crs = crs
|
9
9
|
@bbox = bbox
|
10
|
+
@description = description
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.from_xml(node)
|
14
|
+
children = node.children
|
15
|
+
name = children.at("Name").text
|
16
|
+
title = children.at("Title").text
|
17
|
+
crs = children.at("CRS").text
|
18
|
+
description = children.at("Abstract").text
|
19
|
+
box = children.search("BoundingBox").last
|
20
|
+
bbox = [box.attr("minx"), box.attr("miny"), box.attr("maxx"), box.attr("maxy")]
|
21
|
+
l = Layer.new(name, title, crs, bbox, description, metadata_url)
|
10
22
|
end
|
11
23
|
|
12
24
|
end
|
@@ -17,15 +17,11 @@ module WmsGetcapabilities
|
|
17
17
|
def get_layers
|
18
18
|
layers = []
|
19
19
|
nodes = self.search("//xmlns:Layer")
|
20
|
-
nodes.
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
box = children.search("BoundingBox").last
|
26
|
-
bbox = [box.attr("minx"), box.attr("miny"), box.attr("maxx"), box.attr("maxy")]
|
27
|
-
l = Layer.new(name, title, crs, bbox)
|
28
|
-
layers << l
|
20
|
+
nodes.each_with_index do |node, i|
|
21
|
+
unless i==0
|
22
|
+
l = Layer.from_xml(node)
|
23
|
+
layers << l
|
24
|
+
end
|
29
25
|
end
|
30
26
|
layers
|
31
27
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wms_getcapabilities
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
4
|
+
version: 0.1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-10-18 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
16
|
-
requirement: &
|
16
|
+
requirement: &2165082040 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2165082040
|
25
25
|
description: Interface between ruby and Geoserver WMS GetCapabilities
|
26
26
|
email:
|
27
27
|
- jchapron@dotgee.fr
|