PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches
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
72typedef struct raster_loader_config {
73 /* raster filename */
74 uint32_t rt_file_count;
75 char **rt_file;
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 */
95
96 /* case-sensitive of identifiers, 1 = yes, 0 = no (default) */
98
99 /* SRID of input raster */
100 int32_t srid;
101
102 /* SRID of output raster (reprojection) */
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 */
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 */
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) */
152
153 /* version of output format */
155
156 /* use a transaction, 0 = no, 1 = yes (default) */
158
159 /* use COPY instead of INSERT */
161
164
166
167typedef struct rasterinfo_t {
168 /* SRID of raster */
169 int32_t srid;
170
171 /* srs of raster */
172 char *srs;
173
174 /* width, height */
175 uint32_t dim[2];
176
177 /* number of bands */
178 int *nband; /* 1-based */
179 uint32_t nband_count;
180
181 /* array of pixeltypes */
182 GDALDataType *gdalbandtype;
184
185 /* array of hasnodata flags */
187 /* array of nodatavals */
188 double *nodataval;
189
190 /* geotransform matrix */
191 double gt[6];
192
193 /* tile size */
194 int tile_size[2];
195
197
198typedef struct stringbuffer_t {
199 uint32_t length;
200 char **line;
rt_pixtype
Definition librtcore.h:188
This library is the generic raster handling section of PostGIS.
struct stringbuffer_t STRINGBUFFER
struct raster_loader_config RTLOADERCFG
struct rasterinfo_t RASTERINFO
uint32_t max_tiles_per_copy
max tiles per copy
double * nodataval
rt_pixtype * bandtype
double gt[6]
uint32_t nband_count
GDALDataType * gdalbandtype
uint32_t dim[2]