-
-
Notifications
You must be signed in to change notification settings - Fork 180
/
shx.hexpat
52 lines (45 loc) · 1 KB
/
shx.hexpat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#pragma author Calcoph
#pragma description ESRI shapefile indices
// Spec:
// https://www.esri.com/content/dam/esrisites/sitecore-archive/Files/Pdfs/library/whitepapers/pdfs/shapefile.pdf
enum ShapeType: u32 {
Null = 0,
Point = 1,
PolyLine = 3,
Polygon = 5,
MultiPoint = 8,
PointZ = 11,
PolyLineZ = 13,
PolygonZ = 15,
MultiPointZ = 18,
PointM = 21,
PolyLineM = 23,
PolygonM = 25,
MultiPointM = 28,
MultiPatch = 32,
};
struct Header {
be u32 magic; // 9994
padding[20]; // unused
be u32 file_length; // in 16-bit words (including header)
u32 version; // 1000
ShapeType shape_type;
// Bounding box
double bb_xmin;
double bb_ymin;
double bb_xmax;
double bb_ymax;
double bb_zmin;
double bb_zmax;
double bb_mmin;
double bb_mmax;
};
struct Record {
u32 offset;
u32 content_length;
};
struct IndexFile {
Header header;
Record records[while($ < header.file_length * 2)];
};
IndexFile file @ 0x00;