cartograss 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -5
- data/lib/cartograss.rb +10 -6
- data/lib/cartograss/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7f4fcd310a9a7faa6110747fa65497f93abb03b
|
4
|
+
data.tar.gz: 38d72353181192e2e8cc24f4f4f80a024556d079
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da04fab40d67cd08a1042ebfd2634bf05a77887e05dd57dee3840474b3eeb30020ef76c06c7a31eeed8e3e233e068c467d1e3bdbd3e0b8dad1a199a95715cbd8
|
7
|
+
data.tar.gz: cc3e00b51ef2fcf770d60b9ec34e6b85714e8cc41ded3a6fb2a0605326247042245e981f521703b4f47b31d39cae21882036bbcf483681e2512560c84cdff5d1
|
data/README.md
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/cartograss.svg)](http://badge.fury.io/rb/cartograss)
|
4
4
|
|
5
|
-
Import and Export [CARTO](http://carto.com) datasets as GRASS GIS maps
|
5
|
+
Import and Export [CARTO](http://carto.com) datasets as [GRASS GIS](https://grass.osgeo.org/) maps,
|
6
|
+
using the [GrassGis](https://github.com/jgoizueta/grassgis) Ruby Gem.
|
6
7
|
|
7
8
|
Works with GRASS 7.x and only with vector geometry.
|
8
9
|
|
@@ -24,8 +25,9 @@ Or install it yourself as:
|
|
24
25
|
|
25
26
|
## Usage
|
26
27
|
|
27
|
-
You'll need a [CARTO engine](https://carto.com/engine/) account
|
28
|
-
(that is, one with an authorized API KEY).
|
28
|
+
You'll need a [CARTO engine](https://carto.com/engine/) account
|
29
|
+
(that is, one with an authorized API KEY). The api key will actually needed to export data to CARTO
|
30
|
+
or import from private CARTO datasets.
|
29
31
|
|
30
32
|
This example fetches some data from your CARTO account, then processes it in GRASS and
|
31
33
|
sends the results back to CARTO so they can be visualized in web maps.
|
@@ -58,7 +60,6 @@ GrassGis.session grass_config do
|
|
58
60
|
dataset: 'mydataset'
|
59
61
|
)
|
60
62
|
end
|
61
|
-
|
62
63
|
```
|
63
64
|
|
64
65
|
## Development
|
@@ -69,7 +70,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
69
70
|
|
70
71
|
## Contributing
|
71
72
|
|
72
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
73
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/jgoizueta/cartograss. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
73
74
|
|
74
75
|
|
75
76
|
## License
|
data/lib/cartograss.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require "cartograss/version"
|
2
2
|
|
3
3
|
module CartoGrass
|
4
|
-
def carto_import(user:, dataset:, api_key:)
|
4
|
+
def carto_import(user:, dataset:, api_key: nil)
|
5
5
|
with_api_key api_key do
|
6
6
|
if epsg4326?
|
7
7
|
v.in.ogr(
|
@@ -70,12 +70,16 @@ module CartoGrass
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def with_api_key(api_key)
|
73
|
-
|
74
|
-
|
75
|
-
|
73
|
+
if api_key
|
74
|
+
api_key_var = "#{CARTO_OGR.upcase}_API_KEY"
|
75
|
+
begin
|
76
|
+
ENV[api_key_var] = api_key
|
77
|
+
yield
|
78
|
+
ensure
|
79
|
+
ENV.delete api_key_var
|
80
|
+
end
|
81
|
+
else
|
76
82
|
yield
|
77
|
-
ensure
|
78
|
-
ENV.delete api_key_var
|
79
83
|
end
|
80
84
|
end
|
81
85
|
|
data/lib/cartograss/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cartograss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Javier Goizueta
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
105
|
version: '0'
|
106
106
|
requirements: []
|
107
107
|
rubyforge_project:
|
108
|
-
rubygems_version: 2.
|
108
|
+
rubygems_version: 2.6.8
|
109
109
|
signing_key:
|
110
110
|
specification_version: 4
|
111
111
|
summary: Use CARTO datasets in GRASS GIS
|