defra_ruby_area 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
 - data/LICENSE +8 -0
 - data/README.md +150 -0
 - data/Rakefile +33 -0
 - data/bin/console +14 -0
 - data/bin/setup +8 -0
 - data/lib/defra_ruby.rb +7 -0
 - data/lib/defra_ruby/area.rb +13 -0
 - data/lib/defra_ruby/area/no_match_error.rb +11 -0
 - data/lib/defra_ruby/area/response.rb +33 -0
 - data/lib/defra_ruby/area/services/base_area_service.rb +58 -0
 - data/lib/defra_ruby/area/services/public_face_area_service.rb +25 -0
 - data/lib/defra_ruby/area/services/water_management_area_service.rb +25 -0
 - data/lib/defra_ruby/area/version.rb +7 -0
 - data/spec/cassettes/public_face_area_invalid_blank.yml +157 -0
 - data/spec/cassettes/public_face_area_invalid_coords.yml +47 -0
 - data/spec/cassettes/public_face_area_valid.yml +165 -0
 - data/spec/cassettes/water_management_area_invalid_blank.yml +49 -0
 - data/spec/cassettes/water_management_area_invalid_coords.yml +52 -0
 - data/spec/cassettes/water_management_area_valid.yml +60 -0
 - data/spec/defra_ruby/area/response_spec.rb +67 -0
 - data/spec/defra_ruby/area/services/public_face_area_service_spec.rb +63 -0
 - data/spec/defra_ruby/area/services/water_management_area_service_spec.rb +63 -0
 - data/spec/defra_ruby/area_spec.rb +12 -0
 - data/spec/examples.txt +15 -0
 - data/spec/spec_helper.rb +83 -0
 - data/spec/support/defra_ruby_area.rb +4 -0
 - data/spec/support/dotenv.rb +4 -0
 - data/spec/support/pry.rb +7 -0
 - data/spec/support/simplecov.rb +17 -0
 - data/spec/support/vcr.rb +17 -0
 - metadata +261 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: b4136c639188f345ff7f134ae43493de19768027
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 60e70fab3d624fc8078fa4229d46f4ef5afc03f9
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: a36b69f5153fcdfc5fff4dc701b126fc137b3459876846e92a9a13232d882edd0f871ee7cf9d7490acaa6211d53bde8ea53b58295dcfe4b5a76bb0de80d4a5bf
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: d65828c98e10527719438daf61ed84dc6cd346aacf80ae5f36f16f271271f3b5eeea04186da7d8f5f2cf5d7255b354600291d796bcdb0c7a8122bcbcf6e7fde5
         
     | 
    
        data/LICENSE
    ADDED
    
    | 
         @@ -0,0 +1,8 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            The Open Government Licence (OGL) Version 3
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Copyright (c) 2019 Environment Agency
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            This source code is licensed under the Open Government Licence v3.0. To view this
         
     | 
| 
      
 6 
     | 
    
         
            +
            licence, visit www.nationalarchives.gov.uk/doc/open-government-licence/version/3
         
     | 
| 
      
 7 
     | 
    
         
            +
            or write to the Information Policy Team, The National Archives, Kew, Richmond,
         
     | 
| 
      
 8 
     | 
    
         
            +
            Surrey, TW9 4DU.
         
     | 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,150 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Defra Ruby Area
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            [](https://travis-ci.com/DEFRA/defra-ruby-area)
         
     | 
| 
      
 4 
     | 
    
         
            +
            [](https://codeclimate.com/github/DEFRA/defra-ruby-area/maintainability)
         
     | 
| 
      
 5 
     | 
    
         
            +
            [](https://codeclimate.com/github/DEFRA/defra-ruby-area/test_coverage)
         
     | 
| 
      
 6 
     | 
    
         
            +
            [](https://hakiri.io/github/DEFRA/defra-ruby-area/master)
         
     | 
| 
      
 7 
     | 
    
         
            +
            [](http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3)
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            This ruby gem provides a means of looking up an Environment Agency Administrative boundary from a GIS Web Feature Service (WFS). Provided with a valid [easting and northing](https://en.wikipedia.org/wiki/Easting_and_northing) it will query the WFS and return the long name for the area if a match is found.
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            ## Installation
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            Add this line to your application's Gemfile
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 16 
     | 
    
         
            +
            gem "defra_ruby_area"
         
     | 
| 
      
 17 
     | 
    
         
            +
            ```
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            And then update your dependencies by calling
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            ```bash
         
     | 
| 
      
 22 
     | 
    
         
            +
            bundle install
         
     | 
| 
      
 23 
     | 
    
         
            +
            ```
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            ## Usage
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            The gem interfaces with two WFS's that provide administrative boundaries; [Environment Agency and Natural England Public Face Areas](https://environment.data.gov.uk/dataset/91d0fb43-209c-477f-91e3-74e756296268) and [Water Management Areas](https://environment.data.gov.uk/dataset/7942e4cf-d465-11e4-ac00-f0def148f590).
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            ### Response object
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            Each WFS is called through a service that responds with a `DefraRuby::Area::Response` object. It has the following attributes
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 34 
     | 
    
         
            +
            response.successful?
         
     | 
| 
      
 35 
     | 
    
         
            +
            response.area
         
     | 
| 
      
 36 
     | 
    
         
            +
            response.error
         
     | 
| 
      
 37 
     | 
    
         
            +
            ```
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            If the call is successful (the query did not error and a match was found) then
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            - `successful?()` will be `true`
         
     | 
| 
      
 42 
     | 
    
         
            +
            - `area` will contain the long name of the matching administrative boundary
         
     | 
| 
      
 43 
     | 
    
         
            +
            - `error` will be `nil`
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
            If the call is unsuccessful (the query errored or no match was found) then
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
            - `successful?()` will be `false`
         
     | 
| 
      
 48 
     | 
    
         
            +
            - `area` will be `nil`
         
     | 
| 
      
 49 
     | 
    
         
            +
            - `error` will contain the error
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
            If its a runtime error, or an error when calling the WFS `error` will contain whatever error was raised.
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
            If its because no match was found `error` will contain an instance of `DefraRuby::Area::NoMatchError`.
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
            ### Environment Agency and Natural England Public Face Areas
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
            This WFS contains public facing administrative boundaries set at 1:10,000 scale. To use it make the following call
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 60 
     | 
    
         
            +
            easting = 408_602.61
         
     | 
| 
      
 61 
     | 
    
         
            +
            northing = 257_535.31
         
     | 
| 
      
 62 
     | 
    
         
            +
            response = DefraRuby::Area::PublicFaceAreaService.run(easting, northing)
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
            puts response.area if response.successful? # West Midlands
         
     | 
| 
      
 65 
     | 
    
         
            +
            ```
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
            ### Water Management Areas
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
            This WFS contains public facing water management administrative boundaries set at 1:10,000 scale. To use it make the following call
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 72 
     | 
    
         
            +
            easting = 408_602.61
         
     | 
| 
      
 73 
     | 
    
         
            +
            northing = 257_535.31
         
     | 
| 
      
 74 
     | 
    
         
            +
            response = DefraRuby::Area::WaterManagementAreaService.run(easting, northing)
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
            puts response.area if response.successful? # Staffordshire Warwickshire and West Midlands
         
     | 
| 
      
 77 
     | 
    
         
            +
            ```
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
            ## Web Feature Services
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
            A [Web Feature Service (WFS)](https://en.m.wikipedia.org/wiki/Web_Feature_Service) is simply a web service that implements the Open Geospatial Consortium Web Feature Service (WFS) Interface Standard.
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
            Calls are made using url query params. For example behind the scenes `DefraRuby::Area::PublicFaceAreaService` is hitting the following URL
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
            `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>408602.61,257535.31</gml:coordinates></gml:Point></Intersects></Filter>)`
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
            As you can see it uses XML within query, and will return the result in XML.
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
            ```xml
         
     | 
| 
      
 90 
     | 
    
         
            +
            <?xml version="1.0" encoding="utf-8" ?>
         
     | 
| 
      
 91 
     | 
    
         
            +
            <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">
         
     | 
| 
      
 92 
     | 
    
         
            +
            <gml:boundedBy>
         
     | 
| 
      
 93 
     | 
    
         
            +
              <gml:Box srsName="EPSG:27700">
         
     | 
| 
      
 94 
     | 
    
         
            +
                <gml:coordinates>0,0,0,0</gml:coordinates>
         
     | 
| 
      
 95 
     | 
    
         
            +
              </gml:Box>
         
     | 
| 
      
 96 
     | 
    
         
            +
            </gml:boundedBy>
         
     | 
| 
      
 97 
     | 
    
         
            +
              <gml:featureMember>
         
     | 
| 
      
 98 
     | 
    
         
            +
                <ms:Administrative_Boundaries_Environment_Agency_and_Natural_England_Public_Face_Areas fid="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 
     | 
    
         
            +
              </gml:featureMember>
         
     | 
| 
      
 105 
     | 
    
         
            +
            </wfs:FeatureCollection>
         
     | 
| 
      
 106 
     | 
    
         
            +
            ```
         
     | 
| 
      
 107 
     | 
    
         
            +
             
     | 
| 
      
 108 
     | 
    
         
            +
            ### Further reading
         
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
      
 110 
     | 
    
         
            +
            Checkout these additional resources we have found helpful in understanding how WFS's work.
         
     | 
| 
      
 111 
     | 
    
         
            +
             
     | 
| 
      
 112 
     | 
    
         
            +
            - [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)
         
     | 
| 
      
 113 
     | 
    
         
            +
            - [Introduction to Web Feature Service](https://geoserver.geo-solutions.it/edu/en/vector_data/wfsintro.html)
         
     | 
| 
      
 114 
     | 
    
         
            +
            - [WFS reference](https://docs.geoserver.org/latest/en/user/services/wfs/reference.html)
         
     | 
| 
      
 115 
     | 
    
         
            +
             
     | 
| 
      
 116 
     | 
    
         
            +
            ### Argh!
         
     | 
| 
      
 117 
     | 
    
         
            +
             
     | 
| 
      
 118 
     | 
    
         
            +
            We don't know if its just a characteristic of WFS's, GIS, or just the EA implementations but things often break in this world.
         
     | 
| 
      
 119 
     | 
    
         
            +
             
     | 
| 
      
 120 
     | 
    
         
            +
            A WFS will often go down, sometimes for maintenance (_hopefully_ on a weekend 😀) sometimes just for 'reasons'.
         
     | 
| 
      
 121 
     | 
    
         
            +
             
     | 
| 
      
 122 
     | 
    
         
            +
            Also though this gem is new, we have worked with these services before and this is approximately the 5th time the format of the query has changed in the space of a 3 years.
         
     | 
| 
      
 123 
     | 
    
         
            +
             
     | 
| 
      
 124 
     | 
    
         
            +
            For example the period of December 2018 to June 2019 both services were completely down whilst we waited for fixes to be implemented, then confirmation of what query would actually work!
         
     | 
| 
      
 125 
     | 
    
         
            +
             
     | 
| 
      
 126 
     | 
    
         
            +
            You may also find any page we have linked to in this README will no longer respond. Again they often seem to move or be taken down.
         
     | 
| 
      
 127 
     | 
    
         
            +
             
     | 
| 
      
 128 
     | 
    
         
            +
            So expect stuff to break, and be prepared to use some detective work to either get it going again, for find where its moved to 😉.
         
     | 
| 
      
 129 
     | 
    
         
            +
             
     | 
| 
      
 130 
     | 
    
         
            +
            ## Contributing to this project
         
     | 
| 
      
 131 
     | 
    
         
            +
             
     | 
| 
      
 132 
     | 
    
         
            +
            If you have an idea you'd like to contribute please log an issue.
         
     | 
| 
      
 133 
     | 
    
         
            +
             
     | 
| 
      
 134 
     | 
    
         
            +
            All contributions should be submitted via a pull request.
         
     | 
| 
      
 135 
     | 
    
         
            +
             
     | 
| 
      
 136 
     | 
    
         
            +
            ## License
         
     | 
| 
      
 137 
     | 
    
         
            +
             
     | 
| 
      
 138 
     | 
    
         
            +
            THIS INFORMATION IS LICENSED UNDER THE CONDITIONS OF THE OPEN GOVERNMENT LICENCE found at:
         
     | 
| 
      
 139 
     | 
    
         
            +
             
     | 
| 
      
 140 
     | 
    
         
            +
            <http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3>
         
     | 
| 
      
 141 
     | 
    
         
            +
             
     | 
| 
      
 142 
     | 
    
         
            +
            The following attribution statement MUST be cited in your products and applications when using this information.
         
     | 
| 
      
 143 
     | 
    
         
            +
             
     | 
| 
      
 144 
     | 
    
         
            +
            > Contains public sector information licensed under the Open Government license v3
         
     | 
| 
      
 145 
     | 
    
         
            +
             
     | 
| 
      
 146 
     | 
    
         
            +
            ### About the license
         
     | 
| 
      
 147 
     | 
    
         
            +
             
     | 
| 
      
 148 
     | 
    
         
            +
            The Open Government Licence (OGL) was developed by the Controller of Her Majesty's Stationery Office (HMSO) to enable information providers in the public sector to license the use and re-use of their information under a common open licence.
         
     | 
| 
      
 149 
     | 
    
         
            +
             
     | 
| 
      
 150 
     | 
    
         
            +
            It is designed to encourage use and re-use of information freely and flexibly, with only a few conditions.
         
     | 
    
        data/Rakefile
    ADDED
    
    | 
         @@ -0,0 +1,33 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            begin
         
     | 
| 
      
 4 
     | 
    
         
            +
              require "bundler/setup"
         
     | 
| 
      
 5 
     | 
    
         
            +
            rescue LoadError
         
     | 
| 
      
 6 
     | 
    
         
            +
              puts "You must `gem install bundler` and `bundle install` to run rake tasks"
         
     | 
| 
      
 7 
     | 
    
         
            +
            end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            Bundler::GemHelper.install_tasks
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            # This is wrapped to prevent an error when rake is called in environments where
         
     | 
| 
      
 12 
     | 
    
         
            +
            # rspec may not be available, e.g. production. As such we don't need to handle
         
     | 
| 
      
 13 
     | 
    
         
            +
            # the error.
         
     | 
| 
      
 14 
     | 
    
         
            +
            # rubocop:disable Lint/HandleExceptions
         
     | 
| 
      
 15 
     | 
    
         
            +
            begin
         
     | 
| 
      
 16 
     | 
    
         
            +
              require "rspec/core/rake_task"
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
              RSpec::Core::RakeTask.new(:spec)
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              task default: :spec
         
     | 
| 
      
 21 
     | 
    
         
            +
            rescue LoadError
         
     | 
| 
      
 22 
     | 
    
         
            +
              # no rspec available
         
     | 
| 
      
 23 
     | 
    
         
            +
            end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            begin
         
     | 
| 
      
 26 
     | 
    
         
            +
              require "github_changelog_generator/task"
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
              GitHubChangelogGenerator::RakeTask.new :changelog do |config|
         
     | 
| 
      
 29 
     | 
    
         
            +
              end
         
     | 
| 
      
 30 
     | 
    
         
            +
            rescue LoadError
         
     | 
| 
      
 31 
     | 
    
         
            +
              # no changelog available
         
     | 
| 
      
 32 
     | 
    
         
            +
            end
         
     | 
| 
      
 33 
     | 
    
         
            +
            # rubocop:enable Lint/HandleExceptions
         
     | 
    
        data/bin/console
    ADDED
    
    | 
         @@ -0,0 +1,14 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "bundler/setup"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "defra/ruby/area"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            # You can add fixtures and/or initialization code here to make experimenting
         
     | 
| 
      
 7 
     | 
    
         
            +
            # with your gem easier. You can also use a different console, if you like.
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            # (If you use this, don't forget to add pry to your Gemfile!)
         
     | 
| 
      
 10 
     | 
    
         
            +
            # require "pry"
         
     | 
| 
      
 11 
     | 
    
         
            +
            # Pry.start
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            require "irb"
         
     | 
| 
      
 14 
     | 
    
         
            +
            IRB.start(__FILE__)
         
     | 
    
        data/bin/setup
    ADDED
    
    
    
        data/lib/defra_ruby.rb
    ADDED
    
    
| 
         @@ -0,0 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require_relative "area/no_match_error"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require_relative "area/response"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            require_relative "area/services/base_area_service"
         
     | 
| 
      
 7 
     | 
    
         
            +
            require_relative "area/services/public_face_area_service"
         
     | 
| 
      
 8 
     | 
    
         
            +
            require_relative "area/services/water_management_area_service"
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            module DefraRuby
         
     | 
| 
      
 11 
     | 
    
         
            +
              module Area
         
     | 
| 
      
 12 
     | 
    
         
            +
              end
         
     | 
| 
      
 13 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,33 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module DefraRuby
         
     | 
| 
      
 4 
     | 
    
         
            +
              module Area
         
     | 
| 
      
 5 
     | 
    
         
            +
                class Response
         
     | 
| 
      
 6 
     | 
    
         
            +
                  attr_reader :error
         
     | 
| 
      
 7 
     | 
    
         
            +
                  attr_reader :area
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                  def initialize(response_exe)
         
     | 
| 
      
 10 
     | 
    
         
            +
                    @success = true
         
     | 
| 
      
 11 
     | 
    
         
            +
                    @area = nil
         
     | 
| 
      
 12 
     | 
    
         
            +
                    @error = nil
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                    capture_response(response_exe)
         
     | 
| 
      
 15 
     | 
    
         
            +
                  end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                  def successful?
         
     | 
| 
      
 18 
     | 
    
         
            +
                    success
         
     | 
| 
      
 19 
     | 
    
         
            +
                  end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                  private
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                  attr_reader :success
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                  def capture_response(response_exe)
         
     | 
| 
      
 26 
     | 
    
         
            +
                    @area = response_exe.call[:area]
         
     | 
| 
      
 27 
     | 
    
         
            +
                  rescue StandardError => e
         
     | 
| 
      
 28 
     | 
    
         
            +
                    @error = e
         
     | 
| 
      
 29 
     | 
    
         
            +
                    @success = false
         
     | 
| 
      
 30 
     | 
    
         
            +
                  end
         
     | 
| 
      
 31 
     | 
    
         
            +
                end
         
     | 
| 
      
 32 
     | 
    
         
            +
              end
         
     | 
| 
      
 33 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,58 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "nokogiri"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "rest-client"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            module DefraRuby
         
     | 
| 
      
 7 
     | 
    
         
            +
              module Area
         
     | 
| 
      
 8 
     | 
    
         
            +
                class BaseAreaService
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  def self.run(easting, northing)
         
     | 
| 
      
 11 
     | 
    
         
            +
                    new(easting, northing).run
         
     | 
| 
      
 12 
     | 
    
         
            +
                  end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                  def initialize(easting, northing)
         
     | 
| 
      
 15 
     | 
    
         
            +
                    @easting = easting
         
     | 
| 
      
 16 
     | 
    
         
            +
                    @northing = northing
         
     | 
| 
      
 17 
     | 
    
         
            +
                  end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                  def run
         
     | 
| 
      
 20 
     | 
    
         
            +
                    Response.new(response_exe)
         
     | 
| 
      
 21 
     | 
    
         
            +
                  end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                  private
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                  attr_reader :easting, :northing
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                  def response_exe
         
     | 
| 
      
 28 
     | 
    
         
            +
                    lambda do
         
     | 
| 
      
 29 
     | 
    
         
            +
                      begin
         
     | 
| 
      
 30 
     | 
    
         
            +
                        response = RestClient::Request.execute(method: :get, url: url)
         
     | 
| 
      
 31 
     | 
    
         
            +
                        area = parse_xml(response)
         
     | 
| 
      
 32 
     | 
    
         
            +
                        raise NoMatchError if area.nil? || area == ""
         
     | 
| 
      
 33 
     | 
    
         
            +
                      rescue StandardError => e
         
     | 
| 
      
 34 
     | 
    
         
            +
                        raise e
         
     | 
| 
      
 35 
     | 
    
         
            +
                      end
         
     | 
| 
      
 36 
     | 
    
         
            +
                      { area: area }
         
     | 
| 
      
 37 
     | 
    
         
            +
                    end
         
     | 
| 
      
 38 
     | 
    
         
            +
                  end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                  def parse_xml(response)
         
     | 
| 
      
 41 
     | 
    
         
            +
                    xml = Nokogiri::XML(response)
         
     | 
| 
      
 42 
     | 
    
         
            +
                    xml.xpath(response_xml_path).text
         
     | 
| 
      
 43 
     | 
    
         
            +
                  end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                  def url
         
     | 
| 
      
 46 
     | 
    
         
            +
                    implemented_in_subclass
         
     | 
| 
      
 47 
     | 
    
         
            +
                  end
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                  def response_xml_path
         
     | 
| 
      
 50 
     | 
    
         
            +
                    implemented_in_subclass
         
     | 
| 
      
 51 
     | 
    
         
            +
                  end
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
                  def implemented_in_subclass
         
     | 
| 
      
 54 
     | 
    
         
            +
                    raise NotImplementedError, "This #{self.class} cannot respond to:"
         
     | 
| 
      
 55 
     | 
    
         
            +
                  end
         
     | 
| 
      
 56 
     | 
    
         
            +
                end
         
     | 
| 
      
 57 
     | 
    
         
            +
              end
         
     | 
| 
      
 58 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,25 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "nokogiri"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "rest-client"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            module DefraRuby
         
     | 
| 
      
 7 
     | 
    
         
            +
              module Area
         
     | 
| 
      
 8 
     | 
    
         
            +
                class PublicFaceAreaService < BaseAreaService
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  private
         
     | 
| 
      
 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"
         
     | 
| 
      
 15 
     | 
    
         
            +
                  end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 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
         
     | 
| 
      
 21 
     | 
    
         
            +
                  end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,25 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "nokogiri"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "rest-client"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            module DefraRuby
         
     | 
| 
      
 7 
     | 
    
         
            +
              module Area
         
     | 
| 
      
 8 
     | 
    
         
            +
                class WaterManagementAreaService < BaseAreaService
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  private
         
     | 
| 
      
 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"
         
     | 
| 
      
 15 
     | 
    
         
            +
                  end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 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
         
     | 
| 
      
 21 
     | 
    
         
            +
                  end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,157 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            http_interactions:
         
     | 
| 
      
 3 
     | 
    
         
            +
            - request:
         
     | 
| 
      
 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
         
     | 
| 
      
 6 
     | 
    
         
            +
                body:
         
     | 
| 
      
 7 
     | 
    
         
            +
                  encoding: US-ASCII
         
     | 
| 
      
 8 
     | 
    
         
            +
                  string: ''
         
     | 
| 
      
 9 
     | 
    
         
            +
                headers:
         
     | 
| 
      
 10 
     | 
    
         
            +
                  Accept:
         
     | 
| 
      
 11 
     | 
    
         
            +
                  - "*/*"
         
     | 
| 
      
 12 
     | 
    
         
            +
                  Accept-Encoding:
         
     | 
| 
      
 13 
     | 
    
         
            +
                  - gzip, deflate
         
     | 
| 
      
 14 
     | 
    
         
            +
                  User-Agent:
         
     | 
| 
      
 15 
     | 
    
         
            +
                  - rest-client/2.0.2 (darwin18.5.0 x86_64) ruby/2.4.2p198
         
     | 
| 
      
 16 
     | 
    
         
            +
                  Host:
         
     | 
| 
      
 17 
     | 
    
         
            +
                  - environment.data.gov.uk
         
     | 
| 
      
 18 
     | 
    
         
            +
              response:
         
     | 
| 
      
 19 
     | 
    
         
            +
                status:
         
     | 
| 
      
 20 
     | 
    
         
            +
                  code: 200
         
     | 
| 
      
 21 
     | 
    
         
            +
                  message: OK
         
     | 
| 
      
 22 
     | 
    
         
            +
                headers:
         
     | 
| 
      
 23 
     | 
    
         
            +
                  Server:
         
     | 
| 
      
 24 
     | 
    
         
            +
                  - nginx
         
     | 
| 
      
 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 
     | 
    
         
            +
                  - Sat, 03 Aug 2019 10:48:37 GMT
         
     | 
| 
      
 135 
     | 
    
         
            +
                  Content-Type:
         
     | 
| 
      
 136 
     | 
    
         
            +
                  - application/xml
         
     | 
| 
      
 137 
     | 
    
         
            +
                  Content-Length:
         
     | 
| 
      
 138 
     | 
    
         
            +
                  - '349'
         
     | 
| 
      
 139 
     | 
    
         
            +
                  Connection:
         
     | 
| 
      
 140 
     | 
    
         
            +
                  - keep-alive
         
     | 
| 
      
 141 
     | 
    
         
            +
                  Cache-Control:
         
     | 
| 
      
 142 
     | 
    
         
            +
                  - private
         
     | 
| 
      
 143 
     | 
    
         
            +
                  X-Aspnet-Version:
         
     | 
| 
      
 144 
     | 
    
         
            +
                  - 4.0.30319
         
     | 
| 
      
 145 
     | 
    
         
            +
                  X-Powered-By:
         
     | 
| 
      
 146 
     | 
    
         
            +
                  - ASP.NET
         
     | 
| 
      
 147 
     | 
    
         
            +
                body:
         
     | 
| 
      
 148 
     | 
    
         
            +
                  encoding: UTF-8
         
     | 
| 
      
 149 
     | 
    
         
            +
                  string: |
         
     | 
| 
      
 150 
     | 
    
         
            +
                    <?xml version="1.0" encoding="utf-8" ?>
         
     | 
| 
      
 151 
     | 
    
         
            +
                    <ogc:ServiceExceptionReport xmlns:ogc="http://www.opengis.net/ogc" version="1.2.0">
         
     | 
| 
      
 152 
     | 
    
         
            +
                      <ogc:ServiceException><![CDATA[The geometry was not recognized.]]></ogc:ServiceException>
         
     | 
| 
      
 153 
     | 
    
         
            +
                      <ogc:ServiceException><![CDATA[Operator 'Intersects' can't parse geometry.]]></ogc:ServiceException>
         
     | 
| 
      
 154 
     | 
    
         
            +
                    </ogc:ServiceExceptionReport>
         
     | 
| 
      
 155 
     | 
    
         
            +
                http_version: 
         
     | 
| 
      
 156 
     | 
    
         
            +
              recorded_at: Sat, 03 Aug 2019 10:48:37 GMT
         
     | 
| 
      
 157 
     | 
    
         
            +
            recorded_with: VCR 4.0.0
         
     |