# geojson2ew Configuration File Commands

(last revised April 24, 2015)

Page Index:
1. Example configuration file
2. Functional command listing
3. Alphabetic command listing & description
4. Descriptor file example

On startup, geojson2ew reads the configuration file named on the command line. As always, the configuration file contains comments:

>     #  marks the line as a comment (example: # This is a comment).

Command names must be typed in the control file exactly as shown in this document (upper/lower case matters!).

## 1. EXAMPLE CONFIGURATION FILE

    #
    # geojson2ew configuration file
    #
    # This code receives geoJSON records from an AMQP server, converts them into
    # Earthworm trace buf messages, and stuffs them into a wave ring.
    #
    #
     ModuleId       MOD_GEOJSON2EW  # module id for this import,
     RingName       WAVE_RING       # transport ring to use for input/output,

     HeartbeatInt   10              # Heartbeat interval in seconds
                                    # this should match the geojson2ew.desc heartbeat!

     LogFile        1               # If 0, don't write logfile;; if 1, do
                                    # if 2, log to module log but not stderr/stdout

     HOST           131.215.66.126
     PORT           5672
     QUEUENAME      Results2Earthworm
     USERNAME       seismic
     PASSWORD       secret

     MAP_SNCL       properties.SNCL
     MAP_TIME       properties.time
     MAP_SAMPLERATE properties.sampleRate

     # Map channels
     #               channelCode jsonPath multiplier condition
     MAP_CHAN N features[*].geometry.coordinates[0] 1e6 properties.coordinateType=NEU
     MAP_CHAN E features[*].geometry.coordinates[1] 1e6 properties.coordinateType=NEU
     MAP_CHAN Z features[*].geometry.coordinates[2] 1e6 properties.coordinateType=NEU
     MAP_CHAN Q features[*].properties.quality 1
     MAP_CHAN 1 features[*].properties.EError 1e6
     MAP_CHAN 2 features[*].properties.NError 1e6
     MAP_CHAN 3 features[*].properties.UError 1e6
     MAP_CHAN 4 features[*].properties.ENCovar 1e6
     MAP_CHAN 5 features[*].properties.EUCovar 1e6
     MAP_CHAN 6 features[*].properties.NUCovar 1e6

## 2. FUNCTIONAL COMMAND LISTING

Below are the configure commands recognized by geojson2ew, grouped by the function they influence.

    Earthworm system setup:
    ModuleId               required
    RingName               required
    HeartbeatInt           required

    Output Control:
    LogFile                required
    HOST                   required
    PORT                   required
    QUEUENAME              required
    USERNAME               required
    PASSWORD               required
    MAP_SNCL               required
    MAP_TIME               required
    MAP_SAMPLERATE         required
    MAP_CHAN               required

## 3. ALPHABETIC COMMAND LISTING & DESCRIPTION

In the following section, all configuration file commands are listed in alphabetical order. Listed along with the command (bold-type) are its arguments (in red), the name of the subroutine that processes the command, and the function within the module that the command influences. A detailed description of the command and is also given. Default and example values are listed after each command description.

     command arg1                         processed by           function

    HOST url                              main                   Main geojson2ew Thread

> This command is used to define the host for the AMQP server.

>      Default:  none
>      Example:  131.215.66.126

    HeartbeatInt beat                     HeartBeat              Earthworm setup

> Beat the geojson2ew heart every beat seconds. This is implemented as a separate thread in geojson2ew.

>     Default:  none
>     Example:  10

    LogFile switch                        GetConfig              Earthworm Setup

> Sets the on-off switch for writing a log file to disk. If switch is 0, no log file will be written. If switch is 1, geojson2ew will write a daily log file(s) called geojson2ewxx.log_yymmdd where xx is geojson2ew's module id (set with "ModuleId" command) and yymmdd is the current UTC date (ex: 960123) on the system clock. The file(s) will be written in the EW_LOG directory (environment variable).

>      Default:  none
>      Example:  1

    MAP_CHAN cc jsonpath m c              geojson_map            Main geojson2ew Thread

> This command is used to define the Channel Code, json path, Multiplier and optionally the Condition for the channel mapping. If the condition is not specified then all matches are used.

> Default: none
> Example: N features[*].geometry.coordinates[0] 1e6 properties.coordinateType=NEU

    MAP_SAMPLERATE jsonpath               geojson_process	       Main geojson2ew Thread

> This command is used to define the json path for the sample rate mapping.

> Default: none
> Example: properties.sampleRate

    MAP_SNCL jsonpath                     geojson_process        Main geojson2ew Thread

> This command is used to define the json path for the SNCL mapping.

> Default: none
> Example: properties.SNCL

    MAP_TIME jsonpath                     geojson_process        Main geojson2ew Thread

> This command is used to define the json path for the time mapping.

>     Default:  none
>     Example:  properties.time

    ModuleId mod_id                       GetConfig              Earthworm setup

> Sets the module id for labeling all outgoing messages. mod_id is a character string (valid strings are listed in earthworm.d) that relates (in earthworm.d) to a unique single-byte number.

>      Default:  none
>      Example:  MOD_GEOJSON2EW

    PASSWORD password                     main                   Main geojson2ew Thread

> This command is used to define the password for the AMQP server.

> Default: none
> Example: secret

    PORT number                           main                   Main geojson2ew Thread

> This command is used to define the port number for the AMQP server.

> Default: none
> Example: 5672

    QUEUENAME queuename                   main                   Main geojson2ew Thread

> This command is used to define the queue name for the AMQP server.

> Default: none
> Example: Results2Earthworm

    RingName ring                         GetConfig              Earthworm setup

> This is the ring into which the waveforms and messages are sent.

>     Default:  none
>     Example:  SCN_RING

    USERNAME username                     main                   Main geojson2ew Thread

> This command is used to define the user name for the AMQP server.

>     Default:  none
>     Example:  seismic

## 4. DESCRIPTOR FILE EXAMPLE

Here is a copy of the geojson2ew.desc file as implemented. Note that all causes of death for geojson2ew feed through the function geojson2ew_die() which logs all causes of death using logit() and sends a message to the statmgr utility.

    modName  geojson2ew
    modId    MOD_GEOJSON2EW
    instId   INST_UNKNOWN

    restartMe       # restart this sucker as it is critical to data collection
    #
    #
    #    Heartbeat Specification.  If the status manager does not receive
    #    a heartbeat message every <tsec> seconds from this module, an
    #    error will be reported (client module dead).  <page> is the maximum
    #    number of pager messages that will be reported and <mail> is the
    #    maximum number of email messages that will be reported.  If the
    #    page or mail limit is exceeded, no further errors will be reported
    #    until the status manager is restarted.
    #
    tsec: 20  page: 0  mail: 99

    # these are the statmgr messages that geojson2ew will send before dieing
    #
    err: 1  nerr: 1  tsec: 0  page: 5  mail: 20
    text: "AMQP server error caused geojson2ew to die"
    #
    err: 2  nerr: 1  tsec: 0  page: 5  mail: 20
    text: "SIGNAL caused geojson2ew to die"
    #
    err: 3  nerr: 1  tsec: 0  page: 5  mail: 20
    text: "EW tport_putmsg() failed, geojson2ew dead"
    #
    err: 4  nerr: 1  tsec: 0  page: 5  mail: 20
    text: "EW TERMINATE recv'd, geojson2ew dead"
    #
    err: 5  nerr: 1  tsec: 0  page: 5  mail: 20
    text: "EW config problems on startup, geojson2ew dead"
    #
    # BELOW: WARNINGS, NOT FATAL YET
    err: 6  nerr: 1  tsec: 0  page: 5  mail: 20
    text: "geoJSON parsing errors"

Module Index | geojson2ew Overview