logstash-filter-wkt_repair 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -0
- data/lib/logstash/filters/wkt_repair.rb +11 -4
- data/logstash-filter-wkt_repair.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc9c5d7ca4a8916526fc1a03e4e2d2ba34da1679c0f00db248bc62dea2171e3a
|
4
|
+
data.tar.gz: 193c6f9be30632103985030bc45fa2e3fc1c71b0722e0b9bbe72ce0c7efe1ee8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ed596b17b402e5d55dfd5e1ad5200f0316ef557d78a09a10e79255c351162cbbf9429769dd5d1fe1dd45d42819b928aefb22a5a90f13916ed51e912a39df614
|
7
|
+
data.tar.gz: 4b6f2ce9ff8e4a262e77f178e1ef64e6176aa7b3ab8dbd199339efd171739974e36d4ac2c57d50cb344c08d3f82a324cf470f21d7af3f01f8f77e1c80a03546e
|
data/README.md
CHANGED
@@ -29,6 +29,8 @@ Examples of ambigous or ill-defined polygons include, but not limited to:
|
|
29
29
|
|
30
30
|
Yeah, unfortunately, this plugin depends on your server/container having these installed;
|
31
31
|
- [cmake](https://cmake.org/download/)
|
32
|
+
- [CGAL](https://www.cgal.org/download/linux.html)
|
33
|
+
- [GDAL](http://www.gdal.org/)
|
32
34
|
- [prepair](https://github.com/ForRentCom/prepair)
|
33
35
|
|
34
36
|
### Dependency installation
|
@@ -45,6 +47,17 @@ make install
|
|
45
47
|
```
|
46
48
|
Add `/opt/cmake/bin` to your $PATH
|
47
49
|
|
50
|
+
Installing CGAL:
|
51
|
+
```sh
|
52
|
+
apt-get install libcgal-dev
|
53
|
+
```
|
54
|
+
|
55
|
+
Installing GDAL:
|
56
|
+
```sh
|
57
|
+
apt-get -y install libgdal-dev
|
58
|
+
apt-get -y install gdal-bin
|
59
|
+
```
|
60
|
+
|
48
61
|
Installing prepair:
|
49
62
|
```sh
|
50
63
|
wget https://github.com/ForRentCom/prepair/archive/master.zip
|
@@ -28,20 +28,27 @@ class LogStash::Filters::WktRepair < LogStash::Filters::Base
|
|
28
28
|
def filter(event)
|
29
29
|
|
30
30
|
wkt = event.get(@source)
|
31
|
+
temp_file = "temp-wkt.txt"
|
31
32
|
|
32
33
|
begin
|
33
|
-
|
34
|
-
stdout, stderr, status = Open3.capture3("#{cmd}")
|
34
|
+
File.open(temp_file, "w+") {|f| f.write("#{wkt}") }
|
35
35
|
|
36
|
+
wkt_repair_cmd = "prepair -f #{temp_file}"
|
37
|
+
std_out, std_err, status = Open3.capture3("#{wkt_repair_cmd}")
|
38
|
+
|
36
39
|
if status.success?
|
37
|
-
event.set(@target,
|
40
|
+
event.set(@target, std_out.strip)
|
38
41
|
else
|
39
|
-
@logger.error("WKT Repair Error: #{
|
42
|
+
@logger.error("WKT Repair Error: #{std_err}")
|
40
43
|
@tag_on_failure.each { |tag| event.tag(tag) }
|
41
44
|
end
|
42
45
|
rescue Exception => e
|
43
46
|
@logger.error("WKT Repair Exception", :exception => e)
|
44
47
|
@tag_on_failure.each { |tag| event.tag(tag) }
|
48
|
+
ensure
|
49
|
+
if File.file?(temp_file)
|
50
|
+
File.open(temp_file, "r+") {|f| f.truncate(0) }
|
51
|
+
end
|
45
52
|
end
|
46
53
|
|
47
54
|
# filter_matched should go in the last line of our successful code
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-filter-wkt_repair'
|
3
|
-
s.version = '0.1.
|
3
|
+
s.version = '0.1.8'
|
4
4
|
s.licenses = ['Apache-2.0']
|
5
5
|
s.summary = 'Logstash filter to repair a WKT shape data.'
|
6
6
|
s.description = 'It takes ambigous or ill-defined polygons and returns a coherent and clearly defined output.'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-filter-wkt_repair
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Silver Ibenye
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|