-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathpoint.py
More file actions
47 lines (32 loc) · 1.08 KB
/
point.py
File metadata and controls
47 lines (32 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from __future__ import annotations
from dataclasses import dataclass
from typing import TYPE_CHECKING
import pyarrow as pa
if TYPE_CHECKING:
import geoarrow.geo
import geoarrow.geos
import geoarrow.proj
@dataclass
class PointArray:
arr: pa.Array
def __post_init__(self):
validate_point_array(self.arr)
@property
def geo(self) -> geoarrow.geo.PointArray:
"""Access GeoRust algorithms on this PointArray"""
import geoarrow.geo
return geoarrow.geo.PointArray.from_pyarrow(self.arr)
@property
def geos(self) -> geoarrow.geos.PointArray:
"""Access GEOS algorithms on this PointArray"""
import geoarrow.geos
return geoarrow.geos.PointArray.from_pyarrow(self.arr)
@property
def proj(self) -> geoarrow.proj.PointArray:
"""Access Proj algorithms on this PointArray"""
import geoarrow.proj
return geoarrow.proj.PointArray.from_pyarrow(self.arr)
def validate_point_array(arr: pa.Array):
"""Validate that this pyarrow Array is a valid GeoArrow Point array
"""
pass