@@ -251,7 +251,7 @@ def as_geoarrow(obj, type=None, coord_type=None, promote_multi=False):
251251
252252 >>> import geoarrow.pyarrow as ga
253253 >>> ga.as_geoarrow(["POINT (0 1)", "MULTIPOINT Z (0 1 2, 4 5 6)"])
254- MultiPointArray :MultiPointType(geoarrow.multipoint_z)[2]
254+ GeometryExtensionArray :MultiPointType(geoarrow.multipoint_z)[2]
255255 <MULTIPOINT Z (0 1 nan)>
256256 <MULTIPOINT Z (0 1 2, 4 5 6)>
257257 """
@@ -307,7 +307,7 @@ def make_point(x, y, z=None, m=None, crs=None):
307307
308308 >>> import geoarrow.pyarrow as ga
309309 >>> ga.make_point([1, 2, 3], [4, 5, 6])
310- PointArray :PointType(geoarrow.point)[3]
310+ GeometryExtensionArray :PointType(geoarrow.point)[3]
311311 <POINT (1 4)>
312312 <POINT (2 5)>
313313 <POINT (3 6)>
@@ -338,10 +338,11 @@ def make_point(x, y, z=None, m=None, crs=None):
338338
339339def _box_point_struct (storage ):
340340 arrays = storage .flatten ()
341- return pa .StructArray .from_arrays (
342- [arrays [0 ], arrays [0 ], arrays [1 ], arrays [1 ]],
343- names = ["xmin" , "xmax " , "ymin " , "ymax" ],
341+ box_storage = pa .StructArray .from_arrays (
342+ [arrays [0 ], arrays [1 ], arrays [0 ], arrays [1 ]],
343+ names = ["xmin" , "ymin " , "xmax " , "ymax" ],
344344 )
345+ return _type .types .box ().to_pyarrow ().wrap_array (box_storage )
345346
346347
347348def box (obj ):
@@ -350,7 +351,7 @@ def box(obj):
350351
351352 >>> import geoarrow.pyarrow as ga
352353 >>> ga.box(["LINESTRING (0 10, 34 -1)"]).type
353- StructType(struct<xmin: double, xmax: double, ymin: double, ymax: double> )
354+ BoxType(geoarrow.box )
354355 >>> print(str(ga.box(["LINESTRING (0 10, 34 -1)"])))
355356 -- is_valid: all not null
356357 -- child 0 type: double
@@ -359,11 +360,11 @@ def box(obj):
359360 ]
360361 -- child 1 type: double
361362 [
362- 34
363+ -1
363364 ]
364365 -- child 2 type: double
365366 [
366- -1
367+ 34
367368 ]
368369 -- child 3 type: double
369370 [
@@ -399,15 +400,15 @@ def _box_agg_point_struct(arrays):
399400 out = [list (pc .min_max (array ).values ()) for array in arrays ]
400401 out_dict = {
401402 "xmin" : out [0 ][0 ].as_py (),
402- "xmax" : out [0 ][1 ].as_py (),
403403 "ymin" : out [1 ][0 ].as_py (),
404+ "xmax" : out [0 ][1 ].as_py (),
404405 "ymax" : out [1 ][1 ].as_py (),
405406 }
406407
407408 # Apparently pyarrow reorders dict keys when inferring scalar types?
408- return pa .scalar (
409- out_dict , pa .struct ([( nm , pa . float64 ()) for nm in out_dict . keys ()] )
410- )
409+ storage_type = pa .struct ([( nm , pa . float64 ()) for nm in out_dict . keys ()])
410+ storage_array = pa .array ([ out_dict ], storage_type )
411+ return _type . types . box (). to_pyarrow (). wrap_array ( storage_array )[ 0 ]
411412
412413
413414def box_agg (obj ):
@@ -417,7 +418,7 @@ def box_agg(obj):
417418
418419 >>> import geoarrow.pyarrow as ga
419420 >>> ga.box_agg(["POINT (0 10)", "POINT (34 -1)"])
420- <pyarrow.StructScalar: [( 'xmin', 0.0), ('xmax', 34.0), ('ymin', -1.0), ( 'ymax', 10.0)]>
421+ BoxScalar({ 'xmin': 0.0, 'ymin': -1.0, 'xmax': 34.0, 'ymax': 10.0})
421422 """
422423
423424 obj = obj_as_array_or_chunked (obj )
@@ -495,7 +496,7 @@ def with_coord_type(obj, coord_type):
495496
496497 >>> import geoarrow.pyarrow as ga
497498 >>> ga.with_coord_type(["POINT (0 1)"], ga.CoordType.INTERLEAVED)
498- PointArray :PointType(interleaved geoarrow.point)[1]
499+ GeometryExtensionArray :PointType(interleaved geoarrow.point)[1]
499500 <POINT (0 1)>
500501 """
501502 return as_geoarrow (obj , coord_type = coord_type )
@@ -537,10 +538,10 @@ def with_dimensions(obj, dimensions):
537538
538539 >>> import geoarrow.pyarrow as ga
539540 >>> ga.with_dimensions(["POINT (0 1)"], ga.Dimensions.XYZM)
540- PointArray :PointType(geoarrow.point_zm)[1]
541+ GeometryExtensionArray :PointType(geoarrow.point_zm)[1]
541542 <POINT ZM (0 1 nan nan)>
542543 >>> ga.with_dimensions(["POINT ZM (0 1 2 3)"], ga.Dimensions.XY)
543- PointArray :PointType(geoarrow.point)[1]
544+ GeometryExtensionArray :PointType(geoarrow.point)[1]
544545 <POINT (0 1)>
545546 """
546547 obj = as_geoarrow (obj )
@@ -557,13 +558,13 @@ def with_geometry_type(obj, geometry_type):
557558
558559 >>> import geoarrow.pyarrow as ga
559560 >>> ga.with_geometry_type(["POINT (0 1)"], ga.GeometryType.MULTIPOINT)
560- MultiPointArray :MultiPointType(geoarrow.multipoint)[1]
561+ GeometryExtensionArray :MultiPointType(geoarrow.multipoint)[1]
561562 <MULTIPOINT (0 1)>
562563 >>> ga.with_geometry_type(["MULTIPOINT (0 1)"], ga.GeometryType.POINT)
563- PointArray :PointType(geoarrow.point)[1]
564+ GeometryExtensionArray :PointType(geoarrow.point)[1]
564565 <POINT (0 1)>
565566 >>> ga.with_geometry_type(["LINESTRING EMPTY", "POINT (0 1)"], ga.GeometryType.POINT)
566- PointArray :PointType(geoarrow.point)[2]
567+ GeometryExtensionArray :PointType(geoarrow.point)[2]
567568 <POINT (nan nan)>
568569 <POINT (0 1)>
569570 >>> ga.with_geometry_type(["MULTIPOINT (0 1, 2 3)"], ga.GeometryType.POINT)
0 commit comments