public class GeoJSON extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
TYPE_FEATURE |
static String |
TYPE_FEATURE_COLLECTION |
static String |
TYPE_GEOMETRY_COLLECTION |
static String |
TYPE_LINE_STRING |
static String |
TYPE_MULTI_LINE_STRING |
static String |
TYPE_MULTI_POINT |
static String |
TYPE_MULTI_POLYGON |
static String |
TYPE_POINT |
static String |
TYPE_POLYGON |
| Constructor and Description |
|---|
GeoJSON() |
| Modifier and Type | Method and Description |
|---|---|
static GeoJSONObject |
parse(InputStream stream)
|
static GeoJSONObject |
parse(JSONObject json)
Parses the given JSONObject as GeoJSON and returns a concrete subclass of
GeoJSONObject corresponding to the type of the root object. |
static GeoJSONObject |
parse(String jsonString)
|
public static final String TYPE_POINT
public static final String TYPE_MULTI_POINT
public static final String TYPE_LINE_STRING
public static final String TYPE_MULTI_LINE_STRING
public static final String TYPE_POLYGON
public static final String TYPE_MULTI_POLYGON
public static final String TYPE_GEOMETRY_COLLECTION
public static final String TYPE_FEATURE
public static final String TYPE_FEATURE_COLLECTION
public static GeoJSONObject parse(JSONObject json)
GeoJSONObject corresponding to the type of the root object.
Example:
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [125.6, 10.1]
},
}
The above GeoJSON would return an instance of Feature.
json - A JSONObject to parse as GeoJSONGeoJSONObject.IllegalArgumentException - If the given object is not a valid GeoJSON type.public static GeoJSONObject parse(String jsonString) throws JSONException
jsonString - A String to parse as GeoJSONGeoJSONObject.JSONExceptionpublic static GeoJSONObject parse(InputStream stream) throws IOException, JSONException
stream - An InputStream to parse as GeoJSONGeoJSONObject.IOExceptionJSONException