No commit activity in last 3 years
No release in over 3 years
It takes ambigous or ill-defined polygons and returns a coherent and clearly defined output.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

<= 2.99, >= 1.60
 Project Readme

WKT or GeoJson Repair Logstash Filter

Gem Version

Repairs WKT or GeoJson Polygons/Multipolygons on a Logstash event that are ambiguous or ill-defined and returns a coherent and clearly defined output.

Examples of ambigous or ill-defined polygons include, but not limited to:

  • A polygon with dangling edge
  • A polygon that is not closed
  • A polygon that self intersects

Config example

{
    ...
    filter {
        wkt_repair {
            source => "wkt"
            target => "wkt_repaired"
            type => "WKT|GeoJson"
            tag_on_failure => [ "_wkt_repair_failure" ]
        }
    }
    ...
}

Dependencies

Yeah, unfortunately, this plugin depends on your server/container having these installed;

Dependency installation

Run the following commands to install the dependencies;

Installing cmake:

wget https://cmake.org/files/v3.9/cmake-3.9.3.tar.gz
tar xzf cmake-3.9.3.tar.gz
cd cmake-2.8.3
./configure --prefix=/opt/cmake
make
make install

Add /opt/cmake/bin to your $PATH

Installing CGAL:

apt-get install libcgal-dev

Installing GDAL:

apt-get -y install libgdal-dev
apt-get -y install gdal-bin

Installing prepair:

wget https://github.com/ForRentCom/prepair/archive/master.zip
unzip prepair-master.zip -d /opt
mv /opt/prepair-master /opt/prepair
cd /opt/prepair
cmake .
make

Add /opt/prepair to your $PATH

Developing

1. Plugin Developement and Testing

Code

  • To get started, you'll need rvm, JRuby and the Bundler gem installed.
\curl -sSL https://get.rvm.io | bash -s stable
rvm install jruby
jruby -S gem install bundler
  • Install dependencies
bundle install

Test

  • Update your dependencies
bundle install
  • Run tests
bundle exec rspec

2. Installing and Running the plugin locally

  • Build the plugin gem
gem build logstash-filter-wkt_repair.gemspec
  • Install the plugin from the Logstash home
bin/logstash-plugin install /your/local/plugin/logstash-filter-wkt_repair.gem
  • Start Logstash and proceed to using/testing the plugin

3. Installing the plugin from rubyGems

  • To install the plugin from rubyGems
bin/logstash-plugin install logstash-filter-wkt_repair.gem

For walk through of developing Logstash filter plugin see https://www.elastic.co/guide/en/logstash/current/_how_to_write_a_logstash_filter_plugin.html