@@ -36,41 +36,68 @@ function ArrowTypes.JuliaType(::Val{BOX}, x, metadata)
3636end
3737ArrowTypes. ArrowKind (:: Type{Geometry} ) = ArrowTypes. ListKind ()
3838ArrowTypes. ArrowKind (:: Type{<:Geometry{PointTrait,D,T}} ) where {D,T} = ArrowTypes. FixedSizeListKind {D,T} ()
39- ArrowTypes. ArrowKind (:: Type{<:GeoFormatTypes.WellKnownBinary} ) = ArrowTypes. PrimitiveKind ()
40- ArrowTypes. ArrowKind (:: Type{<:GeoFormatTypes.WellKnownText} ) = ArrowTypes. ListKind ()
39+ ArrowTypes. ArrowKind (:: Type{Wrapper} ) = ArrowTypes. ListKind ()
40+ ArrowTypes. ArrowKind (:: Type{Wrapper{Seperated, T, G}} ) where {T,G} = ArrowTypes. StructKind ()
41+ ArrowTypes. ArrowKind (:: Type{Wrapper{Interleaved, T, N, G}} ) where {T,N,G} = ArrowTypes. ListKind ()
42+ ArrowTypes. ArrowKind (:: Type{Wrapper{Interleaved, PointTrait, N, G}} ) where {N,G} = ArrowTypes. FixedSizeListKind {N,Float64} ()
43+ ArrowTypes. ArrowKind (:: Type{Wrapper{WellKnownText, T, N, G}} ) where {T,N,G} = ArrowTypes. ListKind ()
44+ ArrowTypes. ArrowKind (:: Type{Wrapper{WellKnownBinary, T, N, G}} ) where {T,N,G} = ArrowTypes. ListKind ()
4145
42- ArrowTypes. ArrowType (:: Type{<:GeoFormatTypes.WellKnownBinary} ) = Vector{UInt8}
43- ArrowTypes. ArrowType (:: Type{<:GeoFormatTypes.WellKnownText} ) = String
4446ArrowTypes. ArrowType (:: Type{Geometry{X,D,T,G}} ) where {X,D,T,G} = G
47+ ArrowTypes. ArrowType (:: Type{Wrapper{WellKnownText,T,N,G}} ) where {T,N,G} = String
48+ ArrowTypes. ArrowType (:: Type{Wrapper{WellKnownBinary,T,N,G}} ) where {T,N,G} = Vector{UInt8}
49+ ArrowTypes. ArrowType (:: Type{Wrapper{Interleaved,PointTrait,N,G}} ) where {N,G} = NTuple{N,Float64}
50+ ArrowTypes. ArrowType (:: Type{Wrapper{Interleaved,LineStringTrait,N,G}} ) where {N,G} = Vector{NTuple{N,Float64}}
51+ ArrowTypes. ArrowType (:: Type{Wrapper{Interleaved,MultiLineStringTrait,N,G}} ) where {N,G} = Vector{Vector{NTuple{N,Float64}}}
52+ ArrowTypes. ArrowType (:: Type{Wrapper{Interleaved,MultiPointTrait,N,G}} ) where {N,G} = Vector{NTuple{N,Float64}}
53+ ArrowTypes. ArrowType (:: Type{Wrapper{Interleaved,PolygonTrait,N,G}} ) where {N,G} = Vector{Vector{NTuple{N,Float64}}}
54+ ArrowTypes. ArrowType (:: Type{Wrapper{Interleaved,MultiPolygonTrait,N,G}} ) where {N,G} = Vector{Vector{Vector{NTuple{N,Float64}}}}
55+ ArrowTypes. ArrowType (:: Type{Wrapper{Seperated,PointTrait,N,G}} ) where {N,G} = _named (NTuple{N,Float64})
56+ ArrowTypes. ArrowType (:: Type{Wrapper{Seperated,LineStringTrait,N,G}} ) where {N,G} = Vector{_named (NTuple{N,Float64})}
57+ ArrowTypes. ArrowType (:: Type{Wrapper{Seperated,MultiLineStringTrait,N,G}} ) where {N,G} = Vector{Vector{_named (NTuple{N,Float64})}}
58+ ArrowTypes. ArrowType (:: Type{Wrapper{Seperated,MultiPointTrait,N,G}} ) where {N,G} = Vector{_named (NTuple{N,Float64})}
59+ ArrowTypes. ArrowType (:: Type{Wrapper{Seperated,PolygonTrait,N,G}} ) where {N,G} = Vector{Vector{_named (NTuple{N,Float64})}}
60+ ArrowTypes. ArrowType (:: Type{Wrapper{Seperated,MultiPolygonTrait,N,G}} ) where {N,G} = Vector{Vector{Vector{_named (NTuple{N,Float64})}}}
4561
4662ArrowTypes. arrowname (:: Type{Geometry{PointTrait}} ) = POINT
4763ArrowTypes. arrowname (:: Type{Geometry{LineStringTrait}} ) = LINESTRING
4864ArrowTypes. arrowname (:: Type{Geometry{PolygonTrait}} ) = POLYGON
4965ArrowTypes. arrowname (:: Type{Geometry{MultiPointTrait}} ) = MULTIPOINT
5066ArrowTypes. arrowname (:: Type{Geometry{MultiLineStringTrait}} ) = MULTILINESTRING
5167ArrowTypes. arrowname (:: Type{Geometry{MultiPolygonTrait}} ) = MULTIPOLYGON
52- ArrowTypes. arrowname (:: Type{<:GeoFormatTypes.WellKnownBinary} ) = WKB
53- ArrowTypes. arrowname (:: Type{<:GeoFormatTypes.WellKnownText} ) = WKT
68+ ArrowTypes. arrowname (:: Type{Wrapper{WellKnownBinary,T,N,G}} ) where {T,N,G} = WKB
69+ ArrowTypes. arrowname (:: Type{Wrapper{WellKnownText,T,N,G}} ) where {T,N,G} = WKT
70+ ArrowTypes. arrowname (:: Type{Wrapper{E,PointTrait,N,G}} ) where {E<: AbstractNativeEncoding ,N,G} = POINT
71+ ArrowTypes. arrowname (:: Type{Wrapper{E,LineStringTrait,N,G}} ) where {E<: AbstractNativeEncoding ,N,G} = LINESTRING
72+ ArrowTypes. arrowname (:: Type{Wrapper{E,PolygonTrait,N,G}} ) where {E<: AbstractNativeEncoding ,N,G} = POLYGON
73+ ArrowTypes. arrowname (:: Type{Wrapper{E,MultiPointTrait,N,G}} ) where {E<: AbstractNativeEncoding ,N,G} = MULTIPOINT
74+ ArrowTypes. arrowname (:: Type{Wrapper{E,MultiLineStringTrait,N,G}} ) where {E<: AbstractNativeEncoding ,N,G} = MULTILINESTRING
75+ ArrowTypes. arrowname (:: Type{Wrapper{E,MultiPolygonTrait,N,G}} ) where {E<: AbstractNativeEncoding ,N,G} = MULTIPOLYGON
5476ArrowTypes. arrowname (:: Type{Extents.Extent} ) = BOX
5577
5678ArrowTypes. toarrow (x:: Geometry ) = x. geom
57- ArrowTypes. toarrow (x:: GeoFormatTypes.WellKnownText ) = GeoFormatTypes . val (x)
58- ArrowTypes. toarrow (x:: GeoFormatTypes.WellKnownBinary ) = GeoFormatTypes . val (x)
59- ArrowTypes. toarrow (x :: Extents.Extent{(:X, :Y)} ) = (; xmin= ex. X[1 ], ymin= ex. Y[1 ], xmax= ex. X[2 ], ymax= ex. Y[2 ])
60- ArrowTypes. toarrow (x :: Extents.Extent{(:X, :Y, :Z)} ) = (; xmin= ex. X[1 ], ymin= ex. Y[1 ], zmin= ex. Z[1 ], xmax= ex. X[2 ], ymax= ex. Y[2 ], zmax= ex. Z[2 ])
61- ArrowTypes. toarrow (x :: Extents.Extent{(:X, :Y, :Z, :M)} ) = (; xmin= ex. X[1 ], ymin= ex. Y[1 ], zmin= ex. Z[1 ], mmin= ex. M[1 ], xmax= ex. X[2 ], ymax= ex. Y[2 ], zmax= ex. Z[2 ], mmax= ex. M[2 ])
79+ ArrowTypes. toarrow (x:: Wrapper{E,T,<:Geometry} ) where {E,T} = x . geom
80+ ArrowTypes. toarrow (x:: Wrapper ) = data (x)
81+ ArrowTypes. toarrow (ex :: Extents.Extent{(:X, :Y)} ) = (; xmin= ex. X[1 ], ymin= ex. Y[1 ], xmax= ex. X[2 ], ymax= ex. Y[2 ])
82+ ArrowTypes. toarrow (ex :: Extents.Extent{(:X, :Y, :Z)} ) = (; xmin= ex. X[1 ], ymin= ex. Y[1 ], zmin= ex. Z[1 ], xmax= ex. X[2 ], ymax= ex. Y[2 ], zmax= ex. Z[2 ])
83+ ArrowTypes. toarrow (ex :: Extents.Extent{(:X, :Y, :Z, :M)} ) = (; xmin= ex. X[1 ], ymin= ex. Y[1 ], zmin= ex. Z[1 ], mmin= ex. M[1 ], xmax= ex. X[2 ], ymax= ex. Y[2 ], zmax= ex. Z[2 ], mmax= ex. M[2 ])
6284
6385ArrowTypes. fromarrow (:: Type{GeoFormatTypes.WellKnownBinary} , x) = GeoFormatTypes. WellKnownBinary (GeoFormatTypes. Geom (), x)
64- ArrowTypes. fromarrow (:: Type{GeoFormatTypes.WellKnownText} , x) = GeoFormatTypes. WellKnownText (GeoFormatTypes. Geom (), x)
65-
86+ ArrowTypes. fromarrow (:: Type{GeoFormatTypes.WellKnownText} , x) = GeoFormatTypes. WellKnownText (GeoFormatTypes. Geom (), String (x)) # should be StringView
6687function ArrowTypes. fromarrow (:: Type{Geometry{X}} , x) where {X}
6788 nt = nested_eltype (x)
68- D = length (nt. types)
69- T = nt. types[1 ]
70- return Geometry {X,D,T} (x)
89+ D = length (nonmissingtype (nt). types)
90+ return Geometry {X,D,Float64} (x)
91+ end
92+ function fromarrow (:: Type{GeoArrow.Geometry{X}} , nt:: NamedTuple ) where X
93+ return Geometry {X,length(nt),Float64} (nt)
7194end
7295ArrowTypes. fromarrow (:: Type{Extents.Extent} , x) = Extents. Extent (X= (x. xmin, x. xmax), Y= (x. ymin, x. ymax))
7396
7497nested_eltype (x) = nested_eltype (typeof (x))
7598nested_eltype (:: Type{T} ) where {T<: AbstractArray } = nested_eltype (eltype (T))
7699nested_eltype (:: Type{T} ) where {T} = T
100+
101+ _named (:: Type{NTuple{2, T}} ) where {T} = @NamedTuple {x:: Float64 , y:: Float64 }
102+ _named (:: Type{NTuple{3, T}} ) where {T} = @NamedTuple {x:: Float64 , y:: Float64 , z:: Float64 }
103+ _named (:: Type{NTuple{4, T}} ) where {T} = @NamedTuple {x:: Float64 , y:: Float64 , z:: Float64 , m:: Float64 }
0 commit comments