The REST API of HBase Ganos uses the GeoJson format to describe spatio-temporal data. For more information, see GEOJSON RFC.

The following sample code shows the spatio-temporal Point data, which can be considered as a track point:

{
  "type": "Feature",
  "geometry": {
    "type": "Point",
    "coordinates": [125.6, 10.1]
  },
  "properties": {
    "name": "Dinagat Islands",
	"dtg": 1536041936000,
	"id":  "1"
  }
}

The data consists of three parts:

  • Time data: The data is stored as properties information in properties.dtg. In this example, the time data is a timestamp in milliseconds, which is a 13-digit integer.
  • Spatial data: The geometry.type parameter indicates that the spatial data is a Point data, and the geometry.coordinates indicates the latitude and longitude coordinates of the Point.
  • Other properties: Other properties are stored in properties, such as properties.name and properties.id, which indicate the property information of the Point.

GeoJson libraries

You can use common GeoJson libraries to generate GeoJson strings.

  • The GeoJson library geojson-jackson for Java. For more information, visit https://github.com/opendatalab-de/geojson-jackson. Run the following command to use the library.
FeatureCollection featureCollection = new FeatureCollection();
featureCollection.add(new Feature());

String json= new ObjectMapper().writeValueAsString(featureCollection);
  • The GeoJson library geojson-jackson for Python.

Run the following command to include the geojson package.

	pip install geojson

Run the following command to use the library.

	
	point_feature = Feature(id="1",geometry=Point((1.6432, -19.123)),properties={"id":"1","dtg":1536041936000,"name": "Dinagat Islands"})
	
	polygon_feature = Feature(id="my_feature2",geometry=Polygon([(0,0),(0,1),(1,1),(1,0),(0,0)]),properties={"id":"2","dtg":1536041936000,"name": "Dinagat Islands"})
	
	feature_collection = FeatureCollection([point_feature,polygon_feature])