Search for projections given extent and (optional) auth_name returns TABLE(auth_name, auth_srid, srtext, proj4text, point_sw, point_ne)
703{
704 FuncCallContext *funcctx;
705 MemoryContext oldcontext;
708
709
710
711
712
713
714
715 if (SRF_IS_FIRSTCALL())
716 {
719 text *auth_name = PG_GETARG_TEXT_P(1);
720
721 funcctx = SRF_FIRSTCALL_INIT();
722 oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
723
724
725
726
727
728
730
731
733
734
735
736
737
738
739 if (get_call_result_type(fcinfo, 0, &funcctx->tuple_desc) != TYPEFUNC_COMPOSITE)
740 {
741 ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
742 errmsg("%s called with incompatible return type", __func__)));
743 }
744
745 BlessTupleDesc(funcctx->tuple_desc);
746 funcctx->user_fctx = state;
747 MemoryContextSwitchTo(oldcontext);
748 }
749
750
751 funcctx = SRF_PERCALL_SETUP();
752 state = funcctx->user_fctx;
753
754
757 {
758 SRF_RETURN_DONE(funcctx);
759 }
760
761
764 funcctx->tuple_desc);
765
767 SRF_RETURN_NEXT(funcctx,
result);
768
769
770 SRF_RETURN_DONE(funcctx);
771}
char result[OUT_DOUBLE_BUFFER_SIZE]
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
static struct srs_data * srs_state_init()
static Datum srs_tuple_from_entry(const struct srs_entry *entry, TupleDesc tuple_desc)
static void srs_find_planar(const char *auth_name, const LWGEOM *bounds, struct srs_data *state)
struct srs_entry * entries