The HBase Ganos API uses index tables to store and query data. You can call the createSchema (SimpleFeatureType) method of DataStore to create an index. The SimpleFeatureType class is used to define the schema of the SimpleFeature structure in Ganos, and it consists of a set of common properties. HBase Ganos supports all standard GeoTools property types and also extends some other property types. You can use the SimpleFeatureTypes class provided by Geomesa to create a SimpleFeatureTypes object in HBase Ganos:
import org.locationtech.geomesa.utils.interop.SimpleFeatureTypes;
SimpleFeatureTypes.createType("sft_name", "dtg:Date,*geom:Point:srid=4326,name1:type1,name2,type2,...,nameN,typeN");
In the preceding example, a SimpleFeatureType class named sft_name has been created. This SimpleFeatureType class contains a Data column named dtg, a spatial column of the Point type named geom (coordinate reference system 4326), and several property fields including name1 and name2.
The following table lists the data types supported by HBase Ganos.
HBase Ganos type | Java data type | Support creating indexes |
---|---|---|
String | java.lang.String | Yes |
Integer | java.lang.Integer | Yes |
Double | java.lang.Double | Yes |
Long | java.lang.Long | Yes |
Float | java.lang.Float | Yes |
Boolean | java.lang.Boolean | Yes |
UUID | java.util.UUID | Yes |
Date | java.util.Date | Yes |
Timestamp | java.sql.Timestamp | Yes |
Point | org.locationtech.jts.geom.Point | Yes |
LineString | org.locationtech.jts.geom.LineString | Yes |
Polygon | org.locationtech.jts.geom.Polygon | Yes |
MultiPoint | org.locationtech.jts.geom.MultiPoint | Yes |
MultiLineString | org.locationtech.jts.geom.MultiLineString | Yes |
MultiPolygon | org.locationtech.jts.geom.MultiPolygon | Yes |
GeometryCollection | org.locationtech.jts.geom.GeometryCollection | Yes |
Geometry | org.locationtech.jts.geom.Geometry | Yes |
List[A] | java.util.List | Yes |
Map[A,B] | java.util.Map<A, B> | No |
Bytes | byte[] | No |
Notes: 1. The geom property is required. You can create only one index on each spatial column at a time. The indexed column is applied to primary spatio-temporal index systems such as Z2, Z3, XZ2, and XZ3. 2. A column of the Date type can be used as a primary spatio-temporal index or a common property index.
2. Specify index parameters
When you create an index, you can set static properties of SimpleFeatureType to specify a set of required parameters.
- Create indexes on specified property columns. HBase Ganos allows you to create indexes on common property columns, which can improve the query efficiency without specified spatio-temporal parameters. For example, you can run the following command to create indexes on the name column:
SimpleFeatureType sft = ...
sft.getDescriptor("name").getUserData().put("index", "true");
- You can specify the compression option in UserData options of SimpleFeatureType class. The supported compression types are snappy, lzo, gz, bzip2, lz4, and zstd.
SimpleFeatureType sft = ....;
sft.getUserData().put("geomesa.table.compression.enabled", "true");
sft.getUserData().put("geomesa.table.compression.type", "snappy");