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