Coder Social home page Coder Social logo

opusvl / p6-geotrack-daemon Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 18 KB

Perl 6 daemon to slurp netXML files and parse the data into a PostgreSQL database.

License: BSD 3-Clause "New" or "Revised" License

Perl 6 100.00%
perl6 perl6-application netxml airmon-ng

p6-geotrack-daemon's Introduction

p6-geotrack-daemon

Perl 6 daemon to slurp netXML files and parse the data into a PostgreSQL database.

Dependencies

  • Rakudo 2019.03 (Perl 6.d)
  • libpq-dev

Zef modules

zef install XML DB::Pg JSON::Fast Terminal::ANSIColor

Configuration

Preparing a PostgreSQL database

To prepare your PostgreSQL database, use the provided example database-tables.sql file to create the two required tables. I've personally been testing with the mdillon/postgis Dockerfile which gives us a not-so unreasonable PostgreSQL 11.2 to work with.

CREATE DATABASE geotrack;
CREATE EXTENSION postgis;

CREATE TABLE "access-points" (
    name text NOT NULL,
    description text,
    location geography(POINT),
    PRIMARY KEY (name)
);

CREATE TABLE "client-data" (
    client text NOT NULL,
    "client-manufacturer" text DEFAULT NULL,
    "access-point" text NOT NULL,
    "last-signal-dbm" int,
    "last-noise-dbm" int,
    "last-signal-rssi" int,
    "last-noise-rssi" int,
    "min-signal-dbm" int,
    "min-noise-dbm" int,
    "min-signal-rssi" int,
    "min-noise-rssi" int,
    "max-signal-dbm" int,
    "max-noise-dbm" int,
    "max-signal-rssi" int,
    "max-noise-rssi" int,
    timestamp timestamptz NOT NULL,
    FOREIGN KEY ("access-point") REFERENCES "access-points"(name)
);

Access Points

For each wireless basestation, you'll need to do some manual SQL queries to add a new 'access point' to the access-points table. This involves first discovering the coordinates of the physical location and using the PostGIS extension to convert that data into a geography(POINT).

geotrack=# SELECT ST_GeometryFromText('POINT(52.3710507 -1.264331)', 4326);
                st_geometryfromtext                 
----------------------------------------------------
 0101000020E610000036D4DE967E2F4A40871A8524B33AF4BF
(1 row)

With this information, we can now add our new access point.

INSERT INTO "access-points" VALUES ('opusvlwifi', 'OpusVL Office Wifi', '0101000020E610000036D4DE967E2F4A40871A8524B33AF4BF');

p6-geotrack-daemon's People

Contributors

kawaii avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.