PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ create_point()

static SHPObject * create_point ( SHPDUMPERSTATE state,
LWPOINT lwpoint 
)
static

Definition at line 103 of file pgsql2shp-core.c.

104{
105 SHPObject *obj;
106 POINT4D p4d;
107
108 double *xpts, *ypts, *zpts, *mpts;
109
110 /* Allocate storage for points */
111 xpts = malloc(sizeof(double));
112 ypts = malloc(sizeof(double));
113 zpts = malloc(sizeof(double));
114 mpts = malloc(sizeof(double));
115
116 /* Grab the point: note getPoint4d will correctly handle
117 the case where the POINTs don't contain Z or M coordinates */
118 p4d = getPoint4d(lwpoint->point, 0);
119
120 xpts[0] = p4d.x;
121 ypts[0] = p4d.y;
122 zpts[0] = p4d.z;
123 mpts[0] = p4d.m;
124
125 LWDEBUGF(4, "Point: %g %g %g %g", xpts[0], ypts[0], zpts[0], mpts[0]);
126
127 obj = SHPCreateObject(state->outshptype, -1, 0, NULL, NULL, 1, xpts, ypts, zpts, mpts);
128
129 free(xpts);
130 free(ypts);
131 free(zpts);
132 free(mpts);
133
134 return obj;
135}
POINT4D getPoint4d(const POINTARRAY *pa, uint32_t n)
Definition lwgeom_api.c:107
#define LWDEBUGF(level, msg,...)
Definition lwgeom_log.h:106
void * malloc(YYSIZE_T)
void free(void *)
SHPObject SHPAPI_CALL1 * SHPCreateObject(int nSHPType, int nShapeId, int nParts, const int *panPartStart, const int *panPartType, int nVertices, const double *padfX, const double *padfY, const double *padfZ, const double *padfM);SHPObject SHPAPI_CALL1(*) SHPCreateSimpleObject(int nSHPType, int nVertices, const double *padfX, const double *padfY, const double *padfZ
POINTARRAY * point
Definition liblwgeom.h:471
double m
Definition liblwgeom.h:414
double x
Definition liblwgeom.h:414
double z
Definition liblwgeom.h:414
double y
Definition liblwgeom.h:414

References free(), getPoint4d(), LWDEBUGF, POINT4D::m, malloc(), shp_dumper_state::outshptype, LWPOINT::point, SHPCreateObject(), POINT4D::x, POINT4D::y, and POINT4D::z.

Referenced by ShpLoaderGenerateShapeRow().

Here is the call graph for this function:
Here is the caller graph for this function: