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 */
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 */
86 
87  /* add column with raster filename, 1 = yes, 0 = no (default) */
90 
91  /* overview factor */
93  int *overview;
95 
96  /* case-sensitive of identifiers, 1 = yes, 0 = no (default) */
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 */
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) */
126 
127  /* set constraints */
129 
130  /* enable max extent constraint, 1 = yes (default), 0 = no */
132 
133  /* enable regular_blocking constraint, 1 = yes, 0 = no (default) */
135 
136  /* new table's tablespace */
137  char *tablespace;
138 
139  /* new index's tablespace */
141 
142  /* flag indicating that user specified a nodata value */
144  /* nodata value for bands with no nodata value */
145  double nodataval;
146 
147  /* skip NODATA value check for bands */
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) */
158 
159  /* use COPY instead of INSERT */
161 
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 */
173 
174  /* number of bands */
175  int *nband; /* 1-based */
177 
178  /* array of pixeltypes */
179  GDALDataType *gdalbandtype;
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 
194 
195 typedef struct stringbuffer_t {
197  char **line;
rt_pixtype
Definition: librtcore.h:185
This library is the generic raster handling section of PostGIS.
struct stringbuffer_t STRINGBUFFER
struct raster_loader_config RTLOADERCFG
struct rasterinfo_t RASTERINFO
double * nodataval
Definition: raster2pgsql.h:185
rt_pixtype * bandtype
Definition: raster2pgsql.h:180
double gt[6]
Definition: raster2pgsql.h:188
uint32_t nband_count
Definition: raster2pgsql.h:176
GDALDataType * gdalbandtype
Definition: raster2pgsql.h:179
int tile_size[2]
Definition: raster2pgsql.h:191
uint32_t dim[2]
Definition: raster2pgsql.h:172
uint32_t length
Definition: raster2pgsql.h:196
unsigned int uint32_t
Definition: uthash.h:78