From 6fea0abeb9e3d37d622e874abb1cacaea97b7751 Mon Sep 17 00:00:00 2001 From: Nick Budak Date: Thu, 8 Feb 2024 13:42:17 -0800 Subject: [PATCH] Add WFS url to references for GeoJSON content in Earthworks See https://github.com/sul-dlss/gis-robot-suite/issues/657 --- lib/traject/config/geo_config.rb | 2 +- spec/fixtures/files/jk681br3989.xml | 170 ++++++++++++++++++++++++++++ spec/integration/geo_config_spec.rb | 8 ++ 3 files changed, 179 insertions(+), 1 deletion(-) create mode 100644 spec/fixtures/files/jk681br3989.xml diff --git a/lib/traject/config/geo_config.rb b/lib/traject/config/geo_config.rb index 2bc9fda1d..1a6ea480a 100644 --- a/lib/traject/config/geo_config.rb +++ b/lib/traject/config/geo_config.rb @@ -335,7 +335,7 @@ def geoserver_url(record) } ) - if formats.include?('Shapefile') + if formats.include?('Shapefile') || formats.include?('GeoJSON') references.merge!( { 'http://www.opengis.net/def/serviceType/ogc/wfs' => "#{geoserver_url(record)}/wfs", diff --git a/spec/fixtures/files/jk681br3989.xml b/spec/fixtures/files/jk681br3989.xml new file mode 100644 index 000000000..c9e66bb86 --- /dev/null +++ b/spec/fixtures/files/jk681br3989.xml @@ -0,0 +1,170 @@ + + + + item + Clowns of America, International Membership Point GeoJSON (anonymized) + gis-integration-test:hoopoe-yzqmkn + + + + + + 05f6541c63011a4393a115431657dcbde6a1cdde + 1f332db07b58e5a94274fcb322255c43 + + + 45850f75f832d6c76faf108d8e10295e0d4c9717 + 8e7aaa51685cfceb5fa7d9b3bd04c2d4 + + + + + + ae5a8426ffeb2f19dbc0ac1c4b15fbb7c4c5a23b + 471d3c592c9199d41b57c09edaa9fef1 + + + + + + + + + + + + + + + + + + + + + + + Clowns of America, International Membership Point GeoJSON (anonymized) + Maples, Stacey D. + Geospatial data + cartographic dataset + GeoJSON + eng + This point GeoJSON was created from the Clowns of America International Membership Database (anonymized) obtained in 2007 from Clowns of America, International, for use in teaching. It was created by geocoding the ZipCode field of the original table, using OpenRefine and the Geonames.org PostalCodes API. Attributes include those from the original data table ("City", "ZipCode", "Clown_Name", and "Country"), as well attributes added during the geocoding process ("admname1","adm1","adm2","placname","longitude","latitude") and an attribute "Clown-Na_1" which represents the values in the "Clown_Name" attribute field after a "Cluster and Edit" operation, performed in OpenRefine to collapse values so that "Co Co" or "Co-Co" both are clustered and edited to become "CoCo" for use in name frequency analysis. This layer is intended to be used for teaching and instruction at Stanford"s Geospatial Center.  + This layer is presented in the WGS84 coordinate system for web display purposes. Downloadable data are provided in native coordinate system or projection. + Clowns + + United States + + 2007 + Location + + Scale not given. + Custom projection + W 158°1ʹ3ʺ--W 65°35ʹ41ʺ/N 64°51ʹ16ʺ--N 18°7ʺ + + EPSG::4326 + 2007 + https://purl.stanford.edu/jk681br3989 + User agrees that, where applicable, content will not be used to identify or to otherwise infringe the privacy or confidentiality rights of individuals. Content distributed via the Stanford Digital Repository may be subject to additional license and use restrictions applied by the depositor. + + Integration Test Collection - GIS + + + + Clowns of America, International Membership Point GeoJSON (anonymized) + + + Maples, Stacey D. + + creator + + + Geospatial data + cartographic dataset + cartographic + software, multimedia + +
GeoJSON
+ born digital +
+ + eng + + This point GeoJSON was created from the Clowns of America International Membership Database (anonymized) obtained in 2007 from Clowns of America, International, for use in teaching. It was created by geocoding the ZipCode field of the original table, using OpenRefine and the Geonames.org PostalCodes API. Attributes include those from the original data table ("City", "ZipCode", "Clown_Name", and "Country"), as well attributes added during the geocoding process ("admname1","adm1","adm2","placname","longitude","latitude") and an attribute "Clown-Na_1" which represents the values in the "Clown_Name" attribute field after a "Cluster and Edit" operation, performed in OpenRefine to collapse values so that "Co Co" or "Co-Co" both are clustered and edited to become "CoCo" for use in name frequency analysis. This layer is intended to be used for teaching and instruction at Stanford"s Geospatial Center.  + This layer is presented in the WGS84 coordinate system for web display purposes. Downloadable data are provided in native coordinate system or projection. + + Clowns + + + United States + + + 2007 + + + Location + + + + Scale not given. + Custom projection + W 158°1ʹ3ʺ--W 65°35ʹ41ʺ/N 64°51ʹ16ʺ--N 18°7ʺ + + + + + EPSG::4326 + + + + 2007 + + US + + + + https://purl.stanford.edu/jk681br3989 + + + + eng + + Stanford + This record was translated from ISO 19139 to MODS v.3 using an xsl transformation. + edu.stanford.purl:vx812cc5548 + + + + https://purl.stanford.edu/vx812cc5548 + + + + + + application/geo+json; format=GeoJSON + Dataset#Point + + + -158.017379 18.001995 + -65.594769 64.85437 + + + + + + + + + Integration Test Collection - GIS + + + https://sul-purl-stage.stanford.edu/jn518bx4248 + + + +
+ + true + +
diff --git a/spec/integration/geo_config_spec.rb b/spec/integration/geo_config_spec.rb index c462b22b3..77b1f528e 100644 --- a/spec/integration/geo_config_spec.rb +++ b/spec/integration/geo_config_spec.rb @@ -269,6 +269,14 @@ def stub_mods_request(druid, body) end end + describe 'geoJSON objects' do + let(:druid) { 'jk681br3989' } + + it 'includes the WFS url in the references' do + expect(JSON.parse(result['dct_references_s'].first)).to include 'http://www.opengis.net/def/serviceType/ogc/wfs' => 'https://geowebservices.stanford.edu/geoserver/wfs' + end + end + describe 'coordinate envelopes' do let(:druid) { 'qy240vt8937' }