defra_ruby_area 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3f427f04ac61c560c18dc91548c45c1843097f1a
4
- data.tar.gz: 8f4a923e04b6861a168e867c302ed7ff583f1997
3
+ metadata.gz: 63615a29ec74ab527f83b3e5a91d5639e17dd766
4
+ data.tar.gz: 15e541434144213b3d2b1df0be76b13bfec05ce0
5
5
  SHA512:
6
- metadata.gz: 1def8fe471daa1dc45d2741e6509b3b4c84af6e49160e6635ba300f3b93c2e303c2e72513e94f91fbe475e4e1d18982ad9a2146469c0a49b7a2066ae13119825
7
- data.tar.gz: b9c1eff78d8e407afff6ed9534fefa0287962cc414ba3155458f65e26aec5529c56f7db85b1844bdc998a28c94ecddfa337780eec0578d758037e9811b575879
6
+ metadata.gz: 9114d14626f31ce84942cb6aa68e7f22577a1ab9686ea8d839f40173b6da456d726f76d57c1dced03af50246cb0593eb311bb05d4ab4abd6c51dc34f8ce4cd27
7
+ data.tar.gz: 4a7ee038f132af0f00c6fd428e8f843dd6b0706bfe40ff6d2fbcf34b6f8ade0a2c650c48351463c43228ebc891fe9ff01415e95fffa83b80ec1548b7aa32ea4e
data/README.md CHANGED
@@ -110,6 +110,7 @@ As you can see it uses XML within query, and will return the result in XML.
110
110
 
111
111
  Checkout these additional resources we have found helpful in understanding how WFS's work.
112
112
 
113
+ - [Web Feature Service](http://www.opengeospatial.org/standards/wfs)
113
114
  - [Communicating with a WFS service in a web browser](https://enterprise.arcgis.com/en/server/latest/publish-services/windows/communicating-with-a-wfs-service-in-a-web-browser.htm)
114
115
  - [Introduction to Web Feature Service](https://geoserver.geo-solutions.it/edu/en/vector_data/wfsintro.html)
115
116
  - [WFS reference](https://docs.geoserver.org/latest/en/user/services/wfs/reference.html)
@@ -26,34 +26,169 @@ module DefraRuby
26
26
 
27
27
  def response_exe
28
28
  lambda do
29
- begin
30
- response = RestClient::Request.execute(
31
- method: :get,
32
- url: url,
33
- timeout: DefraRuby::Area.configuration.timeout
34
- )
35
- area = parse_xml(response)
36
- raise NoMatchError if area.nil? || area == ""
37
- rescue StandardError => e
38
- raise e
39
- end
29
+ response = RestClient::Request.execute(
30
+ method: :get,
31
+ url: url,
32
+ timeout: DefraRuby::Area.configuration.timeout
33
+ )
34
+ area = parse_xml(response)
35
+ raise NoMatchError if area.nil? || area == ""
36
+
40
37
  { area: area }
41
38
  end
42
39
  end
43
40
 
41
+ def url
42
+ "#{domain}/spatialdata/#{dataset}/wfs?#{url_params}"
43
+ end
44
+
44
45
  def parse_xml(response)
45
46
  xml = Nokogiri::XML(response)
46
47
  xml.xpath(response_xml_path).text
47
48
  end
48
49
 
49
- def url
50
+ # XML path to the value we wish to extract in the WFS query response.
51
+ def response_xml_path
52
+ "//wfs:FeatureCollection/gml:featureMember/#{type_name}/ms:long_name"
53
+ end
54
+
55
+ # Domain where the WFS is hosted
56
+ def domain
57
+ "https://environment.data.gov.uk"
58
+ end
59
+
60
+ # Name of the Environment Agency dataset we are querying.
61
+ #
62
+ # Not actually a part of the WFS interface or spec. This is simply how
63
+ # we route through to the right 'dataset' (how the EA terms it).
64
+ def dataset
50
65
  implemented_in_subclass
51
66
  end
52
67
 
53
- def response_xml_path
68
+ def url_params
69
+ {
70
+ "SERVICE" => service,
71
+ "VERSION" => version,
72
+ "REQUEST" => request,
73
+ "typeName" => type_name,
74
+ "propertyName" => property_name,
75
+ "SRSName" => srs_name,
76
+ "Filter" => filter
77
+ }.map { |k, v| "#{k}=#{v}" }.join("&")
78
+ end
79
+
80
+ # There are generally 3 kinds of GIS services; WFS, WMS, and WCS.
81
+ #
82
+ # * WFS - allows features to be queried, updated, created, or deleted by the client
83
+ # * WMS - returns map images based on the request made
84
+ # * WCS - transfer "coverages", ie. objects covering a geographical area
85
+ #
86
+ # We are querying a 'feature' hence we request to use the WFS service.
87
+ #
88
+ # N.B. A feature is an Object that is an abstraction of a real world
89
+ # phenomenon. This object has a set of properties associated with each
90
+ # having a name, a type, and a value.
91
+ def service
92
+ "WFS"
93
+ end
94
+
95
+ # Currently there are various versions of the WFS standard, for example
96
+ # 1.0, 1.1 and 2.0.
97
+ #
98
+ # The WFS's we are working with only support version 1.0. A WFS may
99
+ # suppport multiple versions hence you need to state the version in the
100
+ # request.
101
+ def version
102
+ "1.0.0"
103
+ end
104
+
105
+ # Used to tell the WFS what kind of request you are making. In the case
106
+ # of `GetFeature` this means
107
+ #
108
+ # Return a selection of features from a data source including geometry and attribute values
109
+ #
110
+ # https://docs.geoserver.org/latest/en/user/services/wfs/reference.html#getfeature
111
+ def request
112
+ "GetFeature"
113
+ end
114
+
115
+ # Name of the feature we wish to query.
116
+ #
117
+ # A WFS may host multiple features, so you need to specify which one you
118
+ # are querying in the url.
119
+ def type_name
54
120
  implemented_in_subclass
55
121
  end
56
122
 
123
+ # Specify which attribute of the feature we want to return. You can check
124
+ # the attributes of a feature by making +DescribeFeatureType+ request.
125
+ #
126
+ # https://environment.data.gov.uk/spatialdata/administrative-boundaries-water-management-areas/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType
127
+ #
128
+ # In our case the administrative boundary features contain a number of
129
+ # properties, but we are only interested in +long_name+ hence we specify
130
+ # it to reduce the size of the response.
131
+ def property_name
132
+ "long_name"
133
+ end
134
+
135
+ # SRS stands for Spatial Reference System. It can also be known as a
136
+ # Coordinate Reference System (CRS). It is a coordinate-based local,
137
+ # regional or global system used to locate geographical entities.
138
+ # A spatial reference system defines a specific map projection, as well as
139
+ # transformations between different spatial reference systems.
140
+ #
141
+ # The SRSName paramater tells the WFS which SRS definition to use. The
142
+ # value is an EPSG (European Petroleum Survey Group) code. You can find a
143
+ # list of them at https://spatialreference.org/ref/epsg/
144
+ #
145
+ # EPSG:27700 refers to OSGB 1936 - British National Grid
146
+ # (https://spatialreference.org/ref/epsg/27700/)
147
+ #
148
+ # For more info on SRS read https://en.wikipedia.org/wiki/Spatial_reference_system
149
+ def srs_name
150
+ "EPSG:27700"
151
+ end
152
+
153
+ # WFS's use filters in GetFeature requests to return data that only
154
+ # matches a certain criteria.
155
+ #
156
+ # https://docs.geoserver.org/latest/en/user/filter/function.html
157
+ #
158
+ # There are various formats you can use for doing those, though it will be
159
+ # dependent on what the WFS supports. In our case we use XML-based Filter
160
+ # Encoding language because
161
+ #
162
+ # * this was how the team that manage the WFS have always provided their
163
+ # examples
164
+ # * we know this format is supported by the WFS's we are interacting with
165
+ #
166
+ # The others are CQL and ECQL. https://docs.geoserver.org/latest/en/user/tutorials/cql/cql_tutorial.html
167
+ #
168
+ # Our filter is looking for the result where our coordinates intersect
169
+ # with the feature property +SHAPE+, with +SHAPE+ being a
170
+ # +MultiPolygonPropertyType+.
171
+ #
172
+ # http://xml.fmi.fi/namespace/meteorology/conceptual-model/meteorological-objects/2009/04/28/docindex647.html
173
+ def filter
174
+ # The filter is done in this way purely for readability. It could just
175
+ # as easily been a one line string statement, but we think this is
176
+ # better.
177
+ filter = <<-XML
178
+ (
179
+ <Filter>
180
+ <Intersects>
181
+ <PropertyName>SHAPE</PropertyName>
182
+ <gml:Point>
183
+ <gml:coordinates>#{easting},#{northing}</gml:coordinates>
184
+ </gml:Point>
185
+ </Intersects>
186
+ </Filter>
187
+ )
188
+ XML
189
+ filter.strip.squeeze(" ").gsub(/\s+/, "")
190
+ end
191
+
57
192
  def implemented_in_subclass
58
193
  raise NotImplementedError, "This #{self.class} cannot respond to:"
59
194
  end
@@ -9,15 +9,12 @@ module DefraRuby
9
9
 
10
10
  private
11
11
 
12
- def response_xml_path
13
- type_name = "Administrative_Boundaries_Environment_Agency_and_Natural_England_Public_Face_Areas"
14
- "//wfs:FeatureCollection/gml:featureMember/ms:#{type_name}/ms:long_name"
12
+ def dataset
13
+ "administrative-boundaries-environment-agency-and-natural-england-public-face-areas"
15
14
  end
16
15
 
17
- def url
18
- # rubocop:disable Metrics/LineLength
19
- "https://environment.data.gov.uk/spatialdata/administrative-boundaries-environment-agency-and-natural-england-public-face-areas/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&typeNames=ms:Administrative_Boundaries_Environment_Agency_and_Natural_England_Public_Face_Areas&propertyName=long_name&SRSName=EPSG:27700&Filter=(<Filter><Intersects><PropertyName>SHAPE</PropertyName><gml:Point><gml:coordinates>#{easting},#{northing}</gml:coordinates></gml:Point></Intersects></Filter>)"
20
- # rubocop:enable Metrics/LineLength
16
+ def type_name
17
+ "ms:Administrative_Boundaries_Environment_Agency_and_Natural_England_Public_Face_Areas"
21
18
  end
22
19
 
23
20
  end
@@ -9,15 +9,12 @@ module DefraRuby
9
9
 
10
10
  private
11
11
 
12
- def response_xml_path
13
- type_name = "Administrative_Boundaries_Water_Management_Areas"
14
- "//wfs:FeatureCollection/gml:featureMember/ms:#{type_name}/ms:long_name"
12
+ def dataset
13
+ "administrative-boundaries-water-management-areas"
15
14
  end
16
15
 
17
- def url
18
- # rubocop:disable Metrics/LineLength
19
- "https://environment.data.gov.uk/spatialdata/administrative-boundaries-water-management-areas/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&typeNames=ms:Administrative_Boundaries_Water_Management_Areas&propertyName=long_name&SRSName=EPSG:27700&Filter=(<Filter><Intersects><PropertyName>SHAPE</PropertyName><gml:Point><gml:coordinates>#{easting},#{northing}</gml:coordinates></gml:Point></Intersects></Filter>)"
20
- # rubocop:enable Metrics/LineLength
16
+ def type_name
17
+ "ms:Administrative_Boundaries_Water_Management_Areas"
21
18
  end
22
19
 
23
20
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module DefraRuby
4
4
  module Area
5
- VERSION = "0.2.0"
5
+ VERSION = "0.2.1"
6
6
  end
7
7
  end
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://environment.data.gov.uk/spatialdata/administrative-boundaries-environment-agency-and-natural-england-public-face-areas/wfs?Filter=(%3CFilter%3E%3CIntersects%3E%3CPropertyName%3ESHAPE%3C/PropertyName%3E%3Cgml:Point%3E%3Cgml:coordinates%3E,%3C/gml:coordinates%3E%3C/gml:Point%3E%3C/Intersects%3E%3C/Filter%3E)&REQUEST=GetFeature&SERVICE=WFS&SRSName=EPSG:27700&VERSION=2.0.0&propertyName=long_name,short_name&typeNames=ms:Administrative_Boundaries_Environment_Agency_and_Natural_England_Public_Face_Areas
5
+ uri: https://environment.data.gov.uk/spatialdata/administrative-boundaries-environment-agency-and-natural-england-public-face-areas/wfs?Filter=(%3CFilter%3E%3CIntersects%3E%3CPropertyName%3ESHAPE%3C/PropertyName%3E%3Cgml:Point%3E%3Cgml:coordinates%3E,%3C/gml:coordinates%3E%3C/gml:Point%3E%3C/Intersects%3E%3C/Filter%3E)&REQUEST=GetFeature&SERVICE=WFS&SRSName=EPSG:27700&VERSION=1.0.0&propertyName=long_name&typeName=ms:Administrative_Boundaries_Environment_Agency_and_Natural_England_Public_Face_Areas
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -23,115 +23,7 @@ http_interactions:
23
23
  Server:
24
24
  - nginx
25
25
  Date:
26
- - Tue, 09 Jul 2019 15:45:40 GMT
27
- Content-Type:
28
- - application/xml
29
- Content-Length:
30
- - '635'
31
- Connection:
32
- - keep-alive
33
- Cache-Control:
34
- - private
35
- X-Aspnet-Version:
36
- - 4.0.30319
37
- X-Powered-By:
38
- - ASP.NET
39
- body:
40
- encoding: UTF-8
41
- string: |
42
- <?xml version="1.0" encoding="utf-8" ?>
43
- <ExceptionReport
44
- version="2.0.0" xmlns="http://www.opengis.net/ows/1.1"
45
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
46
- xsi:schemaLocation="http://www.opengis.net/ows/1.1 http://schemas.opengis.net/ows/1.1.0/owsAll.xsd"
47
- >
48
- <Exception exceptionCode="InvalidParameterValue" locator="Unknown">
49
- <ExceptionText><![CDATA[The geometry was not recognized.]]></ExceptionText>
50
- </Exception>
51
- <Exception exceptionCode="OperationProcessingFailed" locator="Unknown">
52
- <ExceptionText><![CDATA[Operator 'Intersects' can't parse geometry.]]></ExceptionText>
53
- </Exception>
54
- </ExceptionReport>
55
- http_version:
56
- recorded_at: Tue, 09 Jul 2019 15:45:40 GMT
57
- - request:
58
- method: get
59
- uri: https://environment.data.gov.uk/spatialdata/administrative-boundaries-environment-agency-and-natural-england-public-face-areas/wfs?Filter=(%3CFilter%3E%3CIntersects%3E%3CPropertyName%3ESHAPE%3C/PropertyName%3E%3Cgml:Point%3E%3Cgml:coordinates%3E,%3C/gml:coordinates%3E%3C/gml:Point%3E%3C/Intersects%3E%3C/Filter%3E)&REQUEST=GetFeature&SERVICE=WFS&SRSName=EPSG:27700&VERSION=2.0.0&propertyName=long_name&typeNames=ms:Administrative_Boundaries_Environment_Agency_and_Natural_England_Public_Face_Areas
60
- body:
61
- encoding: US-ASCII
62
- string: ''
63
- headers:
64
- Accept:
65
- - "*/*"
66
- Accept-Encoding:
67
- - gzip, deflate
68
- User-Agent:
69
- - rest-client/2.0.2 (darwin18.5.0 x86_64) ruby/2.4.2p198
70
- Host:
71
- - environment.data.gov.uk
72
- response:
73
- status:
74
- code: 200
75
- message: OK
76
- headers:
77
- Server:
78
- - nginx
79
- Date:
80
- - Thu, 01 Aug 2019 10:07:13 GMT
81
- Content-Type:
82
- - application/xml
83
- Content-Length:
84
- - '635'
85
- Connection:
86
- - keep-alive
87
- Cache-Control:
88
- - private
89
- X-Aspnet-Version:
90
- - 4.0.30319
91
- X-Powered-By:
92
- - ASP.NET
93
- body:
94
- encoding: UTF-8
95
- string: |
96
- <?xml version="1.0" encoding="utf-8" ?>
97
- <ExceptionReport
98
- version="2.0.0" xmlns="http://www.opengis.net/ows/1.1"
99
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
100
- xsi:schemaLocation="http://www.opengis.net/ows/1.1 http://schemas.opengis.net/ows/1.1.0/owsAll.xsd"
101
- >
102
- <Exception exceptionCode="InvalidParameterValue" locator="Unknown">
103
- <ExceptionText><![CDATA[The geometry was not recognized.]]></ExceptionText>
104
- </Exception>
105
- <Exception exceptionCode="OperationProcessingFailed" locator="Unknown">
106
- <ExceptionText><![CDATA[Operator 'Intersects' can't parse geometry.]]></ExceptionText>
107
- </Exception>
108
- </ExceptionReport>
109
- http_version:
110
- recorded_at: Thu, 01 Aug 2019 10:07:13 GMT
111
- - request:
112
- method: get
113
- uri: https://environment.data.gov.uk/spatialdata/administrative-boundaries-environment-agency-and-natural-england-public-face-areas/wfs?Filter=(%3CFilter%3E%3CIntersects%3E%3CPropertyName%3ESHAPE%3C/PropertyName%3E%3Cgml:Point%3E%3Cgml:coordinates%3E,%3C/gml:coordinates%3E%3C/gml:Point%3E%3C/Intersects%3E%3C/Filter%3E)&REQUEST=GetFeature&SERVICE=WFS&SRSName=EPSG:27700&VERSION=1.0.0&propertyName=long_name&typeNames=ms:Administrative_Boundaries_Environment_Agency_and_Natural_England_Public_Face_Areas
114
- body:
115
- encoding: US-ASCII
116
- string: ''
117
- headers:
118
- Accept:
119
- - "*/*"
120
- Accept-Encoding:
121
- - gzip, deflate
122
- User-Agent:
123
- - rest-client/2.0.2 (darwin18.5.0 x86_64) ruby/2.4.2p198
124
- Host:
125
- - environment.data.gov.uk
126
- response:
127
- status:
128
- code: 200
129
- message: OK
130
- headers:
131
- Server:
132
- - nginx
133
- Date:
134
- - Sun, 04 Aug 2019 10:30:09 GMT
26
+ - Mon, 05 Aug 2019 16:31:59 GMT
135
27
  Content-Type:
136
28
  - application/xml
137
29
  Content-Length:
@@ -153,5 +45,5 @@ http_interactions:
153
45
  <ogc:ServiceException><![CDATA[Operator 'Intersects' can't parse geometry.]]></ogc:ServiceException>
154
46
  </ogc:ServiceExceptionReport>
155
47
  http_version:
156
- recorded_at: Sun, 04 Aug 2019 10:30:09 GMT
48
+ recorded_at: Mon, 05 Aug 2019 16:31:59 GMT
157
49
  recorded_with: VCR 4.0.0
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://environment.data.gov.uk/spatialdata/administrative-boundaries-environment-agency-and-natural-england-public-face-areas/wfs?Filter=(%3CFilter%3E%3CIntersects%3E%3CPropertyName%3ESHAPE%3C/PropertyName%3E%3Cgml:Point%3E%3Cgml:coordinates%3E301233.0,221592.0%3C/gml:coordinates%3E%3C/gml:Point%3E%3C/Intersects%3E%3C/Filter%3E)&REQUEST=GetFeature&SERVICE=WFS&SRSName=EPSG:27700&VERSION=2.0.0&propertyName=long_name,short_name&typeNames=ms:Administrative_Boundaries_Environment_Agency_and_Natural_England_Public_Face_Areas
5
+ uri: https://environment.data.gov.uk/spatialdata/administrative-boundaries-environment-agency-and-natural-england-public-face-areas/wfs?Filter=(%3CFilter%3E%3CIntersects%3E%3CPropertyName%3ESHAPE%3C/PropertyName%3E%3Cgml:Point%3E%3Cgml:coordinates%3E301233.0,221592.0%3C/gml:coordinates%3E%3C/gml:Point%3E%3C/Intersects%3E%3C/Filter%3E)&REQUEST=GetFeature&SERVICE=WFS&SRSName=EPSG:27700&VERSION=1.0.0&propertyName=long_name&typeName=ms:Administrative_Boundaries_Environment_Agency_and_Natural_England_Public_Face_Areas
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -12,7 +12,7 @@ http_interactions:
12
12
  Accept-Encoding:
13
13
  - gzip, deflate
14
14
  User-Agent:
15
- - rest-client/2.0.2 (darwin18.2.0 x86_64) ruby/2.4.2p198
15
+ - rest-client/2.0.2 (darwin18.5.0 x86_64) ruby/2.4.2p198
16
16
  Host:
17
17
  - environment.data.gov.uk
18
18
  response:
@@ -23,11 +23,11 @@ http_interactions:
23
23
  Server:
24
24
  - nginx
25
25
  Date:
26
- - Wed, 31 Jul 2019 19:06:40 GMT
26
+ - Mon, 05 Aug 2019 16:31:58 GMT
27
27
  Content-Type:
28
28
  - application/xml
29
29
  Content-Length:
30
- - '1024'
30
+ - '1070'
31
31
  Connection:
32
32
  - keep-alive
33
33
  Cache-Control:
@@ -40,8 +40,13 @@ http_interactions:
40
40
  encoding: UTF-8
41
41
  string: |-
42
42
  <?xml version="1.0" encoding="utf-8" ?>
43
- <wfs:FeatureCollection xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wfs="http://www.opengis.net/wfs/2.0" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:ms="https://environment.data.gov.uk/spatialdata/administrative-boundaries-environment-agency-and-natural-england-public-face-areas/wfs" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" timeStamp="2019-07-31T19:06:40Z" numberMatched="unknown" numberReturned="0" xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/gml.xsd https://environment.data.gov.uk/spatialdata/administrative-boundaries-environment-agency-and-natural-england-public-face-areas/wfs https://environment.data.gov.uk/spatialdata/administrative-boundaries-environment-agency-and-natural-england-public-face-areas/wfs?service=wfs%26version=2.0.0%26request=DescribeFeatureType">
43
+ <wfs:FeatureCollection xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wfs="http://www.opengis.net/wfs" xmlns:gml="http://www.opengis.net/gml" xmlns:ms="https://environment.data.gov.uk/spatialdata/administrative-boundaries-environment-agency-and-natural-england-public-face-areas/wfs" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd http://www.opengis.net/gml http://schemas.opengis.net/gml/2.1.2/feature.xsd https://environment.data.gov.uk/spatialdata/administrative-boundaries-environment-agency-and-natural-england-public-face-areas/wfs https://environment.data.gov.uk/spatialdata/administrative-boundaries-environment-agency-and-natural-england-public-face-areas/wfs?service=wfs%26version=1.0.0%26request=DescribeFeatureType">
44
+ <gml:boundedBy>
45
+ <gml:Box srsName="EPSG:27700">
46
+ <gml:coordinates>0,0,0,0</gml:coordinates>
47
+ </gml:Box>
48
+ </gml:boundedBy>
44
49
  </wfs:FeatureCollection>
45
50
  http_version:
46
- recorded_at: Wed, 31 Jul 2019 19:06:40 GMT
51
+ recorded_at: Mon, 05 Aug 2019 16:31:59 GMT
47
52
  recorded_with: VCR 4.0.0
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://environment.data.gov.uk/spatialdata/administrative-boundaries-environment-agency-and-natural-england-public-face-areas/wfs?Filter=(%3CFilter%3E%3CIntersects%3E%3CPropertyName%3ESHAPE%3C/PropertyName%3E%3Cgml:Point%3E%3Cgml:coordinates%3E408602.61,257535.31%3C/gml:coordinates%3E%3C/gml:Point%3E%3C/Intersects%3E%3C/Filter%3E)&REQUEST=GetFeature&SERVICE=WFS&SRSName=EPSG:27700&VERSION=2.0.0&propertyName=long_name,short_name&typeNames=ms:Administrative_Boundaries_Environment_Agency_and_Natural_England_Public_Face_Areas
5
+ uri: https://environment.data.gov.uk/spatialdata/administrative-boundaries-environment-agency-and-natural-england-public-face-areas/wfs?Filter=(%3CFilter%3E%3CIntersects%3E%3CPropertyName%3ESHAPE%3C/PropertyName%3E%3Cgml:Point%3E%3Cgml:coordinates%3E408602.61,257535.31%3C/gml:coordinates%3E%3C/gml:Point%3E%3C/Intersects%3E%3C/Filter%3E)&REQUEST=GetFeature&SERVICE=WFS&SRSName=EPSG:27700&VERSION=1.0.0&propertyName=long_name&typeName=ms:Administrative_Boundaries_Environment_Agency_and_Natural_England_Public_Face_Areas
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -23,112 +23,7 @@ http_interactions:
23
23
  Server:
24
24
  - nginx
25
25
  Date:
26
- - Tue, 09 Jul 2019 10:13:56 GMT
27
- Content-Type:
28
- - application/xml
29
- Content-Length:
30
- - '1607'
31
- Connection:
32
- - keep-alive
33
- Cache-Control:
34
- - private
35
- X-Aspnet-Version:
36
- - 4.0.30319
37
- X-Powered-By:
38
- - ASP.NET
39
- body:
40
- encoding: UTF-8
41
- string: |-
42
- <?xml version="1.0" encoding="utf-8" ?>
43
- <wfs:FeatureCollection xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wfs="http://www.opengis.net/wfs/2.0" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:ms="https://environment.data.gov.uk/spatialdata/administrative-boundaries-environment-agency-and-natural-england-public-face-areas/wfs" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" timeStamp="2019-07-09T10:13:56Z" numberMatched="unknown" numberReturned="1" xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/gml.xsd https://environment.data.gov.uk/spatialdata/administrative-boundaries-environment-agency-and-natural-england-public-face-areas/wfs https://environment.data.gov.uk/spatialdata/administrative-boundaries-environment-agency-and-natural-england-public-face-areas/wfs?service=wfs%26version=2.0.0%26request=DescribeFeatureType">
44
- <wfs:member>
45
- <ms:Administrative_Boundaries_Environment_Agency_and_Natural_England_Public_Face_Areas gml:id="Administrative_Boundaries_Environment_Agency_and_Natural_England_Public_Face_Areas.23">
46
- <ms:OBJECTID>23</ms:OBJECTID>
47
- <ms:long_name>West Midlands</ms:long_name>
48
- <ms:short_name>West Midlands</ms:short_name>
49
- <ms:st_area_shape_>14543741870.84492</ms:st_area_shape_>
50
- <ms:st_perimeter_shape_>1043376.795941756</ms:st_perimeter_shape_>
51
- </ms:Administrative_Boundaries_Environment_Agency_and_Natural_England_Public_Face_Areas>
52
- </wfs:member>
53
- </wfs:FeatureCollection>
54
- http_version:
55
- recorded_at: Tue, 09 Jul 2019 10:13:56 GMT
56
- - request:
57
- method: get
58
- uri: https://environment.data.gov.uk/spatialdata/administrative-boundaries-environment-agency-and-natural-england-public-face-areas/wfs?Filter=(%3CFilter%3E%3CIntersects%3E%3CPropertyName%3ESHAPE%3C/PropertyName%3E%3Cgml:Point%3E%3Cgml:coordinates%3E408602.61,257535.31%3C/gml:coordinates%3E%3C/gml:Point%3E%3C/Intersects%3E%3C/Filter%3E)&REQUEST=GetFeature&SERVICE=WFS&SRSName=EPSG:27700&VERSION=2.0.0&propertyName=long_name&typeNames=ms:Administrative_Boundaries_Environment_Agency_and_Natural_England_Public_Face_Areas
59
- body:
60
- encoding: US-ASCII
61
- string: ''
62
- headers:
63
- Accept:
64
- - "*/*"
65
- Accept-Encoding:
66
- - gzip, deflate
67
- User-Agent:
68
- - rest-client/2.0.2 (darwin18.5.0 x86_64) ruby/2.4.2p198
69
- Host:
70
- - environment.data.gov.uk
71
- response:
72
- status:
73
- code: 200
74
- message: OK
75
- headers:
76
- Server:
77
- - nginx
78
- Date:
79
- - Thu, 01 Aug 2019 10:07:06 GMT
80
- Content-Type:
81
- - application/xml
82
- Content-Length:
83
- - '1556'
84
- Connection:
85
- - keep-alive
86
- Cache-Control:
87
- - private
88
- X-Aspnet-Version:
89
- - 4.0.30319
90
- X-Powered-By:
91
- - ASP.NET
92
- body:
93
- encoding: UTF-8
94
- string: |-
95
- <?xml version="1.0" encoding="utf-8" ?>
96
- <wfs:FeatureCollection xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wfs="http://www.opengis.net/wfs/2.0" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:ms="https://environment.data.gov.uk/spatialdata/administrative-boundaries-environment-agency-and-natural-england-public-face-areas/wfs" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" timeStamp="2019-08-01T10:07:06Z" numberMatched="unknown" numberReturned="1" xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/gml.xsd https://environment.data.gov.uk/spatialdata/administrative-boundaries-environment-agency-and-natural-england-public-face-areas/wfs https://environment.data.gov.uk/spatialdata/administrative-boundaries-environment-agency-and-natural-england-public-face-areas/wfs?service=wfs%26version=2.0.0%26request=DescribeFeatureType">
97
- <wfs:member>
98
- <ms:Administrative_Boundaries_Environment_Agency_and_Natural_England_Public_Face_Areas gml:id="Administrative_Boundaries_Environment_Agency_and_Natural_England_Public_Face_Areas.23">
99
- <ms:OBJECTID>23</ms:OBJECTID>
100
- <ms:long_name>West Midlands</ms:long_name>
101
- <ms:st_area_shape_>14543741870.84492</ms:st_area_shape_>
102
- <ms:st_perimeter_shape_>1043376.795941756</ms:st_perimeter_shape_>
103
- </ms:Administrative_Boundaries_Environment_Agency_and_Natural_England_Public_Face_Areas>
104
- </wfs:member>
105
- </wfs:FeatureCollection>
106
- http_version:
107
- recorded_at: Thu, 01 Aug 2019 10:07:05 GMT
108
- - request:
109
- method: get
110
- uri: https://environment.data.gov.uk/spatialdata/administrative-boundaries-environment-agency-and-natural-england-public-face-areas/wfs?Filter=(%3CFilter%3E%3CIntersects%3E%3CPropertyName%3ESHAPE%3C/PropertyName%3E%3Cgml:Point%3E%3Cgml:coordinates%3E408602.61,257535.31%3C/gml:coordinates%3E%3C/gml:Point%3E%3C/Intersects%3E%3C/Filter%3E)&REQUEST=GetFeature&SERVICE=WFS&SRSName=EPSG:27700&VERSION=1.0.0&propertyName=long_name&typeNames=ms:Administrative_Boundaries_Environment_Agency_and_Natural_England_Public_Face_Areas
111
- body:
112
- encoding: US-ASCII
113
- string: ''
114
- headers:
115
- Accept:
116
- - "*/*"
117
- Accept-Encoding:
118
- - gzip, deflate
119
- User-Agent:
120
- - rest-client/2.0.2 (darwin18.5.0 x86_64) ruby/2.4.2p198
121
- Host:
122
- - environment.data.gov.uk
123
- response:
124
- status:
125
- code: 200
126
- message: OK
127
- headers:
128
- Server:
129
- - nginx
130
- Date:
131
- - Sun, 04 Aug 2019 10:30:09 GMT
26
+ - Mon, 05 Aug 2019 16:31:58 GMT
132
27
  Content-Type:
133
28
  - application/xml
134
29
  Content-Length:
@@ -161,5 +56,5 @@ http_interactions:
161
56
  </gml:featureMember>
162
57
  </wfs:FeatureCollection>
163
58
  http_version:
164
- recorded_at: Sun, 04 Aug 2019 10:30:09 GMT
59
+ recorded_at: Mon, 05 Aug 2019 16:31:58 GMT
165
60
  recorded_with: VCR 4.0.0
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://environment.data.gov.uk/spatialdata/administrative-boundaries-water-management-areas/wfs?Filter=(%3CFilter%3E%3CIntersects%3E%3CPropertyName%3ESHAPE%3C/PropertyName%3E%3Cgml:Point%3E%3Cgml:coordinates%3E,%3C/gml:coordinates%3E%3C/gml:Point%3E%3C/Intersects%3E%3C/Filter%3E)&REQUEST=GetFeature&SERVICE=WFS&SRSName=EPSG:27700&VERSION=1.0.0&propertyName=long_name&typeNames=ms:Administrative_Boundaries_Water_Management_Areas
5
+ uri: https://environment.data.gov.uk/spatialdata/administrative-boundaries-water-management-areas/wfs?Filter=(%3CFilter%3E%3CIntersects%3E%3CPropertyName%3ESHAPE%3C/PropertyName%3E%3Cgml:Point%3E%3Cgml:coordinates%3E,%3C/gml:coordinates%3E%3C/gml:Point%3E%3C/Intersects%3E%3C/Filter%3E)&REQUEST=GetFeature&SERVICE=WFS&SRSName=EPSG:27700&VERSION=1.0.0&propertyName=long_name&typeName=ms:Administrative_Boundaries_Water_Management_Areas
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -23,7 +23,7 @@ http_interactions:
23
23
  Server:
24
24
  - nginx
25
25
  Date:
26
- - Thu, 01 Aug 2019 08:44:09 GMT
26
+ - Mon, 05 Aug 2019 16:31:54 GMT
27
27
  Content-Type:
28
28
  - application/xml
29
29
  Content-Length:
@@ -45,5 +45,5 @@ http_interactions:
45
45
  <ogc:ServiceException><![CDATA[Operator 'Intersects' can't parse geometry.]]></ogc:ServiceException>
46
46
  </ogc:ServiceExceptionReport>
47
47
  http_version:
48
- recorded_at: Thu, 01 Aug 2019 08:44:09 GMT
48
+ recorded_at: Mon, 05 Aug 2019 16:31:54 GMT
49
49
  recorded_with: VCR 4.0.0
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://environment.data.gov.uk/spatialdata/administrative-boundaries-water-management-areas/wfs?Filter=(%3CFilter%3E%3CIntersects%3E%3CPropertyName%3ESHAPE%3C/PropertyName%3E%3Cgml:Point%3E%3Cgml:coordinates%3E301233.0,221592.0%3C/gml:coordinates%3E%3C/gml:Point%3E%3C/Intersects%3E%3C/Filter%3E)&REQUEST=GetFeature&SERVICE=WFS&SRSName=EPSG:27700&VERSION=1.0.0&propertyName=long_name&typeNames=ms:Administrative_Boundaries_Water_Management_Areas
5
+ uri: https://environment.data.gov.uk/spatialdata/administrative-boundaries-water-management-areas/wfs?Filter=(%3CFilter%3E%3CIntersects%3E%3CPropertyName%3ESHAPE%3C/PropertyName%3E%3Cgml:Point%3E%3Cgml:coordinates%3E301233.0,221592.0%3C/gml:coordinates%3E%3C/gml:Point%3E%3C/Intersects%3E%3C/Filter%3E)&REQUEST=GetFeature&SERVICE=WFS&SRSName=EPSG:27700&VERSION=1.0.0&propertyName=long_name&typeName=ms:Administrative_Boundaries_Water_Management_Areas
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -23,7 +23,7 @@ http_interactions:
23
23
  Server:
24
24
  - nginx
25
25
  Date:
26
- - Thu, 01 Aug 2019 08:44:09 GMT
26
+ - Mon, 05 Aug 2019 16:31:57 GMT
27
27
  Content-Type:
28
28
  - application/xml
29
29
  Content-Length:
@@ -48,5 +48,5 @@ http_interactions:
48
48
  </gml:boundedBy>
49
49
  </wfs:FeatureCollection>
50
50
  http_version:
51
- recorded_at: Thu, 01 Aug 2019 08:44:09 GMT
51
+ recorded_at: Mon, 05 Aug 2019 16:31:57 GMT
52
52
  recorded_with: VCR 4.0.0
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://environment.data.gov.uk/spatialdata/administrative-boundaries-water-management-areas/wfs?Filter=(%3CFilter%3E%3CIntersects%3E%3CPropertyName%3ESHAPE%3C/PropertyName%3E%3Cgml:Point%3E%3Cgml:coordinates%3E408602.61,257535.31%3C/gml:coordinates%3E%3C/gml:Point%3E%3C/Intersects%3E%3C/Filter%3E)&REQUEST=GetFeature&SERVICE=WFS&SRSName=EPSG:27700&VERSION=1.0.0&propertyName=long_name&typeNames=ms:Administrative_Boundaries_Water_Management_Areas
5
+ uri: https://environment.data.gov.uk/spatialdata/administrative-boundaries-water-management-areas/wfs?Filter=(%3CFilter%3E%3CIntersects%3E%3CPropertyName%3ESHAPE%3C/PropertyName%3E%3Cgml:Point%3E%3Cgml:coordinates%3E408602.61,257535.31%3C/gml:coordinates%3E%3C/gml:Point%3E%3C/Intersects%3E%3C/Filter%3E)&REQUEST=GetFeature&SERVICE=WFS&SRSName=EPSG:27700&VERSION=1.0.0&propertyName=long_name&typeName=ms:Administrative_Boundaries_Water_Management_Areas
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -23,7 +23,7 @@ http_interactions:
23
23
  Server:
24
24
  - nginx
25
25
  Date:
26
- - Thu, 01 Aug 2019 08:44:09 GMT
26
+ - Mon, 05 Aug 2019 16:31:57 GMT
27
27
  Content-Type:
28
28
  - application/xml
29
29
  Content-Length:
@@ -56,5 +56,5 @@ http_interactions:
56
56
  </gml:featureMember>
57
57
  </wfs:FeatureCollection>
58
58
  http_version:
59
- recorded_at: Thu, 01 Aug 2019 08:44:08 GMT
59
+ recorded_at: Mon, 05 Aug 2019 16:31:58 GMT
60
60
  recorded_with: VCR 4.0.0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: defra_ruby_area
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Defra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-05 00:00:00.000000000 Z
11
+ date: 2019-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.10'
19
+ version: 1.10.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.10'
26
+ version: 1.10.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rest-client
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -211,7 +211,6 @@ files:
211
211
  - spec/defra_ruby/area/services/public_face_area_service_spec.rb
212
212
  - spec/defra_ruby/area/services/water_management_area_service_spec.rb
213
213
  - spec/defra_ruby/area_spec.rb
214
- - spec/examples.txt
215
214
  - spec/spec_helper.rb
216
215
  - spec/support/defra_ruby_area.rb
217
216
  - spec/support/dotenv.rb
@@ -245,22 +244,21 @@ signing_key:
245
244
  specification_version: 4
246
245
  summary: Defra ruby on rails EA administrative area lookup
247
246
  test_files:
248
- - spec/spec_helper.rb
247
+ - spec/cassettes/public_face_area_invalid_blank.yml
248
+ - spec/cassettes/public_face_area_invalid_coords.yml
249
+ - spec/cassettes/public_face_area_valid.yml
250
+ - spec/cassettes/water_management_area_invalid_blank.yml
251
+ - spec/cassettes/water_management_area_invalid_coords.yml
252
+ - spec/cassettes/water_management_area_valid.yml
249
253
  - spec/defra_ruby/area/configuration_spec.rb
250
254
  - spec/defra_ruby/area/response_spec.rb
251
- - spec/defra_ruby/area/services/water_management_area_service_spec.rb
252
255
  - spec/defra_ruby/area/services/public_face_area_service_spec.rb
256
+ - spec/defra_ruby/area/services/water_management_area_service_spec.rb
253
257
  - spec/defra_ruby/area_spec.rb
254
- - spec/examples.txt
255
- - spec/cassettes/water_management_area_invalid_coords.yml
256
- - spec/cassettes/public_face_area_invalid_coords.yml
257
- - spec/cassettes/water_management_area_invalid_blank.yml
258
- - spec/cassettes/public_face_area_valid.yml
259
- - spec/cassettes/water_management_area_valid.yml
260
- - spec/cassettes/public_face_area_invalid_blank.yml
258
+ - spec/spec_helper.rb
261
259
  - spec/support/defra_ruby_area.rb
262
- - spec/support/simplecov.rb
263
- - spec/support/vcr.rb
264
- - spec/support/pry.rb
265
260
  - spec/support/dotenv.rb
261
+ - spec/support/pry.rb
266
262
  - spec/support/shared_examples/handle_request_errors.rb
263
+ - spec/support/simplecov.rb
264
+ - spec/support/vcr.rb
data/spec/examples.txt DELETED
@@ -1,22 +0,0 @@
1
- example_id | status | run_time |
2
- -------------------------------------------------------------------------------- | ------ | --------------- |
3
- ./spec/defra_ruby/area/configuration_spec.rb[1:1] | passed | 0.0001 seconds |
4
- ./spec/defra_ruby/area/response_spec.rb[1:1:1:1] | passed | 0.00017 seconds |
5
- ./spec/defra_ruby/area/response_spec.rb[1:1:2:1] | passed | 0.00013 seconds |
6
- ./spec/defra_ruby/area/response_spec.rb[1:2:1:1] | passed | 0.00013 seconds |
7
- ./spec/defra_ruby/area/response_spec.rb[1:2:2:1] | passed | 0.00013 seconds |
8
- ./spec/defra_ruby/area/response_spec.rb[1:3:1:1] | passed | 0.00011 seconds |
9
- ./spec/defra_ruby/area/response_spec.rb[1:3:2:1] | passed | 0.00012 seconds |
10
- ./spec/defra_ruby/area/services/public_face_area_service_spec.rb[1:1:1:1] | passed | 0.37074 seconds |
11
- ./spec/defra_ruby/area/services/public_face_area_service_spec.rb[1:1:2:1:1] | passed | 0.33628 seconds |
12
- ./spec/defra_ruby/area/services/public_face_area_service_spec.rb[1:1:2:2:1] | passed | 0.03231 seconds |
13
- ./spec/defra_ruby/area/services/public_face_area_service_spec.rb[1:1:3:1:1] | passed | 0.03391 seconds |
14
- ./spec/defra_ruby/area/services/public_face_area_service_spec.rb[1:1:3:2:1] | passed | 0.02614 seconds |
15
- ./spec/defra_ruby/area/services/water_management_area_service_spec.rb[1:1:1:1] | passed | 0.0305 seconds |
16
- ./spec/defra_ruby/area/services/water_management_area_service_spec.rb[1:1:2:1:1] | passed | 0.02802 seconds |
17
- ./spec/defra_ruby/area/services/water_management_area_service_spec.rb[1:1:2:2:1] | passed | 0.02484 seconds |
18
- ./spec/defra_ruby/area/services/water_management_area_service_spec.rb[1:1:3:1:1] | passed | 0.01976 seconds |
19
- ./spec/defra_ruby/area/services/water_management_area_service_spec.rb[1:1:3:2:1] | passed | 0.02365 seconds |
20
- ./spec/defra_ruby/area_spec.rb[1:1:1] | passed | 0.00131 seconds |
21
- ./spec/defra_ruby/area_spec.rb[1:2:1:1] | passed | 0.00057 seconds |
22
- ./spec/defra_ruby/area_spec.rb[1:2:2:1] | passed | 0.0013 seconds |