wso2-extensions / siddhi-execution-geo

Apache License 2.0
0 stars 23 forks source link

Siddhi-execution-geo

The siddhi-execution-geo extension is an extension to Siddhi that provides geo data related functionality such as checking whether a given geo coordinate is within a predefined geo-fence, etc. Following are the functions of the Geo extension.

Find some useful links below:

Latest API Docs

Latest API Docs is 5.0.1.

How to use

Using the extension in WSO2 Stream Processor

Using the extension as a java library

     <dependency>
        <groupId>org.wso2.extension.siddhi.execution.geo</groupId>
        <artifactId>siddhi-execution-geo</artifactId>
        <version>x.x.x</version>
     </dependency>

Jenkins Build Status


Branch Build Status
master Build Status

Features

Dependencies

In order to use the functions supported by this extension, import the latest geo location data to the LOCATION and BLOCKS tables as follows:

  1. First, create an account in the Maxmind site.

  2. Then log in to the Maxmind site using your newly created credentials via the Login Form.

  3. Download the geoip-2-csv-converter that is compatible with your operating system from the maxmind/geoip2-csv-converter github repository.

  4. Download and install a database type of your choice. Then start it, and create the required database and tables as follows:

    !!!info This example uses MySQL.

    1. Create a database named GEO_LOCATION_DATA.

    2. To create the required tables in the database, execute one of the following scripts.

  5. Prepare the database entries as follows:

    1. Unzip the latest CSV file and the geoip-2-csv-converter that you downloaded in the steps above.

    2. Run the update-geolocation-data.sh file by issuing the following command:

      sh update-geolocation-data.sh

    3. Enter the path to the extracted GeoLite2-City-Blocks-IPv4 directory that you downloaded as the response for the Enter path to GeoLite2-City-Blocks-IPv4 directory: prompt (e.g., /<PATH_TO>/GeoLite2-City-CSV_20171107).

    4. Enter the path to the geoip2-csv-converter directory as the response for the Enter path to geoip2-csv-converter home directory: prompt (e.g., /<PATH_TO>/geoip2-csv-converter-v1.0.0).

    Once the script is executed, you can find the final.csv file inside your current directory.

  6. Import the data as follows:

    1. To import the final.csv file (which you previously generated) into the BLOCKS table, issue the following command after logging into the MySQL console.

      load data local infile '[PATH_TO_FINAL.CSV]/final.csv' into table BLOCKS
       fields terminated by ','
       enclosed by '"'
       lines terminated by '\n'
       (network_cidr, network, broadcast, geoname_id, registered_country_geoname_id, represented_country_geoname_id, is_anonymous_proxy, is_satellite_provider, postal_code, latitude, longitude, network_blocks);
    2. To import the GeoLite2-City-Locations-en.csv file located inside the extracted geoip-2-csv-converter directory (e.g., geoip-2-csv-converterGeoLite2-City-CSV_2017110) into the LOCATION table, issue the following command.

      load data local infile '[PATH_TO_GeoLite2-City-Locations-en]/GeoLite2-City-Locations-en.csv' into table LOCATION
       fields terminated by ','
       enclosed by '"'
       lines terminated by '\n'
       (geoname_id, locale_code, continent_code, continent_name, country_iso_code, country_name, subdivision_1_iso_code, subdivision_1_name, subdivision_2_iso_code, subdivision_2_name, city_name, metro_code, time_zone);
  7. Restart the Streaming Integrator. You have now updated the Geo Location Data Set.

How to Contribute

Contact us

Support