Skip to content

Commit 7c4416f

Browse files
authored
[GH-2018] Geopandas.GeoSeries: Setup skeleton of functions and tests (#2019)
* Add skeleton of functions and tests * Add more tests from the existing skeleton from above
1 parent 9f0bcc4 commit 7c4416f

3 files changed

Lines changed: 563 additions & 0 deletions

File tree

python/sedona/geopandas/geoseries.py

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18+
import os
19+
import typing
1820
from typing import Any, Union
1921

2022
import geopandas as gpd
@@ -616,6 +618,127 @@ def sjoin(
616618
**kwargs,
617619
)
618620

621+
@property
622+
def geometry(self) -> "GeoSeries":
623+
return self
624+
625+
@property
626+
def x(self) -> pspd.Series:
627+
raise NotImplementedError("GeoSeries.x() is not implemented yet.")
628+
629+
@property
630+
def y(self) -> pspd.Series:
631+
raise NotImplementedError("GeoSeries.y() is not implemented yet.")
632+
633+
@property
634+
def z(self) -> pspd.Series:
635+
raise NotImplementedError("GeoSeries.z() is not implemented yet.")
636+
637+
@property
638+
def m(self) -> pspd.Series:
639+
raise NotImplementedError("GeoSeries.m() is not implemented yet.")
640+
641+
@classmethod
642+
def from_file(
643+
cls, filename: Union[os.PathLike, typing.IO], **kwargs
644+
) -> "GeoSeries":
645+
raise NotImplementedError("GeoSeries.from_file() is not implemented yet.")
646+
647+
@classmethod
648+
def from_wkb(
649+
cls,
650+
data,
651+
index=None,
652+
crs: Union[Any, None] = None,
653+
on_invalid="raise",
654+
**kwargs,
655+
) -> "GeoSeries":
656+
raise NotImplementedError("GeoSeries.from_wkb() is not implemented yet.")
657+
658+
@classmethod
659+
def from_wkt(
660+
cls,
661+
data,
662+
index=None,
663+
crs: Union[Any, None] = None,
664+
on_invalid="raise",
665+
**kwargs,
666+
) -> "GeoSeries":
667+
raise NotImplementedError("GeoSeries.from_wkt() is not implemented yet.")
668+
669+
@classmethod
670+
def from_xy(cls, x, y, z=None, index=None, crs=None, **kwargs) -> "GeoSeries":
671+
raise NotImplementedError("GeoSeries.from_xy() is not implemented yet.")
672+
673+
@classmethod
674+
def from_shapely(
675+
cls, data, index=None, crs: Union[Any, None] = None, **kwargs
676+
) -> "GeoSeries":
677+
raise NotImplementedError("GeoSeries.from_shapely() is not implemented yet.")
678+
679+
@classmethod
680+
def from_arrow(cls, arr, **kwargs) -> "GeoSeries":
681+
raise NotImplementedError("GeoSeries.from_arrow() is not implemented yet.")
682+
683+
def to_file(
684+
self,
685+
filename: Union[os.PathLike, typing.IO],
686+
driver: Union[str, None] = None,
687+
index: Union[bool, None] = None,
688+
**kwargs,
689+
):
690+
raise NotImplementedError("GeoSeries.to_file() is not implemented yet.")
691+
692+
def isna(self) -> pspd.Series:
693+
raise NotImplementedError("GeoSeries.isna() is not implemented yet.")
694+
695+
def isnull(self) -> pspd.Series:
696+
raise NotImplementedError("GeoSeries.isnull() is not implemented yet.")
697+
698+
def notna(self) -> pspd.Series:
699+
raise NotImplementedError("GeoSeries.notna() is not implemented yet.")
700+
701+
def notnull(self) -> pspd.Series:
702+
"""Alias for `notna` method. See `notna` for more detail."""
703+
return self.notna()
704+
705+
def fillna(self, value: Any) -> "GeoSeries":
706+
raise NotImplementedError("GeoSeries.fillna() is not implemented yet.")
707+
708+
def explode(self, ignore_index=False, index_parts=False) -> "GeoSeries":
709+
raise NotImplementedError("GeoSeries.explode() is not implemented yet.")
710+
711+
def to_crs(
712+
self, crs: Union[Any, None] = None, epsg: Union[int, None] = None
713+
) -> "GeoSeries":
714+
raise NotImplementedError("GeoSeries.to_crs() is not implemented yet.")
715+
716+
def estimate_utm_crs(self, datum_name: str = "WGS 84"):
717+
raise NotImplementedError(
718+
"GeoSeries.estimate_utm_crs() is not implemented yet."
719+
)
720+
721+
def to_json(
722+
self,
723+
show_bbox: bool = True,
724+
drop_id: bool = False,
725+
to_wgs84: bool = False,
726+
**kwargs,
727+
) -> str:
728+
raise NotImplementedError("GeoSeries.to_json() is not implemented yet.")
729+
730+
def to_wkb(self, hex: bool = False, **kwargs) -> pspd.Series:
731+
raise NotImplementedError("GeoSeries.to_wkb() is not implemented yet.")
732+
733+
def to_wkt(self, **kwargs) -> pspd.Series:
734+
raise NotImplementedError("GeoSeries.to_wkt() is not implemented yet.")
735+
736+
def to_arrow(self, geometry_encoding="WKB", interleaved=True, include_z=None):
737+
raise NotImplementedError("GeoSeries.to_arrow() is not implemented yet.")
738+
739+
def clip(self, mask, keep_geom_type: bool = False, sort=False) -> "GeoSeries":
740+
raise NotImplementedError("GeoSeries.clip() is not implemented yet.")
741+
619742
# -----------------------------------------------------------------------------
620743
# # Utils
621744
# -----------------------------------------------------------------------------

python/tests/geopandas/test_geoseries.py

Lines changed: 220 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,223 @@ def test_buffer(self):
6666
expected = gpd.GeoSeries([wkt.loads(wkt_str) for wkt_str in expected])
6767
assert result.count() > 0
6868
self.check_sgpd_equals_gpd(result, expected)
69+
70+
def test_geometry(self):
71+
sgpd_geoseries = sgpd.GeoSeries([Point(0, 0), Point(1, 1)])
72+
assert isinstance(sgpd_geoseries.geometry, sgpd.GeoSeries)
73+
assert_series_equal(
74+
sgpd_geoseries.geometry.to_pandas(), sgpd_geoseries.to_pandas()
75+
)
76+
77+
def test_x(self):
78+
pass
79+
80+
def test_y(self):
81+
pass
82+
83+
def test_z(self):
84+
pass
85+
86+
def test_m(self):
87+
pass
88+
89+
def test_from_file(self):
90+
pass
91+
92+
def test_from_wkb(self):
93+
pass
94+
95+
def test_from_wkt(self):
96+
pass
97+
98+
def test_from_xy(self):
99+
pass
100+
101+
def test_from_shapely(self):
102+
pass
103+
104+
def test_from_arrow(self):
105+
pass
106+
107+
def test_to_file(self):
108+
pass
109+
110+
def test_isna(self):
111+
pass
112+
113+
def test_isnull(self):
114+
pass
115+
116+
def test_notna(self):
117+
pass
118+
119+
def test_notnull(self):
120+
pass
121+
122+
def test_fillna(self):
123+
pass
124+
125+
def test_explode(self):
126+
pass
127+
128+
def test_to_crs(self):
129+
pass
130+
131+
def test_estimate_utm_crs(self):
132+
pass
133+
134+
def test_to_json(self):
135+
pass
136+
137+
def test_to_wkb(self):
138+
pass
139+
140+
def test_to_wkt(self):
141+
pass
142+
143+
def test_to_arrow(self):
144+
pass
145+
146+
def test_clip(self):
147+
pass
148+
149+
def test_geom_type(self):
150+
pass
151+
152+
def test_type(self):
153+
pass
154+
155+
def test_length(self):
156+
pass
157+
158+
def test_is_valid(self):
159+
pass
160+
161+
def test_is_valid_reason(self):
162+
pass
163+
164+
def test_is_empty(self):
165+
pass
166+
167+
def test_count_coordinates(self):
168+
pass
169+
170+
def test_count_geometries(self):
171+
pass
172+
173+
def test_count_interior_rings(self):
174+
pass
175+
176+
def test_is_simple(self):
177+
pass
178+
179+
def test_is_ring(self):
180+
pass
181+
182+
def test_is_ccw(self):
183+
pass
184+
185+
def test_is_closed(self):
186+
pass
187+
188+
def test_has_z(self):
189+
pass
190+
191+
def test_get_precision(self):
192+
pass
193+
194+
def test_get_geometry(self):
195+
pass
196+
197+
def test_boundary(self):
198+
pass
199+
200+
def test_centroid(self):
201+
pass
202+
203+
def test_concave_hull(self):
204+
pass
205+
206+
def test_convex_hull(self):
207+
pass
208+
209+
def test_delaunay_triangles(self):
210+
pass
211+
212+
def test_voronoi_polygons(self):
213+
pass
214+
215+
def test_envelope(self):
216+
pass
217+
218+
def test_minimum_rotated_rectangle(self):
219+
pass
220+
221+
def test_exterior(self):
222+
pass
223+
224+
def test_extract_unique_points(self):
225+
pass
226+
227+
def test_offset_curve(self):
228+
pass
229+
230+
def test_interiors(self):
231+
pass
232+
233+
def test_remove_repeated_points(self):
234+
pass
235+
236+
def test_set_precision(self):
237+
pass
238+
239+
def test_representative_point(self):
240+
pass
241+
242+
def test_minimum_bounding_circle(self):
243+
pass
244+
245+
def test_minimum_bounding_radius(self):
246+
pass
247+
248+
def test_minimum_clearance(self):
249+
pass
250+
251+
def test_normalize(self):
252+
pass
253+
254+
def test_make_valid(self):
255+
pass
256+
257+
def test_reverse(self):
258+
pass
259+
260+
def test_segmentize(self):
261+
pass
262+
263+
def test_transform(self):
264+
pass
265+
266+
def test_force_2d(self):
267+
pass
268+
269+
def test_force_3d(self):
270+
pass
271+
272+
def test_line_merge(self):
273+
pass
274+
275+
def test_unary_union(self):
276+
pass
277+
278+
def test_union_all(self):
279+
pass
280+
281+
def test_intersection_all(self):
282+
pass
283+
284+
def test_contains(self):
285+
pass
286+
287+
def test_contains_properly(self):
288+
pass

0 commit comments

Comments
 (0)