PostGIS
2.5.7dev-r@@SVN_REVISION@@
raster2pgsql.h
Go to the documentation of this file.
1
/*
2
*
3
* PostGIS Raster loader
4
* http://trac.osgeo.org/postgis/wiki/WKTRaster
5
*
6
* Copyright 2001-2003 Refractions Research Inc.
7
* Copyright 2009 Paul Ramsey <pramsey@cleverelephant.ca>
8
* Copyright 2009 Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>
9
* Copyright (C) 2011 Regents of the University of California
10
* <bkpark@ucdavis.edu>
11
*
12
* This program is free software; you can redistribute it and/or
13
* modify it under the terms of the GNU General Public License
14
* as published by the Free Software Foundation; either version 2
15
* of the License, or (at your option) any later version.
16
*
17
* This program is distributed in the hope that it will be useful,
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
* GNU General Public License for more details.
21
*
22
* You should have received a copy of the GNU General Public License
23
* along with this program; if not, write to the Free Software Foundation,
24
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25
*
26
*/
27
28
/* For internationalization */
29
#ifdef ENABLE_NLS
30
#include <libintl.h>
31
#include <locale.h>
32
#define _(String) gettext(String)
33
#define PACKAGE "raster2pgsql"
34
#else
35
#define _(String) String
36
#endif
37
38
#include <stddef.h>
39
#include <stdio.h>
40
#include <stdlib.h>
41
#include <string.h>
42
43
#include "
librtcore.h
"
44
45
#include "../../postgis_config.h"
46
#include "../raster_config.h"
47
48
#define CSEQUAL(a,b) (strcmp(a,b)==0)
49
50
/*
51
max length of of "name" data type in PostgreSQL as
52
defined in pg_config_manual.h as macro NAMEDATALEN
53
default is 64 bytes (63 usable characters plus NULL)
54
*/
55
#define MAXNAMELEN 63
56
57
/* minimum and maximum overview factor */
58
#define MINOVFACTOR 2
59
#define MAXOVFACTOR 1000
60
61
/*
62
maximum tile size
63
based upon maximum field size as defined for PostgreSQl
64
http://www.postgresql.org/about/
65
66
1 GB = 1024 x 1024 x 1024
67
*/
68
#define MAXTILESIZE 1073741824
69
70
#define RCSID "$Id$"
71
72
typedef
struct
raster_loader_config
{
73
/* raster filename */
74
uint32_t
rt_file_count
;
75
char
**
rt_file
;
76
char
**
rt_filename
;
77
78
/* schema to load into */
79
char
*
schema
;
80
81
/* table to load into */
82
char
*
table
;
83
84
/* raster column name specified by user */
85
char
*
raster_column
;
86
87
/* add column with raster filename, 1 = yes, 0 = no (default) */
88
int
file_column
;
89
char
*
file_column_name
;
90
91
/* overview factor */
92
uint32_t
overview_count
;
93
int
*
overview
;
94
char
**
overview_table
;
95
96
/* case-sensitive of identifiers, 1 = yes, 0 = no (default) */
97
int
quoteident
;
98
99
/* SRID of input raster */
100
int
srid
;
101
102
/* SRID of output raster (reprojection) */
103
int
out_srid
;
104
105
/* bands to extract */
106
int
*
nband
;
/* 1-based */
107
uint32_t
nband_count
;
108
109
/* tile size */
110
int
tile_size
[2];
111
112
/* pad tiles */
113
int
pad_tile
;
114
115
/* register raster as of out-of-db, 1 = yes, 0 = no (default) */
116
int
outdb
;
117
118
/* type of operation, (d|a|c|p) */
119
char
opt
;
120
121
/* create index, 1 = yes, 0 = no (default) */
122
int
idx
;
123
124
/* maintenance statements, 1 = yes, 0 = no (default) */
125
int
maintenance
;
126
127
/* set constraints */
128
int
constraints
;
129
130
/* enable max extent constraint, 1 = yes (default), 0 = no */
131
int
max_extent
;
132
133
/* enable regular_blocking constraint, 1 = yes, 0 = no (default) */
134
int
regular_blocking
;
135
136
/* new table's tablespace */
137
char
*
tablespace
;
138
139
/* new index's tablespace */
140
char
*
idx_tablespace
;
141
142
/* flag indicating that user specified a nodata value */
143
int
hasnodata
;
144
/* nodata value for bands with no nodata value */
145
double
nodataval
;
146
147
/* skip NODATA value check for bands */
148
int
skip_nodataval_check
;
149
150
/* endianness of binary output, 0 = XDR, 1 = NDR (default) */
151
int
endian
;
152
153
/* version of output format */
154
int
version
;
155
156
/* use a transaction, 0 = no, 1 = yes (default) */
157
int
transaction
;
158
159
/* use COPY instead of INSERT */
160
int
copy_statements
;
161
162
}
RTLOADERCFG
;
163
164
typedef
struct
rasterinfo_t
{
165
/* SRID of raster */
166
int
srid
;
167
168
/* srs of raster */
169
char
*
srs
;
170
171
/* width, height */
172
uint32_t
dim
[2];
173
174
/* number of bands */
175
int
*
nband
;
/* 1-based */
176
uint32_t
nband_count
;
177
178
/* array of pixeltypes */
179
GDALDataType *
gdalbandtype
;
180
rt_pixtype
*
bandtype
;
181
182
/* array of hasnodata flags */
183
int
*
hasnodata
;
184
/* array of nodatavals */
185
double
*
nodataval
;
186
187
/* geotransform matrix */
188
double
gt
[6];
189
190
/* tile size */
191
int
tile_size
[2];
192
193
}
RASTERINFO
;
194
195
typedef
struct
stringbuffer_t
{
196
uint32_t
length
;
197
char
**
line
;
198
}
STRINGBUFFER
;
rt_pixtype
rt_pixtype
Definition:
librtcore.h:185
librtcore.h
This library is the generic raster handling section of PostGIS.
STRINGBUFFER
struct stringbuffer_t STRINGBUFFER
RTLOADERCFG
struct raster_loader_config RTLOADERCFG
RASTERINFO
struct rasterinfo_t RASTERINFO
raster_loader_config::idx_tablespace
char * idx_tablespace
Definition:
raster2pgsql.h:140
raster_loader_config::tile_size
int tile_size[2]
Definition:
raster2pgsql.h:110
raster_loader_config::file_column
int file_column
Definition:
raster2pgsql.h:88
raster_loader_config::nband_count
uint32_t nband_count
Definition:
raster2pgsql.h:107
raster_loader_config::out_srid
int out_srid
Definition:
raster2pgsql.h:103
raster_loader_config::rt_filename
char ** rt_filename
Definition:
raster2pgsql.h:76
raster_loader_config::max_extent
int max_extent
Definition:
raster2pgsql.h:131
raster_loader_config::opt
char opt
Definition:
raster2pgsql.h:119
raster_loader_config::schema
char * schema
Definition:
raster2pgsql.h:79
raster_loader_config::tablespace
char * tablespace
Definition:
raster2pgsql.h:137
raster_loader_config::overview_table
char ** overview_table
Definition:
raster2pgsql.h:94
raster_loader_config::raster_column
char * raster_column
Definition:
raster2pgsql.h:85
raster_loader_config::srid
int srid
Definition:
raster2pgsql.h:100
raster_loader_config::quoteident
int quoteident
Definition:
raster2pgsql.h:97
raster_loader_config::outdb
int outdb
Definition:
raster2pgsql.h:116
raster_loader_config::file_column_name
char * file_column_name
Definition:
raster2pgsql.h:89
raster_loader_config::hasnodata
int hasnodata
Definition:
raster2pgsql.h:143
raster_loader_config::transaction
int transaction
Definition:
raster2pgsql.h:157
raster_loader_config::version
int version
Definition:
raster2pgsql.h:154
raster_loader_config::pad_tile
int pad_tile
Definition:
raster2pgsql.h:113
raster_loader_config::nodataval
double nodataval
Definition:
raster2pgsql.h:145
raster_loader_config::endian
int endian
Definition:
raster2pgsql.h:151
raster_loader_config::regular_blocking
int regular_blocking
Definition:
raster2pgsql.h:134
raster_loader_config::skip_nodataval_check
int skip_nodataval_check
Definition:
raster2pgsql.h:148
raster_loader_config::copy_statements
int copy_statements
Definition:
raster2pgsql.h:160
raster_loader_config::idx
int idx
Definition:
raster2pgsql.h:122
raster_loader_config::rt_file_count
uint32_t rt_file_count
Definition:
raster2pgsql.h:74
raster_loader_config::constraints
int constraints
Definition:
raster2pgsql.h:128
raster_loader_config::rt_file
char ** rt_file
Definition:
raster2pgsql.h:75
raster_loader_config::nband
int * nband
Definition:
raster2pgsql.h:106
raster_loader_config::overview
int * overview
Definition:
raster2pgsql.h:93
raster_loader_config::overview_count
uint32_t overview_count
Definition:
raster2pgsql.h:92
raster_loader_config::maintenance
int maintenance
Definition:
raster2pgsql.h:125
raster_loader_config::table
char * table
Definition:
raster2pgsql.h:82
raster_loader_config
Definition:
raster2pgsql.h:72
rasterinfo_t::srs
char * srs
Definition:
raster2pgsql.h:169
rasterinfo_t::srid
int srid
Definition:
raster2pgsql.h:166
rasterinfo_t::nodataval
double * nodataval
Definition:
raster2pgsql.h:185
rasterinfo_t::hasnodata
int * hasnodata
Definition:
raster2pgsql.h:183
rasterinfo_t::bandtype
rt_pixtype * bandtype
Definition:
raster2pgsql.h:180
rasterinfo_t::gt
double gt[6]
Definition:
raster2pgsql.h:188
rasterinfo_t::nband_count
uint32_t nband_count
Definition:
raster2pgsql.h:176
rasterinfo_t::gdalbandtype
GDALDataType * gdalbandtype
Definition:
raster2pgsql.h:179
rasterinfo_t::tile_size
int tile_size[2]
Definition:
raster2pgsql.h:191
rasterinfo_t::dim
uint32_t dim[2]
Definition:
raster2pgsql.h:172
rasterinfo_t::nband
int * nband
Definition:
raster2pgsql.h:175
rasterinfo_t
Definition:
raster2pgsql.h:164
stringbuffer_t::length
uint32_t length
Definition:
raster2pgsql.h:196
stringbuffer_t::line
char ** line
Definition:
raster2pgsql.h:197
stringbuffer_t
Definition:
stringbuffer.h:38
uint32_t
unsigned int uint32_t
Definition:
uthash.h:78
raster
loader
raster2pgsql.h
Generated by
1.9.1