logstash-filter-wkt_to_geojson 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/lib/logstash/filters/wkt_to_geojson.rb +13 -8
- data/logstash-filter-wkt_to_geojson.gemspec +6 -7
- data/spec/filters/wkt_to_geojson_spec.rb +5 -5
- metadata +11 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7137703d484089ebb77cc379e37046bf36a8d291
|
4
|
+
data.tar.gz: f0b3bfdb561a681e0f56b31355cee90da825de33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6712fb46514d81f06a8885fa0e5e9210212070745906b8f21c87baecfed10f5fdeba6fcd765ae33d0d0a96cc5d3017638f3cb4f56ff1e708a34c397dc942ae59
|
7
|
+
data.tar.gz: 1deb8aa8a0a36019003e8f2501e7b87f738bbf457a3c19e0158d2fc8ee28a13e2baabbd0b064892f047cc80aec738d0d450882986593c867bd39cf7414ceec10
|
data/Gemfile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
source '
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
gemspec
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require "logstash/filters/base"
|
3
3
|
require "logstash/namespace"
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
4
|
+
require 'geo_ruby'
|
5
|
+
require 'geo_ruby/ewk'
|
6
|
+
require 'geo_ruby/geojson'
|
7
7
|
|
8
8
|
class LogStash::Filters::WktToGeojson < LogStash::Filters::Base
|
9
9
|
|
@@ -15,8 +15,6 @@ class LogStash::Filters::WktToGeojson < LogStash::Filters::Base
|
|
15
15
|
|
16
16
|
public
|
17
17
|
def register
|
18
|
-
@parser = RGeo::WKRep::WKTParser.new()
|
19
|
-
@encoder = RGeo::GeoJSON.coder()
|
20
18
|
end # def register
|
21
19
|
|
22
20
|
public
|
@@ -25,9 +23,16 @@ class LogStash::Filters::WktToGeojson < LogStash::Filters::Base
|
|
25
23
|
wkt = event.get(@field)
|
26
24
|
|
27
25
|
begin
|
28
|
-
|
29
|
-
|
30
|
-
|
26
|
+
factory = GeoRuby::SimpleFeatures::GeometryFactory::new()
|
27
|
+
ewkt_parser = GeoRuby::SimpleFeatures::EWKTParser::new(factory)
|
28
|
+
ewkt_parser.parse(wkt)
|
29
|
+
|
30
|
+
if (factory.geometry.nil?)
|
31
|
+
raise "Failed to parse to SimpleFeature"
|
32
|
+
end
|
33
|
+
|
34
|
+
event.set(@target, factory.geometry.to_json)
|
35
|
+
factory.geometry.to_json
|
31
36
|
rescue Exception => e
|
32
37
|
@logger.error('WKT Parse Error',
|
33
38
|
:wkt => wkt, :exception => e)
|
@@ -1,9 +1,9 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-filter-wkt_to_geojson'
|
3
|
-
s.version = '0.1.
|
3
|
+
s.version = '0.1.2'
|
4
4
|
s.licenses = ['Apache-2.0']
|
5
|
-
s.summary = '
|
6
|
-
s.homepage = 'https://kalmas
|
5
|
+
s.summary = 'Logstash filter to convert WKT geography shapes to GeoJSON.'
|
6
|
+
s.homepage = 'https://github.com/kalmas/logstash-filter-wkt_to_geojson'
|
7
7
|
s.authors = ['kalmas']
|
8
8
|
s.email = 'kylealmas@gmail.com'
|
9
9
|
s.require_paths = ['lib']
|
@@ -16,10 +16,9 @@ Gem::Specification.new do |s|
|
|
16
16
|
# Special flag to let us know this is actually a logstash plugin
|
17
17
|
s.metadata = { "logstash_plugin" => "true", "logstash_group" => "filter" }
|
18
18
|
|
19
|
-
s.
|
20
|
-
s.add_runtime_dependency 'rgeo-geojson', '0.4.3'
|
19
|
+
s.add_dependency 'georuby', '2.5.2'
|
21
20
|
|
22
|
-
# Gem dependencies
|
23
21
|
s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"
|
24
|
-
|
22
|
+
|
23
|
+
s.add_development_dependency 'logstash-devutils', '1.3.3'
|
25
24
|
end
|
@@ -29,9 +29,9 @@ describe LogStash::Filters::WktToGeojson do
|
|
29
29
|
CONFIG
|
30
30
|
end
|
31
31
|
|
32
|
-
sample("geometry" => "
|
32
|
+
sample("geometry" => "GEOMETRYCOLLECTION(POINT(3 5), LINESTRING(-2 0, -3 -4))") do
|
33
33
|
expect(subject.get('geoff_jason')).to eq("{\"type\":\"GeometryCollection\",\"geometries\":[{\"type\":\"Point\",\"coordinates\":[3.0,5.0]},{\"type\":\"LineString\",\"coordinates\":[[-2.0,0.0],[-3.0,-4.0]]}]}")
|
34
|
-
expect(subject.get('geometry')).to eq("
|
34
|
+
expect(subject.get('geometry')).to eq("GEOMETRYCOLLECTION(POINT(3 5), LINESTRING(-2 0, -3 -4))")
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
@@ -45,9 +45,9 @@ describe LogStash::Filters::WktToGeojson do
|
|
45
45
|
CONFIG
|
46
46
|
end
|
47
47
|
|
48
|
-
sample("geometry" => "MULTIPOLYGON
|
48
|
+
sample("geometry" => "MULTIPOLYGON((()))") do
|
49
49
|
expect(subject).to_not include("geo_json")
|
50
|
-
expect(subject.get('geometry')).to eq("MULTIPOLYGON
|
50
|
+
expect(subject.get('geometry')).to eq("MULTIPOLYGON((()))")
|
51
51
|
expect(subject.get('tags')).to include('_wkt_parse_failure')
|
52
52
|
end
|
53
53
|
end
|
@@ -80,7 +80,7 @@ describe LogStash::Filters::WktToGeojson do
|
|
80
80
|
CONFIG
|
81
81
|
end
|
82
82
|
|
83
|
-
sample("geometry" => "
|
83
|
+
sample("geometry" => "GEOMETRYCOLLECTION(POINT(3 5), LINESTRING(-2 0, -3 -4))") do
|
84
84
|
expect(subject).to_not include("geo_json")
|
85
85
|
end
|
86
86
|
end
|
metadata
CHANGED
@@ -1,43 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-filter-wkt_to_geojson
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kalmas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
15
15
|
requirements:
|
16
16
|
- - '='
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version:
|
19
|
-
name:
|
18
|
+
version: 2.5.2
|
19
|
+
name: georuby
|
20
20
|
prerelease: false
|
21
21
|
type: :runtime
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
requirement: !ruby/object:Gem::Requirement
|
29
|
-
requirements:
|
30
|
-
- - '='
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 0.4.3
|
33
|
-
name: rgeo-geojson
|
34
|
-
prerelease: false
|
35
|
-
type: :runtime
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - '='
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 0.4.3
|
26
|
+
version: 2.5.2
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
requirement: !ruby/object:Gem::Requirement
|
43
29
|
requirements:
|
@@ -61,17 +47,17 @@ dependencies:
|
|
61
47
|
- !ruby/object:Gem::Dependency
|
62
48
|
requirement: !ruby/object:Gem::Requirement
|
63
49
|
requirements:
|
64
|
-
- -
|
50
|
+
- - '='
|
65
51
|
- !ruby/object:Gem::Version
|
66
|
-
version:
|
52
|
+
version: 1.3.3
|
67
53
|
name: logstash-devutils
|
68
54
|
prerelease: false
|
69
55
|
type: :development
|
70
56
|
version_requirements: !ruby/object:Gem::Requirement
|
71
57
|
requirements:
|
72
|
-
- -
|
58
|
+
- - '='
|
73
59
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
60
|
+
version: 1.3.3
|
75
61
|
description:
|
76
62
|
email: kylealmas@gmail.com
|
77
63
|
executables: []
|
@@ -84,7 +70,7 @@ files:
|
|
84
70
|
- logstash-filter-wkt_to_geojson.gemspec
|
85
71
|
- spec/filters/wkt_to_geojson_spec.rb
|
86
72
|
- spec/spec_helper.rb
|
87
|
-
homepage: https://kalmas
|
73
|
+
homepage: https://github.com/kalmas/logstash-filter-wkt_to_geojson
|
88
74
|
licenses:
|
89
75
|
- Apache-2.0
|
90
76
|
metadata:
|
@@ -109,7 +95,7 @@ rubyforge_project:
|
|
109
95
|
rubygems_version: 2.6.8
|
110
96
|
signing_key:
|
111
97
|
specification_version: 4
|
112
|
-
summary:
|
98
|
+
summary: Logstash filter to convert WKT geography shapes to GeoJSON.
|
113
99
|
test_files:
|
114
100
|
- spec/filters/wkt_to_geojson_spec.rb
|
115
101
|
- spec/spec_helper.rb
|