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

◆ hausdorffdistancedensify()

Datum hausdorffdistancedensify ( PG_FUNCTION_ARGS  )

Definition at line 163 of file postgis/lwgeom_geos.c.

164{
165 GSERIALIZED *geom1;
166 GSERIALIZED *geom2;
167 GEOSGeometry *g1;
168 GEOSGeometry *g2;
169 double densifyFrac;
170 double result;
171 int retcode;
172
173 geom1 = PG_GETARG_GSERIALIZED_P(0);
174 geom2 = PG_GETARG_GSERIALIZED_P(1);
175 densifyFrac = PG_GETARG_FLOAT8(2);
176
177 if ( gserialized_is_empty(geom1) || gserialized_is_empty(geom2) )
178 PG_RETURN_NULL();
179
180 initGEOS(lwpgnotice, lwgeom_geos_error);
181
182 g1 = POSTGIS2GEOS(geom1);
183 if (!g1)
184 HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
185
186 g2 = POSTGIS2GEOS(geom2);
187 if (!g2)
188 {
189 GEOSGeom_destroy(g1);
190 HANDLE_GEOS_ERROR("Second argument geometry could not be converted to GEOS");
191 }
192
193 retcode = GEOSHausdorffDistanceDensify(g1, g2, densifyFrac, &result);
194 GEOSGeom_destroy(g1);
195 GEOSGeom_destroy(g2);
196
197 if (retcode == 0) HANDLE_GEOS_ERROR("GEOSHausdorffDistanceDensify");
198
199 PG_FREE_IF_COPY(geom1, 0);
200 PG_FREE_IF_COPY(geom2, 1);
201
202 PG_RETURN_FLOAT8(result);
203}
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition cu_print.c:267
int gserialized_is_empty(const GSERIALIZED *g)
Check if a GSERIALIZED is empty without deserializing first.
void lwgeom_geos_error(const char *fmt,...)
GEOSGeometry * POSTGIS2GEOS(const GSERIALIZED *pglwgeom)
#define HANDLE_GEOS_ERROR(label)

References gserialized_is_empty(), HANDLE_GEOS_ERROR, lwgeom_geos_error(), POSTGIS2GEOS(), and result.

Here is the call graph for this function: