PostGIS
2.5.7dev-r@@SVN_REVISION@@
lwgeom_geos_relatematch.c
Go to the documentation of this file.
1
/**********************************************************************
2
*
3
* PostGIS - Spatial Types for PostgreSQL
4
* http://postgis.net
5
*
6
* PostGIS is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 2 of the License, or
9
* (at your option) any later version.
10
*
11
* PostGIS is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with PostGIS. If not, see <http://www.gnu.org/licenses/>.
18
*
19
**********************************************************************
20
*
21
* Copyright (C) 2010 Sandro Santilli <strk@kbt.io>
22
*
23
**********************************************************************/
24
25
26
#include "postgres.h"
27
#include "fmgr.h"
28
#include "funcapi.h"
29
#include "utils/builtins.h"
30
31
#include "../postgis_config.h"
32
#include "
lwgeom_geos.h
"
33
#include "lwgeom_pg.h"
34
35
#include <string.h>
36
#include <assert.h>
37
38
/* #define POSTGIS_DEBUG_LEVEL 4 */
39
40
Datum
ST_RelateMatch
(PG_FUNCTION_ARGS);
41
PG_FUNCTION_INFO_V1
(
ST_RelateMatch
);
42
Datum
ST_RelateMatch
(PG_FUNCTION_ARGS)
43
{
44
char
*mat, *pat;
45
text *mat_text, *pat_text;
46
int
result;
47
48
/* Read the arguments */
49
mat_text = (PG_GETARG_TEXT_P(0));
50
pat_text = (PG_GETARG_TEXT_P(1));
51
52
/* Convert from text to cstring */
53
mat =
text_to_cstring
(mat_text);
54
pat =
text_to_cstring
(pat_text);
55
56
initGEOS(lwpgnotice,
lwgeom_geos_error
);
57
58
result = GEOSRelatePatternMatch(mat, pat);
59
if
(result == 2)
60
{
61
lwfree
(mat);
lwfree
(pat);
62
lwpgerror(
"GEOSRelatePatternMatch: %s"
,
lwgeom_geos_errmsg
);
63
PG_RETURN_NULL();
64
}
65
66
lwfree
(mat);
lwfree
(pat);
67
PG_RETURN_BOOL(result);
68
}
69
lwgeom_geos_errmsg
char lwgeom_geos_errmsg[LWGEOM_GEOS_ERRMSG_MAXSIZE]
Definition:
liblwgeom/lwgeom_geos.c:40
lwgeom_geos_error
void lwgeom_geos_error(const char *fmt,...)
Definition:
liblwgeom/lwgeom_geos.c:43
lwgeom_geos.h
lwfree
void lwfree(void *mem)
Definition:
lwutil.c:244
ST_RelateMatch
Datum ST_RelateMatch(PG_FUNCTION_ARGS)
Definition:
lwgeom_geos_relatematch.c:42
PG_FUNCTION_INFO_V1
PG_FUNCTION_INFO_V1(ST_RelateMatch)
text_to_cstring
char * text_to_cstring(const text *textptr)
postgis
lwgeom_geos_relatematch.c
Generated by
1.9.1