Class StoreFormat
java.lang.Object
java.text.Format
org.apache.sis.io.CompoundFormat<Object>
org.apache.sis.io.wkt.WKTFormat
org.apache.sis.internal.storage.wkt.StoreFormat
- All Implemented Interfaces:
Serializable,Cloneable,Localized
Helper class for reading and writing WKT in the metadata of a data store.
This is provided as a separated class for allowing reuse by other data stores.
For example, WKT may also appear in some global attributes of CF-netCDF files.
- Since:
- 0.8
- Version:
- 1.2
- Author:
- Martin Desruisseaux (Geomatys)
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.text.Format
Format.Field -
Field Summary
Fields inherited from class org.apache.sis.io.wkt.WKTFormat
SINGLE_LINE -
Constructor Summary
ConstructorsConstructorDescriptionStoreFormat(Locale locale, TimeZone timezone, GeometryLibrary library, StoreListeners listeners) Creates a new WKT parser and encoder. -
Method Summary
Modifier and TypeMethodDescriptionorg.opengis.referencing.crs.CoordinateReferenceSystemParses the given WKTs as a coordinate reference system.org.opengis.geometry.GeometryparseGeometry(String geometry, String crs, String additionalCRS) Parses a geometry together with its coordinate reference system, all in Well Known Text (WKT).voidReports pending warnings and verifies if the parsed WKT is conform with the authority definition (if an authority code has been specified).Methods inherited from class org.apache.sis.io.wkt.WKTFormat
addFragment, clone, createFormat, format, getColors, getConvention, getFactory, getFragmentNames, getIndentation, getKeywordCase, getKeywordStyle, getLocale, getMaximumListElements, getNameAuthority, getSymbols, getTransliterator, getValueType, getWarnings, parse, setColors, setConvention, setFactory, setIndentation, setKeywordCase, setKeywordStyle, setMaximumListElements, setNameAuthority, setSymbols, setTransliteratorMethods inherited from class org.apache.sis.io.CompoundFormat
format, getFormat, getLocale, getTimeZone, parseObject, parseObjectMethods inherited from class java.text.Format
format, formatToCharacterIterator
-
Constructor Details
-
StoreFormat
public StoreFormat(Locale locale, TimeZone timezone, GeometryLibrary library, StoreListeners listeners) Creates a new WKT parser and encoder. The given locale will be used forlocalization; this is not the locale for number format.invalid reference
InternationalString- Parameters:
locale- the locale for the newFormat, ornullforLocale.ROOT.timezone- the timezone, ornullfor UTC.library- the geometry library, ornullfor the default.listeners- where to send warnings.
-
-
Method Details
-
parseGeometry
public org.opengis.geometry.Geometry parseGeometry(String geometry, String crs, String additionalCRS) Parses a geometry together with its coordinate reference system, all in Well Known Text (WKT).- Parameters:
geometry- the geometry to parse, ornullif none.crs- the horizontal part of the WKT (2D or 3D), ornullif none.additionalCRS- the vertical or temporal part of the WKT, ornullif none.- Returns:
- the geometry, or
nullif none or unparseable.
-
parseCRS
Parses the given WKTs as a coordinate reference system. The given array may contain two elements if, for example, vertical CRS is specified separately from horizontal CRS. If an exception occurs during parsing, it will be reported as a data store warning.- Parameters:
wkt- the Well Known Texts to parse. Null elements are ignored.- Returns:
- the parsed coordinate reference system, or
nullif none.
-
validate
Reports pending warnings and verifies if the parsed WKT is conform with the authority definition (if an authority code has been specified). This verification is not really necessary since we will use the WKT definition anyway even if we find discrepancies. But non-conform WKT definitions happen so often in practice that we are better to check and warn users.This method does not need to be invoked after
parseGeometry(…)orparseCRS(…)since it is already done.- Parameters:
parsed- the object parsed from WKT, ornullif none.
-