GeoJson format
Updated at:
The HBase Ganos REST API uses the GeoJson format to describe spatio-temporal data.
A typical spatio-temporal point, such as a trajectory point, uses the following format:
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [125.6, 10.1]
},
"properties": {
"name": "Dinagat Islands",
"dtg": 1536041936000,
"id": "1"
}
}The data has three parts:
- Temporal data: Stored in properties.dtg. The example shows a timestamp in milliseconds, represented as a 13-digit integer.
- Spatial data: The geometry.type indicates that the data is a point. The geometry.coordinates provides the longitude and latitude of the point.
- Other properties: Stored in the properties object. These describe the attributes of the point, such as properties.name and properties.id.
GeoJson libraries
You can use the following GeoJson libraries to generate GeoJson strings.
- For Java, you can use the geojson-jackson library. For basic usage, see the following example:
FeatureCollection featureCollection = new FeatureCollection(); featureCollection.add(new Feature()); String json= new ObjectMapper().writeValueAsString(featureCollection); - PythonTo install the geojson package, run the following command:
Basic usage:pip install geojsonpoint_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])
Note For more information, see the GEOJSON RFC.
Is this page helpful?