48{
49 unsigned int n = 0;
51 GEOSGeometry *isect;
52 GEOSGeometry *surface_pt;
53 const GEOSCoordSequence *seq;
54
55 isect = GEOSIntersection(g1, g2);
56 if (!isect)
57 return false;
58
59 surface_pt = GEOSPointOnSurface(isect);
60 GEOSGeom_destroy(isect);
61 if (!surface_pt)
62 return false;
63
64 seq = GEOSGeom_getCoordSeq(surface_pt);
65 if (!seq)
66 {
67 GEOSGeom_destroy(surface_pt);
68 return false;
69 }
70
71 if (!GEOSCoordSeq_getSize(seq, &n) || !n)
72 {
73 GEOSGeom_destroy(surface_pt);
74 return false;
75 }
76
77 if (!GEOSCoordSeq_getX(seq, 0, &pt.
x) || !GEOSCoordSeq_getY(seq, 0, &pt.
y))
78 {
79 GEOSGeom_destroy(surface_pt);
80 return false;
81 }
82
83 GEOSGeom_destroy(surface_pt);
84 snprintf(buf, bufsize,
" at POINT(%.15g %.15g)", pt.
x, pt.
y);
85 return true;
86}