You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A Ruby toolkit for managing geospatial metadata, including:
8
8
9
-
- tasks for cloning, updating, and indexing OpenGeoMetadata metadata
10
-
- library for converting metadata between standards
9
+
- harvesting and indexing records from OpenGeoMetadata
10
+
- harvesting records directly from a GeoBlacklight instance
11
+
- converting geospatial metadata records between standards
11
12
12
13
## Installation
13
14
15
+
> [!TIP]
16
+
> If you're using GeoBlacklight, GeoCombine is already bundled with your installation – you can skip this section.
17
+
14
18
Add this line to your application's `Gemfile`:
15
19
16
20
```ruby
@@ -20,175 +24,131 @@ gem 'geo_combine'
20
24
And then execute:
21
25
22
26
```sh
23
-
$ bundle install
27
+
bundle install
24
28
```
25
29
26
30
Or install it yourself as:
27
31
28
32
```sh
29
-
$ gem install geo_combine
33
+
gem install geo_combine
30
34
```
31
35
32
36
## Usage
33
37
34
-
### Converting metadata
35
-
36
-
#### Converting metadata into GeoBlacklight JSON
37
-
38
-
GeoCombine provides several classes representing different metadata standards that implement the `#to_geoblacklight` method for generating records in the [GeoBlacklight JSON format](https://opengeometadata.org/reference/):
39
-
40
-
```ruby
41
-
GeoCombine::Iso19139# ISO 19139 XML
42
-
GeoCombine::OGP# OpenGeoPortal JSON
43
-
GeoCombine::Fgdc# FGDC XML
44
-
GeoCombine::EsriOpenData# Esri Open Data Portal JSON
45
-
GeoCombine::CkanMetadata# CKAN JSON
46
-
```
47
-
48
-
An example for converting an ISO 19139 XML record:
You can use the `GeoCombine::Migrators` to migrate metadata from one schema to another.
74
-
75
-
Currently, the only migrator is `GeoCombine::Migrators::V1AardvarkMigrator` which migrates from the [GeoBlacklight v1 schema](https://github.com/OpenGeoMetadata/opengeometadata.github.io/blob/main/docs/gbl-1.0.md) to the [Aardvark schema](https://github.com/OpenGeoMetadata/opengeometadata.github.io/blob/main/docs/ogm-aardvark.md)
76
-
77
-
```ruby
78
-
# Load a record in geoblacklight v1 schema
79
-
record =JSON.parse(File.read('.spec/fixtures/docs/full_geoblacklight.json'))
Some fields cannot be migrated automatically. To handle the migration of collection names to IDs when migrating from v1 to Aardvark, you can provide a mapping of collection names to IDs to the migrator:
86
-
87
-
```ruby
88
-
# You can store this mapping as a JSON or CSV file and load it into a hash
Some of the tools and scripts in this gem use Ruby's `Logger` class to print information to `$stderr`. By default, the log level is set to `Logger::INFO`. For more verbose information, you can set the `LOG_LEVEL` environment variable to `DEBUG`:
42
+
By default, GeoCombine will only fetch and index records using the current schema version. If you instead want to index records using an older schema (e.g. because your GeoBlacklight instance is an older version), you can set the `SCHEMA_VERSION` environment variable:
102
43
103
44
```sh
104
-
$ export LOG_LEVEL=DEBUG
45
+
# Only fetch and index schema version 1.0 records
46
+
export SCHEMA_VERSION=1.0
105
47
```
106
48
107
-
#### Schema version
49
+
#### Restricted records
108
50
109
-
By default, GeoCombine will only fetch and index records using the current schema version. If you instead want to index records using an older schema (e.g. because your GeoBlacklight instance is an older version), you can set the `SCHEMA_VERSION` environment variable:
51
+
By default, GeoCombine will only fetch and index records that are not marked as restricted. If you want to include restricted records, you can set the `OGM_SKIP_RESTRICTED` environment variable to `false`:
110
52
111
53
```sh
112
-
# Only fetch and index schema version 1.0 records
113
-
$ export SCHEMA_VERSION=1.0
54
+
export OGM_SKIP_RESTRICTED=false
114
55
```
115
56
116
57
#### Clone OpenGeoMetadata repositories locally
117
58
118
59
```sh
119
-
$ bundle exec rake geocombine:clone
60
+
bundle exec rake geocombine:clone
120
61
```
121
62
122
63
Will clone all OpenGeoMetadata repositories containing metadata matching the `SCHEMA_VERSION` into `./tmp/opengeometadata`. Location of the OpenGeoMetadata repositories can be configured using the `OGM_PATH` environment variable.
> If you're using GeoBlacklight, GeoCombine will automatically detect the path to your Solr index if you run it in the directory where GeoBlacklight is installed.
105
+
162
106
To index into Solr, GeoCombine requires a Solr instance that is running the
If Blacklight is installed in the ruby environment and a solr index is configured, the rake task will use the solr index configured in the Blacklight application (this is the case when invoking GeoCombine from your GeoBlacklight installation). If Blacklight is unavailable, the rake task will try to find a Solr instance running at `http://localhost:8983/solr/blacklight-core`.
170
114
171
115
You can also set the Solr instance URL using `SOLR_URL`:
Some of the tools and scripts in this gem use Ruby's `Logger` class to print information to `$stderr`. By default, the log level is set to `Logger::INFO`. For more verbose information, you can set the `LOG_LEVEL` environment variable to `DEBUG`:
124
+
125
+
```sh
126
+
export LOG_LEVEL=DEBUG
175
127
```
176
128
177
129
### Indexing local documents
178
130
179
-
To index an arbitrary collection of records in a custom directory, run one of the following:
131
+
To index a collection of records in a local directory, you can pass the directory as a `rake` argument:
@@ -253,12 +213,75 @@ GeoCombine::GeoBlacklightIndexer.document_transformer = -> (document) do
253
213
end
254
214
```
255
215
216
+
### Converting metadata
217
+
218
+
#### Converting metadata into GeoBlacklight JSON
219
+
220
+
GeoCombine provides several classes representing different metadata standards that implement the `#to_geoblacklight` method for generating records in the [GeoBlacklight JSON format](https://opengeometadata.org/reference/):
221
+
222
+
```ruby
223
+
GeoCombine::Iso19139# ISO 19139 XML
224
+
GeoCombine::OGP# OpenGeoPortal JSON
225
+
GeoCombine::Fgdc# FGDC XML
226
+
GeoCombine::EsriOpenData# Esri Open Data Portal JSON
227
+
GeoCombine::CkanMetadata# CKAN JSON
228
+
```
229
+
230
+
An example for converting an ISO 19139 XML record:
You can use the `GeoCombine::Migrators` to migrate metadata from one schema to another.
256
+
257
+
Currently, the only migrator is `GeoCombine::Migrators::V1AardvarkMigrator` which migrates from the [GeoBlacklight v1 schema](https://github.com/OpenGeoMetadata/opengeometadata.github.io/blob/main/docs/gbl-1.0.md) to the [Aardvark schema](https://github.com/OpenGeoMetadata/opengeometadata.github.io/blob/main/docs/ogm-aardvark.md)
258
+
259
+
```ruby
260
+
# Load a record in geoblacklight v1 schema
261
+
record =JSON.parse(File.read('.spec/fixtures/docs/full_geoblacklight.json'))
Some fields cannot be migrated automatically. To handle the migration of collection names to IDs when migrating from v1 to Aardvark, you can provide a mapping of collection names to IDs to the migrator:
268
+
269
+
```ruby
270
+
# You can store this mapping as a JSON or CSV file and load it into a hash
0 commit comments