LWGEOM *lwgeom1 = lwgeom_from_gserialized(geom1);
LWGEOM *lwgeom2 = lwgeom_from_gserialized(geom2);
- if (lwgeom1->srid != lwgeom2->srid)
- {
- elog(ERROR,"Operation on two GEOMETRIES with different SRIDs\n");
- PG_RETURN_NULL();
- }
-
+ error_if_srid_mismatch(lwgeom1->srid, lwgeom2->srid);
+
mindist = lwgeom_mindistance3d_tolerance(lwgeom1,lwgeom2,0.0);
PG_FREE_IF_COPY(geom1, 0);
/* Calculate some other parameters on the spheroid */
spheroid_init(sphere, sphere->a, sphere->b);
+ error_if_srid_mismatch(gserialized_get_srid(geom1), gserialized_get_srid(geom2));
+
/* Catch sphere special case and re-jig spheroid appropriately */
if ( ! use_spheroid )
{
PG_RETURN_NULL();
}
-
- if (gserialized_get_srid(geom1) != gserialized_get_srid(geom2))
- {
- elog(ERROR, "geometry_distance_spheroid: Operation on two GEOMETRIES with different SRIDs\n");
- PG_RETURN_NULL();
- }
-
/* Get #LWGEOM structures */
lwgeom1 = lwgeom_from_gserialized(geom1);
lwgeom2 = lwgeom_from_gserialized(geom2);