PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ create_point()

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

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

101 {
102  SHPObject *obj;
103  POINT4D p4d;
104 
105  double *xpts, *ypts, *zpts, *mpts;
106 
107  /* Allocate storage for points */
108  xpts = malloc(sizeof(double));
109  ypts = malloc(sizeof(double));
110  zpts = malloc(sizeof(double));
111  mpts = malloc(sizeof(double));
112 
113  /* Grab the point: note getPoint4d will correctly handle
114  the case where the POINTs don't contain Z or M coordinates */
115  p4d = getPoint4d(lwpoint->point, 0);
116 
117  xpts[0] = p4d.x;
118  ypts[0] = p4d.y;
119  zpts[0] = p4d.z;
120  mpts[0] = p4d.m;
121 
122  LWDEBUGF(4, "Point: %g %g %g %g", xpts[0], ypts[0], zpts[0], mpts[0]);
123 
124  obj = SHPCreateObject(state->outshptype, -1, 0, NULL, NULL, 1, xpts, ypts, zpts, mpts);
125 
126  free(xpts);
127  free(ypts);
128  free(zpts);
129  free(mpts);
130 
131  return obj;
132 }
POINT4D getPoint4d(const POINTARRAY *pa, uint32_t n)
Definition: lwgeom_api.c:108
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
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: