GeoJsonFeature Class

public class GeoJsonFeature
extends GeoJsonObject

A valid `GeoJSON Feature` object type. Please refer to [RFC 7946](https://tools.ietf.org/html/rfc7946\#section-3.2) for details.

Constructor Summary

Constructor Description
GeoJsonFeature()

Creates an instance of GeoJsonFeature class.

Method Summary

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

Reads an instance of GeoJsonFeature from the JsonReader.

String getFeatureType()

Get the featureType property: The type of the feature.

GeoJsonGeometry getGeometry()

Get the geometry property: A valid `GeoJSON` geometry object.

String getId()

Get the id property: Identifier for the feature.

Object getProperties()

Get the properties property: Properties can contain any additional metadata about the `Feature`.

GeoJsonObjectType getType()

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

GeoJsonFeature setBbox(List<Double> bbox)

Set the bbox property: Bounding box.

GeoJsonFeature setFeatureType(String featureType)

Set the featureType property: The type of the feature.

GeoJsonFeature setGeometry(GeoJsonGeometry geometry)

Set the geometry property: A valid `GeoJSON` geometry object.

GeoJsonFeature setId(String id)

Set the id property: Identifier for the feature.

GeoJsonFeature setProperties(Object properties)

Set the properties property: Properties can contain any additional metadata about the `Feature`.

JsonWriter toJson(JsonWriter jsonWriter)

Methods inherited from GeoJsonObject

Methods inherited from java.lang.Object

Constructor Details

GeoJsonFeature

public GeoJsonFeature()

Creates an instance of GeoJsonFeature class.

Method Details

fromJson

public static GeoJsonFeature fromJson(JsonReader jsonReader)

Reads an instance of GeoJsonFeature from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

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

Throws:

IOException

- If the deserialized JSON object was missing any required properties.

getFeatureType

public String getFeatureType()

Get the featureType property: The type of the feature. The value depends on the data model the current feature is part of. Some data models may have an empty value.

Returns:

the featureType value.

getGeometry

public GeoJsonGeometry getGeometry()

Get the geometry property: 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.

Returns:

the geometry value.

getId

public String getId()

Get the id property: Identifier for the feature.

Returns:

the id value.

getProperties

public Object getProperties()

Get the properties property: Properties can contain any additional metadata about the `Feature`. Value can be any JSON object or a JSON null value.

Returns:

the properties value.

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:

GeoJsonFeature.getType()

Returns:

the type value.

setBbox

public GeoJsonFeature 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:

GeoJsonFeature.setBbox(List<Double> bbox)

Parameters:

bbox

setFeatureType

public GeoJsonFeature setFeatureType(String featureType)

Set the featureType property: The type of the feature. The value depends on the data model the current feature is part of. Some data models may have an empty value.

Parameters:

featureType - the featureType value to set.

Returns:

the GeoJsonFeature object itself.

setGeometry

public GeoJsonFeature setGeometry(GeoJsonGeometry geometry)

Set the geometry property: 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.

Parameters:

geometry - the geometry value to set.

Returns:

the GeoJsonFeature object itself.

setId

public GeoJsonFeature setId(String id)

Set the id property: Identifier for the feature.

Parameters:

id - the id value to set.

Returns:

the GeoJsonFeature object itself.

setProperties

public GeoJsonFeature setProperties(Object properties)

Set the properties property: Properties can contain any additional metadata about the `Feature`. Value can be any JSON object or a JSON null value.

Parameters:

properties - the properties value to set.

Returns:

the GeoJsonFeature object itself.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Overrides:

GeoJsonFeature.toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to