1965{
1966 char *hexewkb = NULL;
1967 unsigned char *hexewkb_binary = NULL;
1968 size_t hexewkb_len;
1969 char *val;
1972
1973 int i, geocolnum = 0;
1974
1975
1977 {
1981 }
1982
1983
1985 {
1986
1989
1991 if (PQresultStatus(state->
fetchres) != PGRES_TUPLES_OK)
1992 {
1996 }
1997
2000 }
2001
2002
2004 geocolnum = PQfnumber(state->
fetchres,
"_geoX");
2005
2006
2007
2009 {
2010
2011
2012
2013
2014
2015
2016
2018 {
2020 }
2021 else
2022 {
2025 }
2026
2027
2029 {
2033 }
2034 }
2035
2036
2038 {
2039
2041 {
2044 {
2049 }
2051 }
2052 else
2053 {
2054
2056
2058 {
2060 {
2061 LWDEBUG(4,
"PostGIS >= 1.0, non-binary cursor");
2062
2063
2064
2065 hexewkb_binary = PQunescapeBytea((unsigned char *)val, &hexewkb_len);
2067 }
2068 else
2069 {
2070 LWDEBUG(4,
"PostGIS < 1.0, non-binary cursor");
2071
2072
2073
2075 hexewkb =
malloc(hexewkb_len + 1);
2076 strncpy(hexewkb, val, hexewkb_len + 1);
2077 }
2078 }
2079 else
2080 {
2081 LWDEBUG(4,
"PostGIS (any version) using binary cursor");
2082
2083
2086 }
2087
2088 LWDEBUGF(4,
"HexEWKB - length: %d value: %s", strlen(hexewkb), hexewkb);
2089
2090
2092 if (!lwgeom)
2093 {
2098 }
2099
2100
2102
2103 switch (lwgeom->
type)
2104 {
2107 {
2109 }
2110 else
2111 {
2113 }
2114 break;
2115
2118 break;
2119
2122 break;
2123
2126 break;
2127
2130 break;
2131
2134 break;
2135
2136 default:
2141 }
2142
2143
2145
2146
2148 {
2153 }
2154
2156
2157
2158 if (hexewkb)
free(hexewkb);
2159 if (hexewkb_binary) PQfreemem(hexewkb_binary);
2160 }
2161 }
2162
2163
2166
2168}
int SHPAPI_CALL DBFWriteAttributeDirectly(DBFHandle psDBF, int hEntity, int iField, void *pValue)
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
void lwgeom_free(LWGEOM *geom)
#define LW_PARSER_CHECK_NONE
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
LWPOLY * lwgeom_as_lwpoly(const LWGEOM *lwgeom)
LWMLINE * lwgeom_as_lwmline(const LWGEOM *lwgeom)
LWMPOLY * lwgeom_as_lwmpoly(const LWGEOM *lwgeom)
LWGEOM * lwgeom_from_hexwkb(const char *hexwkb, const char check)
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
LWMPOINT * lwgeom_as_lwmpoint(const LWGEOM *lwgeom)
#define LWDEBUG(level, msg)
#define LWDEBUGF(level, msg,...)
static LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
static SHPObject * create_polygon(SHPDUMPERSTATE *state, LWPOLY *lwpolygon)
static SHPObject * create_multipolygon(SHPDUMPERSTATE *state, LWMPOLY *lwmultipolygon)
char * convert_bytes_to_hex(uint8_t *ewkb, size_t size)
Binary to hexewkb conversion function.
static SHPObject * create_linestring(SHPDUMPERSTATE *state, LWLINE *lwlinestring)
static SHPObject * create_point_empty(SHPDUMPERSTATE *state, LWPOINT *lwpoint)
static char * goodDBFValue(char *in, char fieldType)
Make appropriate formatting of a DBF value based on type.
static SHPObject * create_point(SHPDUMPERSTATE *state, LWPOINT *lwpoint)
static char * nullDBFValue(char fieldType)
static SHPObject * create_multipoint(SHPDUMPERSTATE *state, LWMPOINT *lwmultipoint)
static SHPObject * create_multilinestring(SHPDUMPERSTATE *state, LWMLINE *lwmultilinestring)
void SHPAPI_CALL SHPDestroyObject(SHPObject *psObject)
SHPObject SHPAPI_CALL1 * SHPCreateSimpleObject(int nSHPType, int nVertices, const double *padfX, const double *padfY, const double *padfZ){ return(SHPCreateObject(nSHPType, -1, 0, NULL, NULL, nVertices, padfX, padfY, padfZ, NULL)
int SHPAPI_CALL SHPWriteObject(SHPHandle psSHP, int nShapeId, SHPObject *psObject)
char message[SHPDUMPERMSGLEN]