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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d55eb4d11ada67b701d6c688b2d253ae535f1881e2bdeb4d43355568ce241e92
4
- data.tar.gz: 6c4458247d7c4ec984fb306322fa04ed7e876c04e87f56ab6d75adbf2aef5f44
3
+ metadata.gz: bc9c5d7ca4a8916526fc1a03e4e2d2ba34da1679c0f00db248bc62dea2171e3a
4
+ data.tar.gz: 193c6f9be30632103985030bc45fa2e3fc1c71b0722e0b9bbe72ce0c7efe1ee8
5
5
  SHA512:
6
- metadata.gz: 112a258dad8495590e98a2f1f2a305dda4e3044f3b4bec12732dd2d2baf949623266ffa35fa336323867b0927e81c9933238f222ddac0901901ff651a0ccc589
7
- data.tar.gz: '08f3b320cdf794ef6445ec3350b65cbeb5aed704b146c09c7ab6ddeed30a786cc857ad21bcf7c4750884675220a32be231a4563a3635813a999d0bfc7b404db2'
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
- cmd = "prepair --wkt '#{wkt}'"
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, stdout.strip)
40
+ event.set(@target, std_out.strip)
38
41
  else
39
- @logger.error("WKT Repair Error: #{stderr}", :wkt => wkt)
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.7'
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.7
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-02 00:00:00.000000000 Z
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