ShapeFormat

Description

[ShutdownSurvive]
abstract class Tinman.Terrain.Shapes.ShapeFormat

Derived from

FileFormat abstract

The supported 2D vector shape file formats.

Public / Constants

Any


public static readonly attribute Any → (ShapeFormat)

The file format is unknown and will be determined automatically.

Use IFileFormat.Next to walk through all registered formats.

CSH


public static readonly attribute CSH → (ShapeFormat)

The CSH shape file format ('Compiled SHape', proprietary).

IANA media type: none
File extensions: .csh
Prefix sequence: yes

See also

Shape.ReadCSH2

JSON


public static readonly attribute JSON → (ShapeFormat)

The GeoJSON format (https://geojson.org).

IANA media type: application/geo+json
File extensions: .json, .geojson
Prefix sequence: no

Third position number values (see '3.1.1. Position') are stored in ShapeValue.Vertical and fourth position number values are stored in ShapeValue.Custom.

SHP


public static readonly attribute SHP → (ShapeFormat)

The ESRI Shapefile format (https://support.esri.com/en/white-paper/279).

IANA media type: application/vnd.shp
File extensions: .shp
Prefix sequence: yes

Given a main file named filename.shp, the following additional files are used:

  • filename.shx
    An index file that holds the offset and length of each shape record in the main file. If existent, it will be used to access the shape records unless it contains inconsistent offsets and lengths, in which case it will be ignored. If the index file is not existent or ignored, the main file structure is traversed to access the shape records. In the latter case, the main file must be packed, i.e. there must not be any undefined data between shape records or after the last shape record.

  • filename.prj
    A text file that contains the coordinate system specification of the shape. If existent and ReadShapeFlags.Geo is used, it will be read with CoordinateSystem.FromWkt and its information will be accessible via IShapeInfo.Georef.

  • filename.dbf
    A dBASE table file that contains a row of metadata for each shape record. If existent and ReadShapeFlags.Meta is used, it will be read and will be accessible via IShapeInfo.Metadata. The binary data of record fields that represent character strings is assumed to be encoded with UTF-8.

The unique ordinal number identifiers (see IShapeReaderInfo.PeekId) have the same values as the shape record numbers, minus one.

Shape Z-coordinates are stored as ShapeValue.Vertical values and shape measure values are stored as ShapeValue.Custom.

Public / Methods

For​Name


public static method ForName → (1)

name in : string

[not-empty]
The shape file format name.

returns → ShapeFormat

The shape file format or Any if not found.

Returns a shape file format by its IFileFormat.Name.

Read​Shapes

2 overloads


[OwnerReturn]
public method ReadShapes1 → (2)

data in : Path

[not-null]
The shape data file.

flags opt : ReadShapeFlags = ReadShapeFlags.Default

The shape reading flags. A IShapeReader implementation may add default flags (see ReadShapeFlags.Default) and may ignore non-default flags. The effective shape reading flags may be queried with IShapeReaderInfo.Flags.

returns → IShapeReader

The IShapeReader for reading the shape data.

Reads the given shape.

IOException

If an I/O error has occurred while opening the shape data.

ValidatingException

If a validation error has occurred on data in or the returned shape reader.


[OwnerReturn]
public method ReadShapes2 → (2)

data in : IFileData

[not-null]
The shape data provider.

flags opt : ReadShapeFlags = ReadShapeFlags.Default

The shape reading flags. A IShapeReader implementation may add default flags (see ReadShapeFlags.Default) and may ignore non-default flags. The effective shape reading flags may be queried with IShapeReaderInfo.Flags.

returns → IShapeReader

The IShapeReader for reading the shape data.

Reads the given shape.

IOException

If an I/O error has occurred while opening the shape data.

ValidatingException

If a validation error has occurred on data in or the returned shape reader.

Protected / Constructors

Shape​Format


protected constructor ShapeFormat → (4)

name in : string

[not-empty]
Value for IFileFormat.Name

description in : string

[not-empty]
Value for IFileFormat.Description

mime in : string

Value for IFileFormat.Mime

isAny opt : bool = false

Is this an automatic file format?

Creates a new instance of ShapeFormat.

Protected / Methods

Do​Read​Shapes


[OwnerReturn]
protected abstract method DoReadShapes → (2)

data in : IFileData

The shape data provider: will never be null and IValidatable.Validate did not report any errors.

flags in : ReadShapeFlags

The shape reading flags.

returns → IShapeReader

The IShapeReader for reading the shape data. The IValidatable.Validate has not yet been called on it.

Reads the given shape.

IOException

If an I/O error has occurred while opening the shape.