Skip to content

Commit 85e80a1

Browse files
add coords constructor
1 parent 07873e9 commit 85e80a1

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

pymeos/main/tpoint.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,6 +1308,19 @@ def y(self) -> TFloatSeq:
13081308

13091309
def z(self) -> TFloatSeq:
13101310
return super().z()
1311+
1312+
@staticmethod
1313+
def from_arrays(t: List[Union[datetime, str]], x: List[float], y: List[float], z: Optional[List[float]] = None,
1314+
srid: int = 0, geodetic: bool = False, lower_inc: bool = True, upper_inc: bool = False,
1315+
linear: bool = True, normalize: bool = True) -> TPointSeq:
1316+
1317+
from ..factory import _TemporalFactory
1318+
assert len(t) == len(x) == len(y)
1319+
times = [datetime_to_timestamptz(ti) if isinstance(ti, datetime) else pg_timestamptz_in(ti, -1) for ti in t]
1320+
1321+
return _TemporalFactory.create_temporal(
1322+
tpointseq_make_coords(x, y, z, times, len(t), srid, geodetic, lower_inc, upper_inc, linear, normalize)
1323+
)
13111324

13121325
def plot(self, *args, **kwargs):
13131326
"""

0 commit comments

Comments
 (0)