A Spatial Index is a variation on a Shape Index, adding the bounding box of the shape to the index.
The file has a 100 byte header identical to a Shape Index followed by n records.
The record layout of the spatial index is as follows:
Position | Field | Value | Type | Byte Order |
Byte 0 | Offset | Offset | Integer | Big |
Byte 4 | Content Length | Content Length | Integer | Big |
Byte 8 | Bounding Box | Xmin | Double | Little |
Byte 16 | Bounding Box | Ymin | Double | Little |
Byte 24 | Bounding Box | Xmax | Double | Little |
Byte 32 | Bounding Box | Ymax | Double | Little |
Usage
java com.bbn.openmap.layer.shape.SpatialIndex -d file.ssx Dumps spatial index information, excluding bounding boxes to stdout. Useful for comparing to a shape index.
java com.bbn.openmap.layer.shape.SpatialIndex -d -b file.ssx Dumps spatial index information including bounding boxes to stdout.
java com.bbn.openmap.layer.shape.SpatialIndex -c file.shp Creates spatial index file.ssx
from shape file file.shp
.
Notes
When reading the Shape file, the content length is the length of the record's contents, exclusive of the record header (8 bytes). So the size that we need to read in from the Shape file is actually denoted as ((contentLength * 2) + 8). This converts from 16bit units to 8 bit bytes and adds the 8 bytes for the record header.
To Do
- index arcs
- index multipoints
@author Tom Mitchell
@version $Revision: 1.6.2.8 $ $Date: 2008/10/10 00:35:11 $
@see ShapeIndex