Chinaunix首页 | 论坛 | 博客
  • 博客访问: 126790
  • 博文数量: 31
  • 博客积分: 2010
  • 博客等级: 大尉
  • 技术积分: 275
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-08 15:00
文章分类

全部博文(31)

文章存档

2009年(15)

2008年(16)

我的朋友

分类:

2008-11-10 11:18:18

ESRI Shapefile

.shp describe spatial data format

A sharp file stores nontopological(非拓扑) geometry(几何) and attribute information for the spatial features in a data set. The geometry for a feature is stored as a shape comprising a set of vector coordinates.

Shapefiles do not have the processing overhead of a topological data structure(shp格式文件没有处理拓扑格式结构的处理开销),they have advantages over other data such as a faster drawing and speed and edit ability. Shapefiles handle single features that overlap or that are noncontiguous. They also typically require less disk space and are easier to read and write.

Shapefiles support point, line, and area features. Area features are represented as closes loop. Double-digitized polygons(多边形). Attributes are held in a dBASE format file. Each attribute record has a one-to-one relationship

with the associated shaperecord.


Construct of shp file:

main file: a direct access, variable-record-length(可变记录长) file in which each record describes a shape with a list of its vertices.

index fileeach record contains the offset of the corresponding main file record from the beginning of the main file.

dBASE the dBASE table contains feature attributes with one record per feature

The one-to-one relationship between geometry and attributes is based on record number. Attributes records in the dBASE file must be in the same order as records in the main file.(几何形状与其属性是一对一的关系,并有一个记录号确认,所以dBASE的顺序要与main file中的记录顺序一致)


文件的详细结构:

1 main file

contain a fixed-length file header followed by variable-length records.

Each variable-length record is made up of a fixed-length record header followed by variable-length record contents.

file Header (fixed-length) 100bytes

Record Header(fixed-length)8bytes

Record Contents (variable-length)

Record Header(fixed-length)8bytes

Record Contents (variable-length)

Record Header(fixed-length)8bytes

Record Contents (variable-length)

... 8bytes

Record Contents (variable-length)

... 8bytes

Record Contents (variable-length)

Record Header(fixed-length)8bytes

Record Contents (variable-length)

Figure1.main file

术语解释:

Byte Order (字节表单)(shp格式文件的内容可以被分成两个类属)

——数据相关

— Main file 记录内容

— Main file 头文件数据描述字段(Shape Type, Bounding Box, etc)

——文件管理相关

文件和记录长度

记录偏移

The Main File Header

Position

Field

Value

Type

Byte Order

Byte 0

File Code

9994

Integer

Big

Byte 4

Unused

0

Integer

Big

Byte 8

Unused

0

Integer

Big

Byte 12

Unused

0

Integer

Big

Byte 16

Unused

0

Integer

Big

Byte 20

Unused

0

Integer

Big

Byte 24

File Length

File Length

Integer

Big

Byte 28

Version

1000

Integer

Little

Byte 32

Shape Type

Shape Type

Double

Little

Byte 36

Bounding Box

Xmin

Double

Little

Byte 44

Bounding Box

Ymin

Double

Little

Byte 52

Bounding Box

Xmax

Double

Little

Byte 60

Bounding Box

Ymax

Double

Little

Byte 68

Bounding Box

Zmin

Double

Little

Byte 76

Bounding Box

Zmax

Double

Little

Byte 84

Bounding Box

Mmin

Double

Little

Byte 92

Bounding Box

Mmax

Double

Little

实际文件的格式

9994

0

0

0

0

0

0

8765 (16bytes)

1000

`````

Shape type

0

Null Shape

8

MultiPoint

18

MultiPointZ

28

MultiPointM

1

Point

11

PointZ

21

PointM

31

MultiPatch

3

PolyLine

13

PolyLineZ

23

PolyLineM



5

Polugon

15

PolygonZ

25

PolygonM




阅读(1928) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~