You are here: FME Readers and Writers > Esri Shape Reader/Writer

Esri Shape Reader/Writer

The Esri® Shape Reader and Writer module allows FME to read and write Esri’s Shape format. The Shape format is the native format of Esri’s ArcView product and has been made public by Esri.

Overview

ESRI shapefiles store both geometry and attributes for features. No topological information is stored.

A shapefile is a logical construct that consists of a series of physical files with different extensions. These extensions are added to the base name of the shapefile. All files must reside in the same directory.

Data Types

Shape does not support small integer (16bit) or integer (32bit) data types. Instead, it supports a number(x,y) data type. The equivalent data types are:

File Structure

File Name Extension Contents

.shp

Geometric data

.shx

Index to the geometric data

.dbf

Attributes for the geometric data

.sbn and .sbx

Spatial index for the geometric data. These two files will not be written unless 'Write Spatial Index ' is selected in the FME Workbench writer parameters dialog.

.atx

Attribute index for the geometric data. These files are named as filename.attributename.atx. Attribute indexes are created for any user attributes that are flagged for indexing. For more information, see Writing Attribute Indexes.

.shz

Zipped file that contains all the files that comprise a Shape dataset.

For example, coast.shz will contain coast.shp, coast.dbf, coast.shx, and optionally other shapefiles if applicable.

The main (.shp) file is a direct access, variable-record-length file in which each record describes a shape (feature) with a list of its vertices. A single .shp file can contain only one type of geometry. Supported geometries are point, multipoint, polyline, polygon, and multipatch.

Each entity in a .shp file has a corresponding entry in the .shx index file and a corresponding row of attributes in the associated .dbf file. The order of the entries in each of these files is synchronized. For example, the third geometric entity in the .shp file is pointed to by the third entry in the .shx index file and has the attributes held in the third row of the .dbf file.

In the index (.shx) file , each record contains the offset of the corresponding main file record from the beginning of the main file.

The dBASE file (.dbf) contains feature attributes, with one record per feature – that is, a one-to-one relationship between a record in the main file and its attributes in the dBASE file – based on record number. For example, if the type of geometry in the main file is multipoint, the .dbf file will have one row for each set of points held in the main file. If the type of geometry in the main file is point, there will be one row in the .dbf file for each point.

Attribute records in the dBASE file must be in the same order as records in the main file. All features in the same shapefile will have the same number and type of attributes.

Any single DBF (attribute) file can have a maximum file size of 2 GB, a limit imposed by the dBase III specification. Files larger than 2 GB may be readable, but not officially supported. Files larger than 2 GB are not writable, and will produce an error message.

Working with Large Datasets

Shape datasets larger than 2 GB are considered invalid (and were probably not created with Esri software), due to the following:

  1. Internal pointers between the index file (.shx) and main file (.shp) are stored as signed 32 bit integers. This is a limitation of operating system architecture.
  2. Attribute files (.dbf) files also have a 2 GB size limit.
  3. The main file (.shp) header contains information on the size of the file, specified as a signed integer. Writing a Shape dataset greater than 2 GB would invalidate the file header.

Because indexes are measured in "words", FME can read and write 4 GB files. However, these files may not function properly with other applications. Further, on some 32-bit operating systems, there is no way to reference a location in a file more than 2 GB from the beginning.

Working with Esri Shape Geometry

Shapefiles can hold both two- and three-dimensional geometry, as well as an optional measure value on each vertex. However, all features within a single shapefile will have the same dimensionality. Note that while older Esri products may only support two-dimensional shapefiles, FME can read and write both two- and three-dimensional shapefiles. FME can also handle measure data associated with features.

Aggregate linear features and aggregate polygonal features may be created using the Aggregator transformer. They may be broken into their component pieces for output to formats that do not support aggregation using the Deaggregator transformer.

If a polygon containing holes is written to a Shapefile, any adjacent holes will be merged into a single hole before the polygon is output.

Measures

If the FME feature contains an "unnamed" measure and the destination feature type is an "m" type (for example, shape_polylinem), then FME will write the measure.

In the FME Data Inspector, these measures are labeled <default_measure>. If the feature has a named measure (for example, distanceMeasure), the Shape writer will ignore it, and then measures on the shape_polylinem will be undefined.

The Shape reader will automatically load the <default_measure> if an "m" type geometry is read (for example, shape_polylinem).

Measures are currently not supported when reading or writing the shape_multipatch geometry type.