Quick Start
Updated at:
This topic describes how to develop applications using Ganos APIs after you activate HBase Ganos.
Code samples
- Download the code samples.
After you download the code, modify the dependencies in the pom.xml file as needed.
- The code samples contain the following modules:
- trajectory-sample moduleThis module uses Automatic Identification System (AIS) data as an example to show how to write and query trajectory data. The module includes:
- Main: The entry point of the sample program.
- Writer: Writes data to HBase Ganos. The steps include connecting to HBase Ganos, creating a schema for a spatiotemporal index table, reading sample data, and writing the data to the spatiotemporal index table.
- Reader: A general query API that supports attribute queries (such as equality, prefix, and suffix queries), spatial queries, and spatiotemporal queries.
- spark-sample moduleThis module uses AIS data as an example to show how to write trajectory data and perform query and analysis with Spark. The module includes:
- Writer: Writes data to HBase Ganos. The steps include connecting to HBase Ganos, creating a schema for a spatiotemporal index table, reading sample data, and writing the data to the spatiotemporal index table.
- SparkDemo: Reads data from HBase Ganos, transforms the data into a Spark DataFrame (DF) model, and performs operations such as spatial queries using SparkSQL.
- trajectory-sample module
Dependency configuration
You can use either the GeoMesa client or the Ganos client. The Ganos client supports more features.
GeoMesa client
HBase Ganos is compatible with the open source GeoMesa client. If you do not require Ganos-specific features or optimizations, you can directly integrate the GeoMesa client.
The GeoMesa client is only compatible with Ganos based on HBase 1.x. The configuration code is as follows:
<properties>
<!-- Note: Specify the HBase client version number here. -->
<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>
<!-- Dependency on alihbase -->
<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
- For Ganos based on HBase 1.xImportant This dependency package is required for integration. Click ganos-hbase-distributed-runtime_2.11-2.2.1-2.1.0.jar to download the package and then use the following configuration.
<properties> <!-- Note: Specify the HBase client version number here. --> <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> <!-- Dependency on alihbase --> <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> - For Ganos based on HBase 2.xImportant This dependency package is required for integration. Click ganos-hbase-distributed-runtime_2.11-2.2.1-2.5.0.jar to download the package.
<properties> <!-- Note: Specify the HBase client version number here. --> <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> <!-- Dependency on alihbase --> <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>
Is this page helpful?