-
Notifications
You must be signed in to change notification settings - Fork 24
Closed
Description
This example is problematic with float precision
using LibGEOS
p1 = LibGEOS.Polygon([[[75.9, 30.7], [79.9, 30.7], [77.9, 28.7], [75.9, 30.7]]]);
p2 = LibGEOS.Polygon([[[81.0, 26.8], [76.0, 26.8], [81.0, 31.8], [81.0, 26.8]]]);
julia> intersects(p1,p2) # should be true
true
julia> touches(p1,p2) # should be true
false
julia> is12 = intersection(p1,p2);
julia> area(is12)
3.552713678800501e-15
julia> writegeom(is12)
"POLYGON ((79.9000000000000057 30.6999999999999993, 77.9000000000000057 28.6999999999999993, 77.9000000000000057 28.7000000000000028, 79.9000000000000057 30.6999999999999993))"
julia> LibGEOS.GEOSGeom_getPrecision(p1.ptr)
-1.0
julia> LibGEOS.GEOSGeom_getPrecision(p2.ptr)
-1.0
using Plots
plot([p1,p2])
I cannot figure out usage of setPrecision
that does not seem to do anything, this is what I tried
LibGEOS.GEOSGeom_setPrecision(p2.ptr,0.1,0);
There seems to be a precision model in GEOS
https://github.com/libgeos/geos/blob/master/src/geom/PrecisionModel.cpp
but is this exposed in LibGEOS.jl ?
Metadata
Metadata
Assignees
Labels
No labels