Namespace NetTopologySuite.IO
Contains the interfaces for converting JTS objects to and from other formats.
The Net Topology Suite (NTS) is a .Net API that implements a core set of spatial data operations using an explicit precision model and robust geometric algorithms. NTS is intended to be used in the development of applications that support the validation, cleaning, integration and querying of spatial datasets.
NTS attempts to implement the OpenGIS Simple Features Specification (SFS) as accurately as possible. In some cases the SFS is unclear or omits a specification; in this case NTS attempts to choose a reasonable and consistent alternative. Differences from and elaborations of the SFS are documented in this specification.
Package Specification
- Java Topology Suite Technical Specifications
- OpenGIS Simple Features Specification for SQL
Classes
BEBinaryWriter
Extends the BinaryWriter class to allow writing values in the BigEndian format.
BiEndianBinaryReader
Extends the BinaryReader class to allow reading values in the specified format.
OrdinateFormat
Formats numeric values for ordinates in a consistent, accurate way.
The format has the following characteristics:
ParseException
Thrown by a WKTReader
when a parsing problem occurs.
WKBHexFileReader
Reads a sequence of {@link Geometry}s in WKBHex format from a text file. Each WKBHex geometry must be on a single line The geometries in the file may be separated by any amount of whitespace and newlines.
WKBReader
Converts a Well-Known Binary byte data to a Geometry
.
WKBWriter
Writes a Well-Known Binary byte data representation of a Geometry
.
WKTConstants
Constants used in the WKT (Well-Known Text) format.
WKTFileReader
Reads a sequence of Geometrys in WKT format from a text file.
WKTReader
Converts a Well-Known Text string to a Geometry
.
The WKTReader
allows
extracting Geometry
objects from either input streams or
internal strings. This allows it to function as a parser to read Geometry
objects from text blocks embedded in other data formats (e.g. XML).
The Well-known Text format is defined in the OpenGIS Simple Features Specification for SQL .
As of version 2.0, NTS can read WKT syntax
which specifies coordinate dimension Z, M or ZM as modifiers(e.g.POINT Z)
or in the name of the geometry type(e.g.LINESTRINGZM).
If the coordinate dimension is specified it will be set in the created geometry.
If the coordinate dimension is not specified, the default behaviour is to
create XYZ geometry(this is backwards compatible with older JTS versions).
This can be altered to create XY geometry by
setting IsOldNtsCoordinateSyntaxAllowed to false
.
A reader can be set to ensure the input is structurally valid
by setting FixStructure to true
.
This ensures that geometry can be constructed without errors due to missing coordinates.
The created geometry may still be topologically invalid.
NOTE: There is an inconsistency in the SFS.
The WKT grammar states that MultiPoints
are represented by
MULTIPOINT ( ( x y), (x y) )
,
but the examples show MultiPoint
s as MULTIPOINT ( x y, x y )
.
Other implementations follow the latter syntax, so NTS will adopt it as well.
A WKTReader
is parameterized by a GeometryFactory
,
to allow it to create Geometry
objects of the appropriate
implementation. In particular, the GeometryFactory
will
determine the PrecisionModel
and SRID
that is used.
The WKTReader
will convert the input numbers to the precise
internal representation.
WKTWriter
Outputs the textual representation of a Geometry. The WKTWriter outputs coordinates rounded to the precision model. No more than the maximum number of necessary decimal places will be output. The Well-known Text format is defined in the OpenGIS Simple Features Specification for SQL. A non-standard "LINEARRING" tag is used for LinearRings. The WKT spec does not define a special tag for LinearRings. The standard tag to use is "LINESTRING".
Structs
GeometryType
Lightweight class that handles OGC Geometry type declaration
Enums
ByteOrder
Byte order
WKBGeometryTypes
WKB Geometry Types
WKBReader.CoordinateSystem
WKB Coordinate Systems