ShapefileWriter is a
JUMPWriter specialized to write Shapefiles.
DataProperties for the ShapefileWriter write(DataProperties) interface:
Parameter |
Meaning |
OutputFile or DefaultValue |
File name for the output .shp file |
ShapeType |
Dimentionality of the Shapefile - 'xy', 'xym' or 'xyz'. 'xymz' and
'xyzm' are the same as 'xyz'
|
NOTE: The input .dbf and .shx is assumed to be 'beside' (in the
same directory) as the .shp file.
The shapefile writer consists of two parts: writing attributes
(.dbf) and writing geometries (.shp).
JUMP columns are converted to DBF columns by:
JUMP Column |
DBF column |
STRING |
Type 'C' – length is size of longest string in the FeatureCollection |
DOUBLE |
Type 'N' – length is 33, with 16 digits right of the decimal |
INTEGER |
Type 'N' – length is 16, with 0 digits right of the decimal |
For more information on the DBF file format, see the
DBF Specification FAQ
Since shape files may contain only one type of geometry (POINT,
MULTPOINT, POLYLINE, POLYGON, POINTM, MULTPOINTM, POLYLINEM,
POLYGONM, POINTZ, MULTPOINTZ, POLYLINEZ, or POLYGONZ), the
FeatureCollection must be first be normalized to one type:
First non-NULL non-Point geometry in FeatureCollection |
Coordinate Dimensionality |
Shape Type |
MULTIPOINT
|
xy xym xyzm
|
MULTIPOINT MULTIPOINTM MULTIPOINTZ
|
LINESTRING/MULTILINESTRING
|
xy xym xyzm
|
POLYLINE POLYLINEM POLYLINEZ
|
POLYGON/MULTIPOLYGON
|
xy xym xyzm
|
POLYGON POLYGONM POLYGONZ
|
All geometries in FeatureCollection are |
Coordinate Dimensionality |
Shape Type |
POINT
|
xy xym xyzm
|
POINT POINTM POINTZ
|
During this normalization process any non-consistent geometry will
be replaced by a NULL geometry.
For example, if the shapetype is determined to be 'POLYLINE' any
POINT, MULTIPOINT, or POLYGON geometries in the FeatureCollection
will be replaced with a NULL geometry.
The coordinate dimensionality can be explicitly set with a
DataProperties tag of 'ShapeType': 'xy', 'xym', or 'xyz' ('xymz'
and 'xyzm' are pseudonyms for 'xyz'). If this DataProperties is
unspecified, it will be auto set to 'xy' or 'xyz' based on the
first non-NULL geometry having a Z coordinate.
Since JUMP and JTS do not currently support a M (measure)
coordinate, it will always be set to –10E40 in the shape file
(type 'xym' or 'xyzm'). This value represents the Measure "no
data" value (page 2, ESRI Shapefile Technical Description). Since
the 'NaN' DOUBLE values for Z coordinates is invalid in a
shapefile, it is converted to '0.0'.
For more information on the shapefile format, see the
ESRI
Shapefile Spec
|