public class VectorUtilities extends java.lang.Object
Constructor and Description |
---|
VectorUtilities() |
Modifier and Type | Method and Description |
---|---|
static void |
closeDataStores()
Close all data stores opened in this thread while reading files.
|
static org.opengis.feature.simple.SimpleFeatureType |
createEmptySchema(org.opengis.referencing.crs.CoordinateReferenceSystem defaultCRS)
Create an empty feature schema
|
static void |
main(java.lang.String[] args)
For debugging, ignore.
|
static VectorToken |
readFile(java.io.File inputFile)
Create a vector token from reading a file containing features.
|
static VectorToken |
readFile(java.io.File inputFile,
java.lang.String typeNameStr)
Create a vector token from a specific type in a file containing features.
|
static VectorToken |
readFile(java.io.File inputFile,
java.lang.String typeNameStr,
org.opengis.referencing.crs.CoordinateReferenceSystem defaultCRS)
Create a vector token from a specific type in a file containing features.
|
static VectorToken |
readGeoJSONString(java.lang.String geoJSON)
Read a string containing GeoJSON.
|
static VectorToken |
readGeoJSONString(java.lang.String geoJSON,
org.opengis.referencing.crs.CoordinateReferenceSystem defaultCRS)
Read a string containing GeoJSON using a default CRS.
|
static org.geotools.data.simple.SimpleFeatureCollection |
readGeoJSONString(java.lang.String geoJSON,
org.opengis.referencing.crs.CoordinateReferenceSystem defaultCRS,
org.opengis.feature.simple.SimpleFeatureType defaultType)
Read a string containing GeoJSON.
|
static VectorToken |
readGeoString(java.lang.String geoString,
org.opengis.referencing.crs.CoordinateReferenceSystem defaultCRS)
Read a string containing either GML or GeoJSON.
|
static VectorToken |
readGMLString(java.lang.String gmlString)
Read a string containing GML.
|
static VectorToken |
readWFS(java.lang.String urlStr,
java.lang.String typeNameStr)
Get a vector token from a WFS service.
|
static org.geotools.data.simple.SimpleFeatureCollection |
reproject(org.geotools.data.simple.SimpleFeatureCollection features,
org.opengis.referencing.crs.CoordinateReferenceSystem destCRS)
Reproject a set of features.
|
static org.geotools.data.simple.SimpleFeatureCollection |
reproject(org.geotools.data.simple.SimpleFeatureCollection features,
org.opengis.referencing.crs.CoordinateReferenceSystem crs,
org.opengis.referencing.crs.CoordinateReferenceSystem destCRS)
Reproject a set of features from the specified coordinate reference system.
|
static org.geotools.data.simple.SimpleFeatureCollection |
setCRS(org.geotools.data.simple.SimpleFeatureCollection features,
org.opengis.referencing.crs.CoordinateReferenceSystem defaultCRS)
Set the coordinate reference system for a set of features.
|
static java.lang.String |
toGeoJSONString(org.geotools.data.simple.SimpleFeatureCollection features)
Convert a set of features into a GeoJSON string.
|
public VectorUtilities()
public static void closeDataStores()
public static org.opengis.feature.simple.SimpleFeatureType createEmptySchema(org.opengis.referencing.crs.CoordinateReferenceSystem defaultCRS)
defaultCRS
- The default CRS. can be null.public static VectorToken readFile(java.io.File inputFile) throws IllegalActionException, java.io.IOException
IllegalActionException
java.io.IOException
public static VectorToken readFile(java.io.File inputFile, java.lang.String typeNameStr) throws IllegalActionException, java.io.IOException
inputFile
- the file to readtypeNameStr
- the feature type in the file to read. this can be
null, but must be specified if more than one feature type is present
in the file.IllegalActionException
java.io.IOException
public static VectorToken readFile(java.io.File inputFile, java.lang.String typeNameStr, org.opengis.referencing.crs.CoordinateReferenceSystem defaultCRS) throws IllegalActionException, java.io.IOException
inputFile
- the file to readtypeNameStr
- the feature type in the file to read. this can be
null, but must be specified if more than one feature type is present
in the file.crs
- The coordinate reference system used if not specified in the file.IllegalActionException
java.io.IOException
public static VectorToken readGeoString(java.lang.String geoString, org.opengis.referencing.crs.CoordinateReferenceSystem defaultCRS) throws IllegalActionException, java.io.IOException, JSONException
IllegalActionException
java.io.IOException
JSONException
public static VectorToken readGeoJSONString(java.lang.String geoJSON) throws java.io.IOException, JSONException, IllegalActionException
java.io.IOException
JSONException
IllegalActionException
public static VectorToken readGeoJSONString(java.lang.String geoJSON, org.opengis.referencing.crs.CoordinateReferenceSystem defaultCRS) throws java.io.IOException, JSONException, IllegalActionException
java.io.IOException
JSONException
IllegalActionException
public static org.geotools.data.simple.SimpleFeatureCollection readGeoJSONString(java.lang.String geoJSON, org.opengis.referencing.crs.CoordinateReferenceSystem defaultCRS, org.opengis.feature.simple.SimpleFeatureType defaultType) throws java.io.IOException, JSONException, IllegalActionException
geoJSON
- the geojson string.defaultCRS
- CRS used if one not found in geojson string.defaultType
- feture type used if one not found in geojson string.java.io.IOException
JSONException
IllegalActionException
public static VectorToken readGMLString(java.lang.String gmlString) throws java.io.IOException, IllegalActionException
java.io.IOException
IllegalActionException
public static VectorToken readWFS(java.lang.String urlStr, java.lang.String typeNameStr) throws java.io.IOException, IllegalActionException
urlStr
- the WFS urltypeNameStr
- the feature type to read. can be null, but must
be specified if more than one type exists on in the WFS service.java.io.IOException
IllegalActionException
public static org.geotools.data.simple.SimpleFeatureCollection reproject(org.geotools.data.simple.SimpleFeatureCollection features, org.opengis.referencing.crs.CoordinateReferenceSystem destCRS) throws IllegalActionException
features
- The set of features.destCRS
- The new coordinate reference system.IllegalActionException
public static org.geotools.data.simple.SimpleFeatureCollection reproject(org.geotools.data.simple.SimpleFeatureCollection features, org.opengis.referencing.crs.CoordinateReferenceSystem crs, org.opengis.referencing.crs.CoordinateReferenceSystem destCRS) throws IllegalActionException
features
- The set of features.crs
- The source coordinate reference system.destCRS
- The new coordinate reference system.IllegalActionException
public static org.geotools.data.simple.SimpleFeatureCollection setCRS(org.geotools.data.simple.SimpleFeatureCollection features, org.opengis.referencing.crs.CoordinateReferenceSystem defaultCRS)
public static java.lang.String toGeoJSONString(org.geotools.data.simple.SimpleFeatureCollection features)
public static void main(java.lang.String[] args)