1:- module(
    2  wkt,
    3  [
    4    wkt_boundary/2,             % +Wkt, -Boundary
    5    wkt_contains/2,             % +Wkt1, +Wkt2
    6    wkt_convex_hull/2,          % +Wkt, -ConvexHull
    7    wkt_crosses/2,              % +Wkt1, +Wkt2
    8    wkt_difference/3,           % +Wkt1, +Wkt2, -Difference
    9    wkt_disjoint/2,             % +Wkt1, +Wkt2
   10    wkt_distance/3,             % +Wkt1, +Wkt2, -Distance
   11    wkt_envelope/2,             % +Wkt, -Envelope
   12    wkt_equals/2,               % +Wkt1, +Wkt2
   13    wkt_intersection/3,         % +Wkt1, +Wkt2, -Intersection
   14    wkt_intersects/2,           % +Wkt1, +Wkt2
   15    wkt_overlaps/2,             % +Wkt1, +Wkt2
   16    wkt_shape_atom/2,           % ?Shape, ?Atom
   17    wkt_symmetric_difference/3, % +Wkt1, +Wkt2, -Difference
   18    wkt_touches/2,              % +Wkt1, +Wkt2
   19    wkt_union/3,                % +Wkt1, +Wkt2, -Wkt3
   20    wkt_within/2                % +Wkt1, +Wkt2
   21  ]
   22).

Well-Known Text (WKT) support

*/

   28:- use_module(library(error)).   29:- use_module(library(shlib)).   30
   31:- use_module(library(dcg)).   32:- use_module(library(geo)).   33:- use_module(library(wkt_generate)).   34:- use_module(library(wkt_parse)).   35
   36:- use_foreign_library(foreign(geo)).
 wkt_boundary(+Wkt:atom, -Boundary:atom) is det
   42wkt_boundary(Wkt, Boundary) :-
   43  wkt_boundary_(Wkt, Boundary).
 wkt_contains(+Wkt1:atom, +Wkt2:atom) is semidet
   49wkt_contains(Wkt1, Wkt2) :-
   50  wkt_contains_(Wkt1, Wkt2).
 wkt_convex_hull(+Wkt:atom, -ConvexHull:atom) is det
   56wkt_convex_hull(Wkt, ConvexHull) :-
   57  wkt_convex_hull_(Wkt, ConvexHull).
 wkt_crosses(+Wkt1:atom, +Wkt2:atom) is semidet
   63wkt_crosses(Wkt1, Wkt2) :-
   64  wkt_crosses_(Wkt1, Wkt2).
 wkt_difference(+Wkt1:atom, +Wkt2:atom, -Difference:atom) is det
   70wkt_difference(Wkt1, Wkt2, Difference) :-
   71  wkt_difference_(Wkt1, Wkt2, Difference).
 wkt_disjoint(+Wkt1:atom, +Wkt2:atom) is semidet
   77wkt_disjoint(Wkt1, Wkt2) :-
   78  wkt_disjoint_(Wkt1, Wkt2).
 wkt_distance(+Wkt1:atom, +Wkt2:atom, -Distance:double) is det
   84wkt_distance(Wkt1, Wkt2, Distance) :-
   85  wkt_distance_(Wkt1, Wkt2, Distance).
 wkt_envelope(+Wkt:atom, -Envelope:atom) is det
   91wkt_envelope(Wkt, Envelope) :-
   92  wkt_envelope_(Wkt, Envelope).
 wkt_equals(+Wkt1:atom, +Wkt2:atom) is semidet
   98wkt_equals(Wkt1, Wkt2) :-
   99  wkt_equals_(Wkt1, Wkt2).
 wkt_intersection(+Wkt1:atom, +Wkt2:atom, -Intersection:atom) is det
  105wkt_intersection(Wkt1, Wkt2, Intersection) :-
  106  wkt_intersection_(Wkt1, Wkt2, Intersection).
 wkt_intersects(+Wkt1:atom, +Wkt2:atom) is semidet
  112wkt_intersects(Wkt1, Wkt2) :-
  113  wkt_intersects_(Wkt1, Wkt2).
 wkt_overlaps(+Wkt1:atom, +Wkt2:atom) is semidet
  119wkt_overlaps(Wkt1, Wkt2) :-
  120  wkt_overlaps_(Wkt1, Wkt2).
 wkt_shape_atom(+Shape:compound, -Atom:atom)
  126wkt_shape_atom(Shape, Atom) :-
  127  nonvar(Shape), !,
  128  atom_phrase(wkt_generate(Shape), Atom).
  129wkt_shape_atom(Shape, Atom) :-
  130  nonvar(Atom), !,
  131  atom_phrase(wkt_parse(Shape), Atom).
  132wkt_shape_atom(Shape, Atom) :-
  133  instantiation_error(args([Shape,Atom])).
 wkt_symmetric_difference(+Wkt1:atom, +Wkt2:atom, -Difference:atom) is det
  139wkt_symmetric_difference(Wkt1, Wkt2, Difference) :-
  140  wkt_symmetric_difference_(Wkt1, Wkt2, Difference).
 wkt_touches(+Wkt1:atom, +Wkt2:atom) is semidet
  146wkt_touches(Wkt1, Wkt2) :-
  147  wkt_touches_(Wkt1, Wkt2).
 wkt_union(+Wkt1:atom, +Wkt2:atom, +Wkt3:atom) is det
  153wkt_union(Wkt1, Wkt2, Wkt3) :-
  154  wkt_union_(Wkt1, Wkt2, Wkt3).
 wkt_within(+Wkt1:atom, +Wkt2:atom) is semidet
  160wkt_within(Wkt1, Wkt2) :-
  161  wkt_within_(Wkt1, Wkt2)