-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
137 lines (113 loc) · 3.3 KB
/
types.go
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
package main
// DBType 数据库类型
type DBType string
// Supported db drivers
const (
Sqlite3 DBType = "sqlite3"
Postgres = "postgres"
Spatialite = "spatialite"
)
// CRS coordinate reference system
type CRS string
// Supported CRSs
const (
WGS84 CRS = "WGS84"
CGCS2000 = "CGCS2000"
GCJ02 = "GCJ02"
BD09 = "BD09"
)
//CRSs 支持的坐标系
var CRSs = []CRS{WGS84, CGCS2000, GCJ02, BD09}
//Encoding text encoding
type Encoding string
// Supported encodings
const (
UTF8 Encoding = "utf-8"
GBK = "gbk"
BIG5 = "big5"
GB18030 = "gb18030"
)
//Encodings 支持的编码格式
var Encodings = []Encoding{UTF8, GBK, BIG5, GB18030}
// FieldType is a convenience alias that can be used for a more type safe way of
// reason and use Series types.
type FieldType string
// Supported Series Types
const (
String FieldType = "string"
Bool = "bool"
Int = "int"
Float = "float"
Date = "date"
StringArray = "string_array"
Geojson = "geojson"
)
//FieldTypes 支持的字段类型
var FieldTypes = []FieldType{String, Int, Float, Date, Bool}
// DataFormat is an enum that defines the data format of a file
type DataFormat string
// Constants representing TileFormat types
const (
// ZIPEXT DataFormat = ".zip"
ZIPEXT = ".zip"
CSVEXT = ".csv"
SHPEXT = ".shp"
KMLEXT = ".kml"
GPXEXT = ".gpx"
GEOJSONEXT = ".geojson"
)
//DataFormats 数据类型集合
var DataFormats = []DataFormat{ZIPEXT, CSVEXT, SHPEXT, KMLEXT, GPXEXT, GEOJSONEXT}
// TileFormat is an enum that defines the tile format of a tile
type TileFormat string
// Constants representing TileFormat types
const (
GZIP TileFormat = "gzip" // encoding = gzip
ZLIB = "zlib" // encoding = deflate
PNG = "png"
JPG = "jpg"
PBF = "pbf"
WEBP = "webp"
)
//TileFormats 支持的瓦片类型
var TileFormats = []TileFormat{GZIP, ZLIB, PNG, JPG, PBF, WEBP}
// ContentType returns the MIME content type of the tile
func (t TileFormat) ContentType() string {
switch t {
case PNG:
return "image/png"
case JPG:
return "image/jpeg"
case PBF:
return "application/x-protobuf" // Content-Encoding header must be gzip
case WEBP:
return "image/webp"
default:
return ""
}
}
//TaskType 任务类型
type TaskType string
// Constants representing TileFormat types
const (
DSIMPORT TaskType = "dsimport" // encoding = gzip
TSUPLOAD = "tsupload" // encoding = deflate
TSIMPORT = "tsimport" // encoding = deflate
DS2TS = "ds2ts" // encoding = deflate
)
//TaskTypes 支持的瓦片类型
var TaskTypes = []TaskType{DSIMPORT, TSIMPORT}
//GeoType 几何类型
type GeoType string
// A list of the datasets types that are currently supported.
const (
Point GeoType = "Point"
MultiPoint = "MultiPoint"
LineString = "LineString"
MultiLineString = "MultiLineString"
Polygon = "Polygon"
MultiPolygon = "MultiPolygon"
Attribute = "Attribute" //属性数据表,non-spatial
)
//GeoTypes 支持的字段类型
var GeoTypes = []GeoType{Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, Attribute}