Skip to content

Commit

Permalink
Implements non standard Linearring.
Browse files Browse the repository at this point in the history
  • Loading branch information
evetion committed Oct 5, 2024
1 parent a34201e commit 3886c0b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/wkb.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ is true for a GeometryCollection, when the subgeometry types are not known befor
const PointTraitCode = UInt32(1)
geometry_code(::GI.PointTrait) = PointTraitCode
const LineStringTraitCode = UInt32(2)
geometry_code(::GI.LineStringTrait) = LineStringTraitCode
geometry_code(::GI.AbstractLineStringTrait) = LineStringTraitCode
const PolygonTraitCode = UInt32(3)
geometry_code(::GI.PolygonTrait) = PolygonTraitCode
const MultiPointTraitCode = UInt32(4)
Expand Down
1 change: 1 addition & 0 deletions src/wkt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ POLYGON (((35 10, 45 45, 15 40, 10 20, 35 10),
const geowkt = Dict{DataType,String}(
GI.PointTrait => "POINT",
GI.LineStringTrait => "LINESTRING",
GI.LinearRingTrait => "LINEARRING",
GI.PolygonTrait => "POLYGON",
GI.MultiPointTrait => "MULTIPOINT",
GI.MultiLineStringTrait => "MULTILINESTRING",
Expand Down
12 changes: 12 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -224,4 +224,16 @@ import LibGEOS
0x00,
0x40]
end

@testset "Simple wrapper Polygon #37" begin
GI.astext(GI.Polygon([GI.LinearRing([(50, 60), (50, 61), (51, 61), (51, 60), (50, 60)])]))
GI.asbinary(GI.Polygon([GI.LinearRing([(50, 60), (50, 61), (51, 61), (51, 60), (50, 60)])]))
end

@testset "LinearRing #36" begin
rings = GI.astext(GI.LinearRing([(50, 60), (50, 61), (51, 61), (51, 60), (50, 60)]))
@test GI.geomtrait(rings) == GI.LinearRingTrait()
ringb = GI.asbinary(GI.LinearRing([(50, 60), (50, 61), (51, 61), (51, 60), (50, 60)]))
@test GI.geomtrait(ringb) == GI.LineStringTrait()
end
end

0 comments on commit 3886c0b

Please sign in to comment.