1963{
1964 char *hexewkb = NULL;
1965 unsigned char *hexewkb_binary = NULL;
1966 size_t hexewkb_len;
1967 char *val;
1970
1971 int i, geocolnum = 0;
1972
1973
1975 {
1979 }
1980
1981
1983 {
1984
1987
1989 if (PQresultStatus(state->
fetchres) != PGRES_TUPLES_OK)
1990 {
1994 }
1995
1998 }
1999
2000
2002 geocolnum = PQfnumber(state->
fetchres,
"_geoX");
2003
2004
2005
2007 {
2008
2009
2010
2011
2012
2013
2014
2016 {
2018 }
2019 else
2020 {
2023 }
2024
2025
2027 {
2031 }
2032 }
2033
2034
2036 {
2037
2039 {
2042 {
2047 }
2049 }
2050 else
2051 {
2052
2054
2056 {
2058 {
2059 LWDEBUG(4,
"PostGIS >= 1.0, non-binary cursor");
2060
2061
2062
2063 hexewkb_binary = PQunescapeBytea((unsigned char *)val, &hexewkb_len);
2065 }
2066 else
2067 {
2068 LWDEBUG(4,
"PostGIS < 1.0, non-binary cursor");
2069
2070
2071
2073 hexewkb =
malloc(hexewkb_len + 1);
2074 strncpy(hexewkb, val, hexewkb_len + 1);
2075 }
2076 }
2077 else
2078 {
2079 LWDEBUG(4,
"PostGIS (any version) using binary cursor");
2080
2081
2084 }
2085
2086 LWDEBUGF(4,
"HexEWKB - length: %lu value: %s", strlen(hexewkb), hexewkb);
2087
2088
2090 if (!lwgeom)
2091 {
2096 }
2097
2098
2100
2101 switch (lwgeom->
type)
2102 {
2105 {
2107 }
2108 else
2109 {
2111 }
2112 break;
2113
2116 break;
2117
2120 break;
2121
2124 break;
2125
2128 break;
2129
2132 break;
2133
2134 default:
2139 }
2140
2141
2143
2144
2146 {
2151 }
2152
2154
2155
2156 if (hexewkb)
free(hexewkb);
2157 if (hexewkb_binary) PQfreemem(hexewkb_binary);
2158 }
2159 }
2160
2161
2164
2166}
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, SHPLIB_NULLPTR, SHPLIB_NULLPTR, nVertices, padfX, padfY, padfZ, SHPLIB_NULLPTR)
int SHPAPI_CALL SHPWriteObject(SHPHandle psSHP, int nShapeId, SHPObject *psObject)
char message[SHPDUMPERMSGLEN]