GeoJsonGeometry Class

public class GeoJsonGeometry
extends GeoJsonObject

A valid `GeoJSON` geometry object. The type must be one of the seven valid GeoJSON geometry types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon and GeometryCollection. Please refer to [RFC 7946](https://tools.ietf.org/html/rfc7946\#section-3.1) for details.

Constructor Summary

Constructor Description
GeoJsonGeometry()

Creates an instance of GeoJsonGeometry class.

Method Summary

Modifier and Type Method and Description
static GeoJsonGeometry fromJson(JsonReader jsonReader)

Reads an instance of GeoJsonGeometry from the JsonReader.

GeoJsonObjectType getType()

Get the type property: Specifies the `GeoJSON` type.

GeoJsonGeometry setBbox(List<Double> bbox)

Set the bbox property: Bounding box.

JsonWriter toJson(JsonWriter jsonWriter)

Methods inherited from GeoJsonObject

Methods inherited from java.lang.Object

Constructor Details

GeoJsonGeometry

public GeoJsonGeometry()

Creates an instance of GeoJsonGeometry class.

Method Details

fromJson

public static GeoJsonGeometry fromJson(JsonReader jsonReader)

Reads an instance of GeoJsonGeometry from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of GeoJsonGeometry if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.

Throws:

IOException

- If an error occurs while reading the GeoJsonGeometry.

getType

public GeoJsonObjectType getType()

Get the type property: Specifies the `GeoJSON` type. Must be one of the nine valid GeoJSON object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, GeometryCollection, Feature and FeatureCollection.

Overrides:

GeoJsonGeometry.getType()

Returns:

the type value.

setBbox

public GeoJsonGeometry setBbox(List<Double> bbox)

Set the bbox property: Bounding box. Projection used - EPSG:3857. Please refer to [RFC 7946](https://datatracker.ietf.org/doc/html/rfc7946\#section-5) for details.

Overrides:

GeoJsonGeometry.setBbox(List<Double> bbox)

Parameters:

bbox

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Overrides:

GeoJsonGeometry.toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to