public final class FeatureCollection extends java.lang.Object implements GeoJson
Feature
objects (when
serialized the feature list becomes a JSON array).
Note that the feature list could potentially be empty. Features within the list must follow the
specifications defined inside the Feature
class.
An example of a Feature Collections given below:
{ "TYPE": "FeatureCollection", "bbox": [100.0, 0.0, -100.0, 105.0, 1.0, 0.0], "features": [ //... ] }
Modifier and Type | Method and Description |
---|---|
BoundingBox |
bbox()
A Feature Collection might have a member named
bbox to include information on the
coordinate range for it's Feature s. |
boolean |
equals(java.lang.Object obj) |
java.util.List<Feature> |
features()
This provides the list of feature making up this Feature Collection.
|
static FeatureCollection |
fromFeature(Feature feature)
Create a new instance of this class by giving the feature collection a single
Feature . |
static FeatureCollection |
fromFeature(Feature feature,
BoundingBox bbox)
Create a new instance of this class by giving the feature collection a single
Feature . |
static FeatureCollection |
fromFeatures(Feature[] features)
Create a new instance of this class by giving the feature collection an array of
Feature s. |
static FeatureCollection |
fromFeatures(Feature[] features,
BoundingBox bbox)
Create a new instance of this class by giving the feature collection an array of
Feature s. |
static FeatureCollection |
fromFeatures(java.util.List<Feature> features)
Create a new instance of this class by giving the feature collection a list of
Feature s. |
static FeatureCollection |
fromFeatures(java.util.List<Feature> features,
BoundingBox bbox)
Create a new instance of this class by giving the feature collection a list of
Feature s. |
static FeatureCollection |
fromJson(java.lang.String json)
Create a new instance of this class by passing in a formatted valid JSON String.
|
int |
hashCode() |
java.lang.String |
toJson()
This takes the currently defined values found inside this instance and converts it to a GeoJson
string.
|
java.lang.String |
toString() |
java.lang.String |
type()
This describes the type of GeoJson this object is, thus this will always return
FeatureCollection . |
static com.google.gson.TypeAdapter<FeatureCollection> |
typeAdapter(com.google.gson.Gson gson)
Gson type adapter for parsing Gson to this class.
|
public static FeatureCollection fromJson(@NonNull java.lang.String json)
fromFeatures(List)
.json
- a formatted valid JSON string defining a GeoJson Feature Collectionpublic static FeatureCollection fromFeatures(@NonNull Feature[] features)
Feature
s. The array of features itself isn't null but it can be empty and have a length
of 0.features
- an array of featurespublic static FeatureCollection fromFeatures(@NonNull java.util.List<Feature> features)
Feature
s. The list of features itself isn't null but it can empty and have a size of 0.features
- a list of featurespublic static FeatureCollection fromFeatures(@NonNull Feature[] features, @Nullable BoundingBox bbox)
Feature
s. The array of features itself isn't null but it can be empty and have a length
of 0.features
- an array of featuresbbox
- optionally include a bbox definition as a double arraypublic static FeatureCollection fromFeatures(@NonNull java.util.List<Feature> features, @Nullable BoundingBox bbox)
Feature
s. The list of features itself isn't null but it can be empty and have a size of
0.features
- a list of featuresbbox
- optionally include a bbox definition as a double arraypublic static FeatureCollection fromFeature(@NonNull Feature feature)
Feature
.feature
- a single featurepublic static FeatureCollection fromFeature(@NonNull Feature feature, @Nullable BoundingBox bbox)
Feature
.feature
- a single featurebbox
- optionally include a bbox definition as a double array@NonNull public java.lang.String type()
FeatureCollection
.@Nullable public BoundingBox bbox()
bbox
to include information on the
coordinate range for it's Feature
s. The value of the bbox member MUST be a list of
size 2*n where n is the number of dimensions represented in the contained feature geometries,
with all axes of the most southwesterly point followed by all axes of the more northeasterly
point. The axes order of a bbox follows the axes order of geometries.@Nullable public java.util.List<Feature> features()
fromJson(String)
this list could be null.
Otherwise, the list can't be null but the size of the list can equal 0.Feature
s which make up this Feature Collectionpublic java.lang.String toJson()
public static com.google.gson.TypeAdapter<FeatureCollection> typeAdapter(com.google.gson.Gson gson)
gson
- the built Gson
objectpublic java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object