Skip to content

Commit

Permalink
Fix gis function definition (#601)
Browse files Browse the repository at this point in the history
  • Loading branch information
become-nice authored May 14, 2020
1 parent ecd116a commit cf9ce98
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 32 deletions.
20 changes: 10 additions & 10 deletions python/arctern/_wrapper_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ def ST_GeomFromText(text):
"""
Transform the representation of geometry from WKT to WKB.
:type json: Series(dtype: object)
:param json: Geometries in WKT form.
:type text: Series(dtype: object)
:param text: Geometries in WKT form.
:rtype: Series(dtype: object)
:return: Geometries in WKB form.
Expand All @@ -239,12 +239,12 @@ def ST_GeomFromText(text):
return _to_pandas_series(result)

@arctern_udf('binary')
def ST_AsText(text):
def ST_AsText(geos):
"""
Transform the representation of geometry from WKB to WKT.
:type text: Series(dtype: object)
:param text: Geometries in WKB form.
:type geos: Series(dtype: object)
:param geos: Geometries in WKB form.
:rtype: Series(dtype: object)
:return: Geometries in WKT form.
Expand All @@ -259,18 +259,18 @@ def ST_AsText(text):
dtype: object
"""
import pyarrow as pa
geo = pa.array(text, type='binary')
geo = pa.array(geos, type='binary')
geo = _to_arrow_array_list(geo)
result = [arctern_core_.ST_AsText(g) for g in geo]
return _to_pandas_series(result)

@arctern_udf('binary')
def ST_AsGeoJSON(text):
def ST_AsGeoJSON(geos):
"""
Return the GeoJSON representation of the geometry.
:type text: Series(dtype: object)
:param text: Geometries in WKB form.
:type geos: Series(dtype: object)
:param geos: Geometries in WKB form.
:rtype: Series(dtype: object)
:return: Geometries in GeoJSON format.
Expand All @@ -285,7 +285,7 @@ def ST_AsGeoJSON(text):
dtype: object
"""
import pyarrow as pa
geo = pa.array(text, type='binary')
geo = pa.array(geos, type='binary')
geo = _to_arrow_array_list(geo)
result = [arctern_core_.ST_AsGeoJSON(g) for g in geo]
return _to_pandas_series(result)
Expand Down
44 changes: 22 additions & 22 deletions spark/pyspark/arctern_pyspark/_wrapper_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ def WkbToWkt(wkbs):
return arctern.wkb2wkt(wkbs)

@pandas_udf("binary", PandasUDFType.SCALAR)
def ST_PointFromText(geos):
def ST_PointFromText(text):
"""
Transform the representation of point from WKT to WKB.
:type geos: WKT
:param geos: Point in WKT form.
:type text: WKT
:param text: Point in WKT form.
:rtype: WKB
:return: Point in WKB form.
Expand All @@ -106,15 +106,15 @@ def ST_PointFromText(geos):
|POINT (30 10) |
+---------------------------------+
"""
return arctern.ST_GeomFromText(geos)
return arctern.ST_GeomFromText(text)

@pandas_udf("binary", PandasUDFType.SCALAR)
def ST_PolygonFromText(geos):
def ST_PolygonFromText(text):
"""
Transform the representation of polygon from WKT to WKB.
:type geos: WKT
:param geos: Polygon in WKT form.
:type text: WKT
:param text: Polygon in WKT form.
:rtype: WKB
:return: Polygon in WKB form.
Expand All @@ -136,15 +136,15 @@ def ST_PolygonFromText(geos):
|POLYGON ((0 0,0 1,1 1,1 0,0 0)) |
+-----------------------------------+
"""
return arctern.ST_GeomFromText(geos)
return arctern.ST_GeomFromText(text)

@pandas_udf("binary", PandasUDFType.SCALAR)
def ST_LineStringFromText(geos):
def ST_LineStringFromText(text):
"""
Transform the representation of linestring from WKT to WKB.
:type geos: WKT
:param geos: Linestring in WKT form.
:type text: WKT
:param text: Linestring in WKT form.
:rtype: WKB
:return: Linestring in WKB form.
Expand All @@ -166,15 +166,15 @@ def ST_LineStringFromText(geos):
|LINESTRING (0 0, 0 1, 1 1, 1 0) |
+--------------------------------------+
"""
return arctern.ST_GeomFromText(geos)
return arctern.ST_GeomFromText(text)

@pandas_udf("binary", PandasUDFType.SCALAR)
def ST_GeomFromWKT(geos):
def ST_GeomFromWKT(text):
"""
Transform the representation of geometry from WKT to WKB.
:type geos: WKT
:param geos: Geometry in WKT form.
:type text: WKT
:param text: Geometry in WKT form.
:rtype: WKB
:return: Geometry in WKB form.
Expand All @@ -196,15 +196,15 @@ def ST_GeomFromWKT(geos):
|POLYGON ((0 0,0 1,1 1,1 0,0 0))|
+-------------------------------+
"""
return arctern.ST_GeomFromText(geos)
return arctern.ST_GeomFromText(text)

@pandas_udf("binary", PandasUDFType.SCALAR)
def ST_GeomFromText(geos):
def ST_GeomFromText(text):
"""
Transform the representation of geometry from WKT to WKB.
:type geo: WKT
:param geo: Geometry in WKT form.
:type text: WKT
:param text: Geometry in WKT form.
:rtype: WKB
:return: Geometry in WKB form.
Expand All @@ -226,15 +226,15 @@ def ST_GeomFromText(geos):
|POLYGON ((0 0,0 1,1 1,1 0,0 0)) |
+--------------------------------+
"""
return arctern.ST_GeomFromText(geos)
return arctern.ST_GeomFromText(text)

@pandas_udf("string", PandasUDFType.SCALAR)
def ST_AsText(geos):
"""
Transform the representation of geometry from WKB to WKT.
:type geo: WKB
:param geo: Geometry in WKB form.
:type geos: WKB
:param geos: Geometry in WKB form.
:rtype: WKT
:return: Geometry in WKT form.
Expand Down

0 comments on commit cf9ce98

Please sign in to comment.