After you activate HBase Ganos, you can call the Ganos API to start your development work. For more information about how to activate HBase Ganos, see .

Sample code

1. Download the sample code

ganos-sample

After you download the sample code, modify the dependencies in the pom.xml file as needed. For more information, see the Dependencies section.

2. Sample code descriptions

2.1. trajectory-sample module

This module uses automatic identification system (AIS) data as the sample data to demonstrate how to import and query trajectory data.

  • Main: the input of the demo.
  • Writer: writes data into HBase Ganos. The entire procedure includes these steps: connect to HBase Ganos, create a schema (spatio-temporal index table), read sample data, and write sample data to the spatio-temporal index table.
  • Reader: a common query interface. Examples are provided for attribute queries (equal-value queries, prefix queries, and suffix queries), spatial data queries, and spatio-temporal data queries.

2.2. spark-sample module

This module uses automatic identification system (AIS) data as the sample data to demonstrate how to import and query trajectory data based on Spark.

  • Writer: writes data into HBase Ganos. The entire procedure includes these steps: connect to HBase Ganos, create a schema (spatio-temporal index table), read sample data, and write sample data to the spatio-temporal index table.
  • SparkDemo: demonstrates how to read data from HBase Ganos, transform the data to Spark DataFrames, and query spatio-temporal data based on SparkSQL.

Dependencies

You can choose between the GeoMesa and Ganos clients. The Ganos client supports more features.

GeoMesa client

HBase Ganos is compatible with the open source GeoMesa client. You can directly integrate the GeoMesa client without using Ganos features.

Notice The GeoMesa client currently only supports Ganos based on HBase 1.x.
The configuration is as follows:
<properties>
       <! --Note: Enter the version of the HBase client -->
       <alihbase.version>1.3.1</alihbase.version>
</properties>

<dependency>
        <groupId>org.locationtech.geomesa</groupId>
        <artifactId>geomesa-hbase-datastore_2.11</artifactId>
        <version>2.2.1</version>
        <exclusions>
            <exclusion>
                <groupId>com.google.protobuf</groupId>
                <artifactId>protobuf-java</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <! -- alihbase as a dependency -->
      <dependency>
      <groupId>com.aliyun.hbase</groupId>
      <artifactId>alihbase-client</artifactId>
      <version>${alihbase.version}</version>
      <exclusions>
        <exclusion>
          <artifactId>com.google.guava</artifactId>
          <groupId>guava</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>com.aliyun.hbase</groupId>
      <artifactId>alihbase-server</artifactId>
      <version>${alihbase.version}</version>
    </dependency>
    <dependency>
      <groupId>com.aliyun.hbase</groupId>
      <artifactId>alihbase-common</artifactId>
      <version>${alihbase.version}</version>
    </dependency>
    <dependency>
      <groupId>com.aliyun.hbase</groupId>
      <artifactId>alihbase-protocol</artifactId>
      <version>${alihbase.version}</version>
    </dependency>

Ganos client

  • Ganos client based on HBase 1.x
Notice The dependency of the current Ganos client version has not been released to the maven library. You must manually download and integrate the dependency. Click ganos-hbase-distributed-runtime_2.11-2.2.1-2.1.0.jar to download the dependency, and configure the settings as follows:
<properties>
     <! -- Note: Enter the version of the HBase client -->
     <alihbase.version>1.3.1</alihbase.version>
</properties>

<dependency>
        <groupId>com.aliyun.tst.ganos</groupId>
        <artifactId>ganos-geomesa-hbase15</artifactId>
        <version>2.0.0</version>
        <scope>system</scope>
        <systemPath>/ganos-jar-path</systemPath>
      </dependency>
      <! -- alihbase as a dependency -->
      <dependency>
      <groupId>com.aliyun.hbase</groupId>
      <artifactId>alihbase-client</artifactId>
      <version>${alihbase.version}</version>
      <exclusions>
        <exclusion>
          <artifactId>com.google.guava</artifactId>
          <groupId>guava</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>com.aliyun.hbase</groupId>
      <artifactId>alihbase-server</artifactId>
      <version>${alihbase.version}</version>
    </dependency>
    <dependency>
      <groupId>com.aliyun.hbase</groupId>
      <artifactId>alihbase-common</artifactId>
      <version>${alihbase.version}</version>
    </dependency>
    <dependency>
      <groupId>com.aliyun.hbase</groupId>
      <artifactId>alihbase-protocol</artifactId>
      <version>${alihbase.version}</version>
    </dependency>
  • Ganos client based on HBase 2.x
Notice The dependency of the current Ganos client version has not been released to the maven library. You must manually download and integrate the dependency. Click ganos-hbase-distributed-runtime_2.11-2.2.1-2.5.0.jar to download the dependency, and configure the settings as follows:
<properties>
    <! -- Note: Enter the version of the HBase client -->
    <alihbase.version>2.0.0</alihbase.version>
</properties>

<dependency>
      <groupId>com.aliyun.tst.ganos</groupId>
      <artifactId>ganos-geomesa-hbase20</artifactId>
      <version>2.5.0</version>
      <scope>system</scope>
      <systemPath>/ganos-jar-path</systemPath>
    </dependency>
      <! -- alihbase as a dependency-->
      <dependency>
      <groupId>com.aliyun.hbase</groupId>
      <artifactId>alihbase-client</artifactId>
      <version>${alihbase.version}</version>
      <exclusions>
        <exclusion>
          <artifactId>com.google.guava</artifactId>
          <groupId>guava</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>com.aliyun.hbase</groupId>
      <artifactId>alihbase-server</artifactId>
      <version>${alihbase.version}</version>
    </dependency>
    <dependency>
      <groupId>com.aliyun.hbase</groupId>
      <artifactId>alihbase-common</artifactId>
      <version>${alihbase.version}</version>
    </dependency>
    <dependency>
      <groupId>com.aliyun.hbase</groupId>
      <artifactId>alihbase-protocol</artifactId>
      <version>${alihbase.version}</version>
    </dependency>