Skip to content

Commit c2e7cd5

Browse files
committed
wrap GEOS 3.8.0
1 parent 0a40f5c commit c2e7cd5

File tree

3 files changed

+93
-11
lines changed

3 files changed

+93
-11
lines changed

gen/wrap_geos.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ like `GEOS_VERSION`, which are just strings, are correct.
1313

1414
using Clang
1515
using MacroTools
16+
using GEOS_jll
1617

17-
includedir = normpath(joinpath(@__DIR__, "..", "deps", "usr", "include"))
18+
# maybe use GEOS_jll.prefix later pending https://github.com/JuliaPackaging/BinaryBuilder.jl/pull/525
19+
includedir = abspath(joinpath(dirname(GEOS_jll.libgeos_path), "..", "include"))
1820
headerfiles = [joinpath(includedir, "geos_c.h")]
1921

2022
"""

src/geos_c.jl

Lines changed: 84 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,14 @@ function GEOSCoordSeq_setZ_r(handle, s, idx, val)
114114
ccall((:GEOSCoordSeq_setZ_r, libgeos), Cint, (GEOSContextHandle_t, Ptr{GEOSCoordSequence}, UInt32, Cdouble), handle, s, idx, val)
115115
end
116116

117+
function GEOSCoordSeq_setXY_r(handle, s, idx, x, y)
118+
ccall((:GEOSCoordSeq_setXY_r, libgeos), Cint, (GEOSContextHandle_t, Ptr{GEOSCoordSequence}, UInt32, Cdouble, Cdouble), handle, s, idx, x, y)
119+
end
120+
121+
function GEOSCoordSeq_setXYZ_r(handle, s, idx, x, y, z)
122+
ccall((:GEOSCoordSeq_setXYZ_r, libgeos), Cint, (GEOSContextHandle_t, Ptr{GEOSCoordSequence}, UInt32, Cdouble, Cdouble, Cdouble), handle, s, idx, x, y, z)
123+
end
124+
117125
function GEOSCoordSeq_setOrdinate_r(handle, s, idx, dim, val)
118126
ccall((:GEOSCoordSeq_setOrdinate_r, libgeos), Cint, (GEOSContextHandle_t, Ptr{GEOSCoordSequence}, UInt32, UInt32, Cdouble), handle, s, idx, dim, val)
119127
end
@@ -130,6 +138,14 @@ function GEOSCoordSeq_getZ_r(handle, s, idx, val)
130138
ccall((:GEOSCoordSeq_getZ_r, libgeos), Cint, (GEOSContextHandle_t, Ptr{GEOSCoordSequence}, UInt32, Ptr{Cdouble}), handle, s, idx, val)
131139
end
132140

141+
function GEOSCoordSeq_getXY_r(handle, s, idx, x, y)
142+
ccall((:GEOSCoordSeq_getXY_r, libgeos), Cint, (GEOSContextHandle_t, Ptr{GEOSCoordSequence}, UInt32, Ptr{Cdouble}, Ptr{Cdouble}), handle, s, idx, x, y)
143+
end
144+
145+
function GEOSCoordSeq_getXYZ_r(handle, s, idx, x, y, z)
146+
ccall((:GEOSCoordSeq_getXYZ_r, libgeos), Cint, (GEOSContextHandle_t, Ptr{GEOSCoordSequence}, UInt32, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cdouble}), handle, s, idx, x, y, z)
147+
end
148+
133149
function GEOSCoordSeq_getOrdinate_r(handle, s, idx, dim, val)
134150
ccall((:GEOSCoordSeq_getOrdinate_r, libgeos), Cint, (GEOSContextHandle_t, Ptr{GEOSCoordSequence}, UInt32, UInt32, Ptr{Cdouble}), handle, s, idx, dim, val)
135151
end
@@ -214,6 +230,10 @@ function GEOSGeom_createPoint_r(handle, s)
214230
ccall((:GEOSGeom_createPoint_r, libgeos), Ptr{GEOSGeometry}, (GEOSContextHandle_t, Ptr{GEOSCoordSequence}), handle, s)
215231
end
216232

233+
function GEOSGeom_createPointFromXY_r(handle, x, y)
234+
ccall((:GEOSGeom_createPointFromXY_r, libgeos), Ptr{GEOSGeometry}, (GEOSContextHandle_t, Cdouble, Cdouble), handle, x, y)
235+
end
236+
217237
function GEOSGeom_createEmptyPoint_r(handle)
218238
ccall((:GEOSGeom_createEmptyPoint_r, libgeos), Ptr{GEOSGeometry}, (GEOSContextHandle_t,), handle)
219239
end
@@ -302,6 +322,10 @@ function GEOSUnaryUnion_r(handle, g)
302322
ccall((:GEOSUnaryUnion_r, libgeos), Ptr{GEOSGeometry}, (GEOSContextHandle_t, Ptr{GEOSGeometry}), handle, g)
303323
end
304324

325+
function GEOSCoverageUnion_r(handle, g)
326+
ccall((:GEOSCoverageUnion_r, libgeos), Ptr{GEOSGeometry}, (GEOSContextHandle_t, Ptr{GEOSGeometry}), handle, g)
327+
end
328+
305329
function GEOSUnionCascaded_r(handle, g)
306330
ccall((:GEOSUnionCascaded_r, libgeos), Ptr{GEOSGeometry}, (GEOSContextHandle_t, Ptr{GEOSGeometry}), handle, g)
307331
end
@@ -314,6 +338,10 @@ function GEOSGetCentroid_r(handle, g)
314338
ccall((:GEOSGetCentroid_r, libgeos), Ptr{GEOSGeometry}, (GEOSContextHandle_t, Ptr{GEOSGeometry}), handle, g)
315339
end
316340

341+
function GEOSMinimumBoundingCircle_r(handle, g, radius, center)
342+
ccall((:GEOSMinimumBoundingCircle_r, libgeos), Ptr{GEOSGeometry}, (GEOSContextHandle_t, Ptr{GEOSGeometry}, Ptr{Cdouble}, Ptr{Ptr{GEOSGeometry}}), handle, g, radius, center)
343+
end
344+
317345
function GEOSNode_r(handle, g)
318346
ccall((:GEOSNode_r, libgeos), Ptr{GEOSGeometry}, (GEOSContextHandle_t, Ptr{GEOSGeometry}), handle, g)
319347
end
@@ -326,6 +354,10 @@ function GEOSPolygonize_r(handle, geoms, ngeoms)
326354
ccall((:GEOSPolygonize_r, libgeos), Ptr{GEOSGeometry}, (GEOSContextHandle_t, Ptr{Ptr{GEOSGeometry}}, UInt32), handle, geoms, ngeoms)
327355
end
328356

357+
function GEOSPolygonize_valid_r(handle, geoms, ngems)
358+
ccall((:GEOSPolygonize_valid_r, libgeos), Ptr{GEOSGeometry}, (GEOSContextHandle_t, Ptr{Ptr{GEOSGeometry}}, UInt32), handle, geoms, ngems)
359+
end
360+
329361
function GEOSPolygonizer_getCutEdges_r(handle, geoms, ngeoms)
330362
ccall((:GEOSPolygonizer_getCutEdges_r, libgeos), Ptr{GEOSGeometry}, (GEOSContextHandle_t, Ptr{Ptr{GEOSGeometry}}, UInt32), handle, geoms, ngeoms)
331363
end
@@ -334,6 +366,10 @@ function GEOSPolygonize_full_r(handle, input, cuts, dangles, invalidRings)
334366
ccall((:GEOSPolygonize_full_r, libgeos), Ptr{GEOSGeometry}, (GEOSContextHandle_t, Ptr{GEOSGeometry}, Ptr{Ptr{GEOSGeometry}}, Ptr{Ptr{GEOSGeometry}}, Ptr{Ptr{GEOSGeometry}}), handle, input, cuts, dangles, invalidRings)
335367
end
336368

369+
function GEOSBuildArea_r(handle, g)
370+
ccall((:GEOSBuildArea_r, libgeos), Ptr{GEOSGeometry}, (GEOSContextHandle_t, Ptr{GEOSGeometry}), handle, g)
371+
end
372+
337373
function GEOSLineMerge_r(handle, g)
338374
ccall((:GEOSLineMerge_r, libgeos), Ptr{GEOSGeometry}, (GEOSContextHandle_t, Ptr{GEOSGeometry}), handle, g)
339375
end
@@ -546,6 +582,10 @@ function GEOSisValidDetail_r(handle, g, flags, reason, location)
546582
ccall((:GEOSisValidDetail_r, libgeos), UInt8, (GEOSContextHandle_t, Ptr{GEOSGeometry}, Cint, Ptr{Cstring}, Ptr{Ptr{GEOSGeometry}}), handle, g, flags, reason, location)
547583
end
548584

585+
function GEOSMakeValid_r(handle, g)
586+
ccall((:GEOSMakeValid_r, libgeos), Ptr{GEOSGeometry}, (GEOSContextHandle_t, Ptr{GEOSGeometry}), handle, g)
587+
end
588+
549589
function GEOSGeomType_r(handle, g)
550590
unsafe_string(ccall((:GEOSGeomType_r, libgeos), Cstring, (GEOSContextHandle_t, Ptr{GEOSGeometry}), handle, g))
551591
end
@@ -882,6 +922,14 @@ function GEOSCoordSeq_setZ(s, idx, val)
882922
ccall((:GEOSCoordSeq_setZ, libgeos), Cint, (Ptr{GEOSCoordSequence}, UInt32, Cdouble), s, idx, val)
883923
end
884924

925+
function GEOSCoordSeq_setXY(s, idx, x, y)
926+
ccall((:GEOSCoordSeq_setXY, libgeos), Cint, (Ptr{GEOSCoordSequence}, UInt32, Cdouble, Cdouble), s, idx, x, y)
927+
end
928+
929+
function GEOSCoordSeq_setXYZ(s, idx, x, y, z)
930+
ccall((:GEOSCoordSeq_setXYZ, libgeos), Cint, (Ptr{GEOSCoordSequence}, UInt32, Cdouble, Cdouble, Cdouble), s, idx, x, y, z)
931+
end
932+
885933
function GEOSCoordSeq_setOrdinate(s, idx, dim, val)
886934
ccall((:GEOSCoordSeq_setOrdinate, libgeos), Cint, (Ptr{GEOSCoordSequence}, UInt32, UInt32, Cdouble), s, idx, dim, val)
887935
end
@@ -898,6 +946,14 @@ function GEOSCoordSeq_getZ(s, idx, val)
898946
ccall((:GEOSCoordSeq_getZ, libgeos), Cint, (Ptr{GEOSCoordSequence}, UInt32, Ptr{Cdouble}), s, idx, val)
899947
end
900948

949+
function GEOSCoordSeq_getXY(s, idx, x, y)
950+
ccall((:GEOSCoordSeq_getXY, libgeos), Cint, (Ptr{GEOSCoordSequence}, UInt32, Ptr{Cdouble}, Ptr{Cdouble}), s, idx, x, y)
951+
end
952+
953+
function GEOSCoordSeq_getXYZ(s, idx, x, y, z)
954+
ccall((:GEOSCoordSeq_getXYZ, libgeos), Cint, (Ptr{GEOSCoordSequence}, UInt32, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cdouble}), s, idx, x, y, z)
955+
end
956+
901957
function GEOSCoordSeq_getOrdinate(s, idx, dim, val)
902958
ccall((:GEOSCoordSeq_getOrdinate, libgeos), Cint, (Ptr{GEOSCoordSequence}, UInt32, UInt32, Ptr{Cdouble}), s, idx, dim, val)
903959
end
@@ -982,6 +1038,10 @@ function GEOSGeom_createPoint(s)
9821038
ccall((:GEOSGeom_createPoint, libgeos), Ptr{GEOSGeometry}, (Ptr{GEOSCoordSequence},), s)
9831039
end
9841040

1041+
function GEOSGeom_createPointFromXY(x, y)
1042+
ccall((:GEOSGeom_createPointFromXY, libgeos), Ptr{GEOSGeometry}, (Cdouble, Cdouble), x, y)
1043+
end
1044+
9851045
function GEOSGeom_createEmptyPoint()
9861046
ccall((:GEOSGeom_createEmptyPoint, libgeos), Ptr{GEOSGeometry}, ())
9871047
end
@@ -1070,6 +1130,10 @@ function GEOSUnaryUnion(g)
10701130
ccall((:GEOSUnaryUnion, libgeos), Ptr{GEOSGeometry}, (Ptr{GEOSGeometry},), g)
10711131
end
10721132

1133+
function GEOSCoverageUnion(g)
1134+
ccall((:GEOSCoverageUnion, libgeos), Ptr{GEOSGeometry}, (Ptr{GEOSGeometry},), g)
1135+
end
1136+
10731137
function GEOSUnionCascaded(g)
10741138
ccall((:GEOSUnionCascaded, libgeos), Ptr{GEOSGeometry}, (Ptr{GEOSGeometry},), g)
10751139
end
@@ -1082,6 +1146,10 @@ function GEOSGetCentroid(g)
10821146
ccall((:GEOSGetCentroid, libgeos), Ptr{GEOSGeometry}, (Ptr{GEOSGeometry},), g)
10831147
end
10841148

1149+
function GEOSMinimumBoundingCircle(g, radius, center)
1150+
ccall((:GEOSMinimumBoundingCircle, libgeos), Ptr{GEOSGeometry}, (Ptr{GEOSGeometry}, Ptr{Cdouble}, Ptr{Ptr{GEOSGeometry}}), g, radius, center)
1151+
end
1152+
10851153
function GEOSNode(g)
10861154
ccall((:GEOSNode, libgeos), Ptr{GEOSGeometry}, (Ptr{GEOSGeometry},), g)
10871155
end
@@ -1094,6 +1162,10 @@ function GEOSPolygonize(geoms, ngeoms)
10941162
ccall((:GEOSPolygonize, libgeos), Ptr{GEOSGeometry}, (Ptr{Ptr{GEOSGeometry}}, UInt32), geoms, ngeoms)
10951163
end
10961164

1165+
function GEOSPolygonize_valid(geoms, ngeoms)
1166+
ccall((:GEOSPolygonize_valid, libgeos), Ptr{GEOSGeometry}, (Ptr{Ptr{GEOSGeometry}}, UInt32), geoms, ngeoms)
1167+
end
1168+
10971169
function GEOSPolygonizer_getCutEdges(geoms, ngeoms)
10981170
ccall((:GEOSPolygonizer_getCutEdges, libgeos), Ptr{GEOSGeometry}, (Ptr{Ptr{GEOSGeometry}}, UInt32), geoms, ngeoms)
10991171
end
@@ -1102,6 +1174,10 @@ function GEOSPolygonize_full(input, cuts, dangles, invalid)
11021174
ccall((:GEOSPolygonize_full, libgeos), Ptr{GEOSGeometry}, (Ptr{GEOSGeometry}, Ptr{Ptr{GEOSGeometry}}, Ptr{Ptr{GEOSGeometry}}, Ptr{Ptr{GEOSGeometry}}), input, cuts, dangles, invalid)
11031175
end
11041176

1177+
function GEOSBuildArea(g)
1178+
ccall((:GEOSBuildArea, libgeos), Ptr{GEOSGeometry}, (Ptr{GEOSGeometry},), g)
1179+
end
1180+
11051181
function GEOSLineMerge(g)
11061182
ccall((:GEOSLineMerge, libgeos), Ptr{GEOSGeometry}, (Ptr{GEOSGeometry},), g)
11071183
end
@@ -1174,10 +1250,6 @@ function GEOSEquals(g1, g2)
11741250
ccall((:GEOSEquals, libgeos), UInt8, (Ptr{GEOSGeometry}, Ptr{GEOSGeometry}), g1, g2)
11751251
end
11761252

1177-
function GEOSEqualsExact(g1, g2, tolerance)
1178-
ccall((:GEOSEqualsExact, libgeos), UInt8, (Ptr{GEOSGeometry}, Ptr{GEOSGeometry}, Cdouble), g1, g2, tolerance)
1179-
end
1180-
11811253
function GEOSCovers(g1, g2)
11821254
ccall((:GEOSCovers, libgeos), UInt8, (Ptr{GEOSGeometry}, Ptr{GEOSGeometry}), g1, g2)
11831255
end
@@ -1186,6 +1258,10 @@ function GEOSCoveredBy(g1, g2)
11861258
ccall((:GEOSCoveredBy, libgeos), UInt8, (Ptr{GEOSGeometry}, Ptr{GEOSGeometry}), g1, g2)
11871259
end
11881260

1261+
function GEOSEqualsExact(g1, g2, tolerance)
1262+
ccall((:GEOSEqualsExact, libgeos), UInt8, (Ptr{GEOSGeometry}, Ptr{GEOSGeometry}, Cdouble), g1, g2, tolerance)
1263+
end
1264+
11891265
function GEOSPrepare(g)
11901266
ccall((:GEOSPrepare, libgeos), Ptr{GEOSPreparedGeometry}, (Ptr{GEOSGeometry},), g)
11911267
end
@@ -1314,6 +1390,10 @@ function GEOSisValidDetail(g, flags, reason, location)
13141390
ccall((:GEOSisValidDetail, libgeos), UInt8, (Ptr{GEOSGeometry}, Cint, Ptr{Cstring}, Ptr{Ptr{GEOSGeometry}}), g, flags, reason, location)
13151391
end
13161392

1393+
function GEOSMakeValid(g)
1394+
ccall((:GEOSMakeValid, libgeos), Ptr{GEOSGeometry}, (Ptr{GEOSGeometry},), g)
1395+
end
1396+
13171397
function GEOSGeomType(g)
13181398
unsafe_string(ccall((:GEOSGeomType, libgeos), Cstring, (Ptr{GEOSGeometry},), g))
13191399
end

src/geos_common.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33

44
const GEOS_VERSION_MAJOR = 3
5-
const GEOS_VERSION_MINOR = 7
6-
const GEOS_VERSION_PATCH = 2
7-
const GEOS_VERSION = "3.7.2"
5+
const GEOS_VERSION_MINOR = 8
6+
const GEOS_VERSION_PATCH = 0
7+
const GEOS_VERSION = "3.8.0"
88
const GEOS_JTS_PORT = "1.13.0"
99
const GEOS_CAPI_VERSION_MAJOR = 1
10-
const GEOS_CAPI_VERSION_MINOR = 11
11-
const GEOS_CAPI_VERSION_PATCH = 2
12-
const GEOS_CAPI_VERSION = "3.7.2-CAPI-1.11.2"
10+
const GEOS_CAPI_VERSION_MINOR = 13
11+
const GEOS_CAPI_VERSION_PATCH = 1
12+
const GEOS_CAPI_VERSION = "3.8.0-CAPI-1.13.1"
1313
const GEOS_CAPI_FIRST_INTERFACE = GEOS_CAPI_VERSION_MAJOR
1414
const GEOS_CAPI_LAST_INTERFACE = GEOS_CAPI_VERSION_MAJOR + GEOS_CAPI_VERSION_MINOR
1515
const GEOS_PREC_NO_TOPO = 1 << 0

0 commit comments

Comments
 (0)