geo_combine 0.9.2 → 0.11.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 +4 -4
- data/.github/dependabot.yml +11 -0
- data/.github/workflows/ruby.yml +7 -7
- data/.gitignore +1 -0
- data/.rubocop.yml +2 -0
- data/.rubocop_todo.yml +1 -1
- data/Gemfile +2 -1
- data/README.md +127 -77
- data/geo_combine.gemspec +2 -2
- data/lib/.DS_Store +0 -0
- data/lib/geo_combine/bounding_box.rb +0 -4
- data/lib/geo_combine/ckan_metadata.rb +1 -1
- data/lib/geo_combine/esri_open_data.rb +1 -0
- data/lib/geo_combine/geoblacklight.rb +30 -9
- data/lib/geo_combine/harvester.rb +40 -24
- data/lib/geo_combine/indexer.rb +10 -2
- data/lib/geo_combine/ogp.rb +11 -10
- data/lib/geo_combine/version.rb +1 -1
- data/lib/tasks/geo_combine.rake +10 -4
- data/lib/xslt/isoAardvark.xsl +738 -0
- data/spec/features/fgdc2html_spec.rb +1 -0
- data/spec/features/iso2html_spec.rb +1 -0
- data/spec/fixtures/indexing/restricted_aardvark.json +34 -0
- data/spec/fixtures/indexing/restricted_geoblacklight.json +42 -0
- data/spec/lib/geo_combine/ckan_metadata_spec.rb +1 -0
- data/spec/lib/geo_combine/esri_open_data_spec.rb +1 -0
- data/spec/lib/geo_combine/fgdc_spec.rb +3 -2
- data/spec/lib/geo_combine/geoblacklight_spec.rb +21 -20
- data/spec/lib/geo_combine/harvester_spec.rb +79 -15
- data/spec/lib/geo_combine/iso19139_spec.rb +1 -0
- metadata +18 -14
data/lib/geo_combine/indexer.rb
CHANGED
|
@@ -10,12 +10,19 @@ module GeoCombine
|
|
|
10
10
|
class Indexer
|
|
11
11
|
attr_reader :solr
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
# Initialize a new indexer
|
|
14
|
+
# @param solr [RSolr::Client] an existing RSolr client
|
|
15
|
+
# @param solr_url [String] the URL of the Solr instance to connect to
|
|
16
|
+
# @param logger [Logger] a logger instance for logging messages
|
|
17
|
+
def initialize(
|
|
18
|
+
solr: nil,
|
|
19
|
+
solr_url: ENV.fetch('SOLR_URL', nil),
|
|
20
|
+
logger: GeoCombine::Logger.logger
|
|
21
|
+
)
|
|
14
22
|
@logger = logger
|
|
15
23
|
@batch_size = ENV.fetch('SOLR_BATCH_SIZE', 100).to_i
|
|
16
24
|
|
|
17
25
|
# If SOLR_URL is set, use it; if in a Geoblacklight app, use its solr core
|
|
18
|
-
solr_url = ENV.fetch('SOLR_URL', nil)
|
|
19
26
|
solr_url ||= Blacklight.default_index.connection.base_uri.to_s if defined? Blacklight
|
|
20
27
|
|
|
21
28
|
# If neither, warn and try to use local Blacklight default solr core
|
|
@@ -24,6 +31,7 @@ module GeoCombine
|
|
|
24
31
|
solr_url = 'http://localhost:8983/solr/blacklight-core'
|
|
25
32
|
end
|
|
26
33
|
|
|
34
|
+
# If solr connection was provided directly, use it; otherwise connect now
|
|
27
35
|
@solr = solr || RSolr.connect(client, url: solr_url)
|
|
28
36
|
end
|
|
29
37
|
|
data/lib/geo_combine/ogp.rb
CHANGED
|
@@ -8,6 +8,7 @@ module GeoCombine
|
|
|
8
8
|
class OGP
|
|
9
9
|
class InvalidMetadata < RuntimeError; end
|
|
10
10
|
include GeoCombine::Formatting
|
|
11
|
+
|
|
11
12
|
attr_reader :metadata
|
|
12
13
|
|
|
13
14
|
##
|
|
@@ -123,7 +124,7 @@ module GeoCombine
|
|
|
123
124
|
# Builds a Solr Envelope using CQL syntax
|
|
124
125
|
# @return [String]
|
|
125
126
|
def envelope
|
|
126
|
-
raise ArgumentError unless west
|
|
127
|
+
raise ArgumentError unless west.between?(-180, 180) &&
|
|
127
128
|
east >= -180 && east <= 180 &&
|
|
128
129
|
north >= -90 && north <= 90 &&
|
|
129
130
|
south >= -90 && south <= 90 &&
|
|
@@ -144,6 +145,15 @@ module GeoCombine
|
|
|
144
145
|
GeoCombine::Fgdc.new(metadata['FgdcText']) if metadata['FgdcText']
|
|
145
146
|
end
|
|
146
147
|
|
|
148
|
+
SLUG_STRIP_VALUES = %w[
|
|
149
|
+
SDE_DATA.
|
|
150
|
+
SDE.
|
|
151
|
+
SDE2.
|
|
152
|
+
GISPORTAL.GISOWNER01.
|
|
153
|
+
GISDATA.
|
|
154
|
+
MORIS.
|
|
155
|
+
].freeze
|
|
156
|
+
|
|
147
157
|
private
|
|
148
158
|
|
|
149
159
|
##
|
|
@@ -207,15 +217,6 @@ module GeoCombine
|
|
|
207
217
|
sluggify(filter_name(name))
|
|
208
218
|
end
|
|
209
219
|
|
|
210
|
-
SLUG_STRIP_VALUES = %w[
|
|
211
|
-
SDE_DATA.
|
|
212
|
-
SDE.
|
|
213
|
-
SDE2.
|
|
214
|
-
GISPORTAL.GISOWNER01.
|
|
215
|
-
GISDATA.
|
|
216
|
-
MORIS.
|
|
217
|
-
].freeze
|
|
218
|
-
|
|
219
220
|
def filter_name(name)
|
|
220
221
|
# strip out schema and usernames
|
|
221
222
|
SLUG_STRIP_VALUES.each do |strip_val|
|
data/lib/geo_combine/version.rb
CHANGED
data/lib/tasks/geo_combine.rake
CHANGED
|
@@ -11,20 +11,26 @@ require 'geo_combine/geo_blacklight_harvester'
|
|
|
11
11
|
namespace :geocombine do
|
|
12
12
|
desc 'Clone OpenGeoMetadata repositories'
|
|
13
13
|
task :clone, [:repo] do |_t, args|
|
|
14
|
-
|
|
14
|
+
ogm_path = ENV.fetch('OGM_PATH', 'tmp/opengeometadata')
|
|
15
|
+
|
|
16
|
+
harvester = GeoCombine::Harvester.new(ogm_path: ogm_path)
|
|
15
17
|
args[:repo] ? harvester.clone(args.repo) : harvester.clone_all
|
|
16
18
|
end
|
|
17
19
|
|
|
18
20
|
desc '"git pull" OpenGeoMetadata repositories'
|
|
19
21
|
task :pull, [:repo] do |_t, args|
|
|
20
|
-
|
|
22
|
+
ogm_path = ENV.fetch('OGM_PATH', 'tmp/opengeometadata')
|
|
23
|
+
|
|
24
|
+
harvester = GeoCombine::Harvester.new(ogm_path: ogm_path)
|
|
21
25
|
args[:repo] ? harvester.pull(args.repo) : harvester.pull_all
|
|
22
26
|
end
|
|
23
27
|
|
|
24
28
|
desc 'Index all JSON documents except Layers.json'
|
|
25
|
-
task :index do
|
|
26
|
-
|
|
29
|
+
task :index, [:ogm_path] => [:environment] do |_t, args|
|
|
30
|
+
ogm_path = args.ogm_path || ENV.fetch('OGM_PATH', 'tmp/opengeometadata')
|
|
31
|
+
|
|
27
32
|
indexer = GeoCombine::Indexer.new
|
|
33
|
+
harvester = GeoCombine::Harvester.new(ogm_path: ogm_path)
|
|
28
34
|
indexer.index(harvester.docs_to_index)
|
|
29
35
|
end
|
|
30
36
|
|