Properties | teradataml GeoDataFrame | Teradata Vantage - GeoDataFrame Properties - Teradata Package for Python

Teradata® Package for Python User Guide

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Teradata Package for Python
Release Number
20.00
Published
December 2024
ft:locale
en-US
ft:lastEdition
2025-01-23
dita:mapPath
nvi1706202040305.ditamap
dita:ditavalPath
plt1683835213376.ditaval
dita:id
rkb1531260709148
lifecycle
latest
Product Category
Teradata Vantage

The following tables list properties of teradataml GeoDataFrame. For more details and examples, see Teradata Package for Python Function Reference.

Generic Usage

from teradataml import GeoDataFrame
geodf = GeoDataFrame("sample_shapes")
geodf.name_of_the_property

Properties inherited from teradataml DataFrame

Property Purpose Return Example
columns Get the column names of GeoDataFrame. List containing column names
>>> load_example_data("geodataframe","sample_streets")
>>> df = GeoDataFrame.from_table('sample_streets')
>>> df.columns
dtypes Return a MetaData containing the column names and types. MetaData containing the column names and Python types
>>> load_example_data("geodataframe","sample_streets")
>>> df = GeoDataFrame.from_table('sample_streets')
>>> df.dtypes
iloc Access a group of rows and columns by integer values or a boolean array. teradataml GeoDataFrame
>>> load_example_data("geodataframe","sample_streets")
>>> geo_dataframe = GeoDataFrame.from_table('sample_streets')
>>> geo_dataframe = geo_dataframe.select(['skey', 'points', 'linestrings'])>>> geo_dataframe.iloc[1]>>> geo_dataframe.iloc[[1, 2]]>>> geo_dataframe.iloc[5, 1]
>>> geo_dataframe.iloc[(5, 1)]
>>> geo_dataframe.iloc[1:5, 2]
>>> geo_dataframe.iloc[1:5, 0:2]
>>> geo_dataframe.iloc[:, :]
>>> geo_dataframe.iloc[[0, 1, 2], [True, False, True]]
index Return the index_label of the teradataml GeoDataFrame. str or List of Strings (str) representing the index_label of the GeoDataFrame
>>> load_example_data("geodataframe","sample_cities")
>>> df = GeoDataFrame("sample_cities")
>>> df.index
 
>>> df = df.set_index(['city_shape', 'city_name'])
>>> df
loc Access a group of rows and columns by labels or a boolean array. teradataml GeoDataFrame
>>> load_example_data("geodataframe", ["sample_shapes"])
>>> geo_dataframe = GeoDataFrame("sample_shapes")
>>> geo_dataframe = geo_dataframe.select(['skey', 'linestrings', 'polygons'])
>>> geo_dataframe.loc[1004]
>>> geo_dataframe.loc[[1004, 1010]]
>>> geo_dataframe.loc[1004, 'linestrings']
>>> geo_dataframe.loc[(1004, 'linestrings')]
>>> geo_dataframe.loc[1001:1004, 'skey':'linestrings']
>>> geo_dataframe.loc[:, :]
>>> geo_dataframe.loc[geo_dataframe['skey'] > 1005]
>>> geo_dataframe.loc[geo_dataframe['skey'] > 1005, ['skey', 'linestrings']]
>>> geo_dataframe.loc[geo_dataframe['skey'] == 1005, 'skey':'polygons']
>>> geo_dataframe.loc[geo_dataframe['skey'] == 1005, [True, False, True]]
  Get the underlying object name on which GeoDataFrame is created. Str representing the object name of GeoDataframe.
>>> load_example_data("geodataframe","sample_streets")
>>> df = GeoDataFrame('sample_streets')
>>> df.db_object_name
shape Return a tuple representing the dimensionality of the GeoDataFrame. Tuple representing the dimensionality of this GeoDataFrame.
>>> load_example_data("geodataframe","sample_streets")
>>> df = GeoDataFrame('sample_streets')
>>> df.shape
size Return a value representing the number of elements in the GeoDataFrame. Value representing the number of elements in the GeoDataFrame.
>>> load_example_data("geodataframe","sample_streets")
>>> df = GeoDataFrame('sample_streets')
>>> df.size
tdtypes Get the teradataml GeoDataFrame metadata containing column names and corresponding teradatasqlalchemy types. Metadata containing the column names and Teradata types
>>> load_example_data("geodataframe","sample_streets")
>>> df = GeoDataFrame('sample_streets')
>>> df.tdtypes

Properties specific to Geospatial Data (All Geometry Types)

Property Purpose Return Example
geometry Return a GeoColumnExpression for a column containing geometry data.
This property is used to run any geospatial operation on GeoDataFrame, that is, any geospatial function ran on the geometry column referenced by this property.
teradataml GeoDataFrameColumn
>>> load_example_data("geodataframe", ["sample_cities", "sample_streets"])
>>> cities = GeoDataFrame("sample_cities")
>>> streets = GeoDataFrame("sample_streets")
>>> city_streets = cities.join(streets, how="cross", lsuffix="l", rsuffix="r")
>>> city_streets.geometry.name
>>> city_streets.geometry = city_streets.street_shape
>>> city_streets.geometry.name
>>> geom_type = city_streets.geometry.geom_type
>>> is_simple = city_streets.geometry.is_simple
>>> is_valid = city_streets.geometry.is_valid
boundary Return the boundary of the Geometry value. GeoDataFrame with result column containing Geometry values
>>> gdf = GeoDataFrame("sample_shapes")
>>> gdf = gdf.select(["skey", "polygons", "linestrings"])
>>> print(gdf.geometry.name)
>>> gdf.boundary
centroid Return the mathematical centroid of an ST_Polygon or ST_MultiPolygon value. GeoDataFrame with result column containing Geometry values
>>> gdf = GeoDataFrame("sample_shapes")
>>> gdf = gdf.select(["skey", "polygons", "linestrings"])[gdf.skey.isin([1001, 1002, 1003])]
>>> print(gdf.geometry.name)
>>> gdf.centroid
convex_hull Return the convex hull of the Geometry value. GeoDataFrame with result column containing Geometry values
>>> gdf = GeoDataFrame("sample_shapes")
>>> gdf = gdf.select(["skey", "polygons", "linestrings"])
>>> print(gdf.geometry.name)
>>> gdf.convex_hull
coord_dim Return the coordinate dimension of a geometry. GeoDataFrame
Resultant column contains:
  • 1, if the input geometry is 1D
  • 2, if the input geometry is 2D
  • 3, if the input geometry is 3D
>>> gdf = GeoDataFrame("sample_shapes")
>>> gdf = gdf.select(["skey", "polygons", "linestrings"])
>>> print(gdf.geometry.name)
>>> gdf.coord_dim
dimension Return the dimension of the Geometry type. GeoDataFrame
Resultant column contains:
  • 0, for a 0-dimensional geometry
  • 1, for a 1D geometry
  • 2, for a 2D geometry
  • -1, if the input geometry is empty
>>> gdf = GeoDataFrame("sample_shapes")
>>> gdf = gdf.select(["skey", "polygons", "linestrings"])
>>> print(gdf.geometry.name)
>>> gdf.dimension
geom_type Return the Geometry type of the Geometry value. GeoDataFrame
Resultant column contains any of the following strings:
  • 'ST_Point'
  • 'ST_LineString'
  • 'ST_Polygon'
  • 'ST_MultiPoint'
  • 'ST_MultiLineString'
  • 'ST_MultiPolygon'
  • 'ST_GeomCollection'
  • 'GeoSequence'
>>> gdf = GeoDataFrame("sample_shapes")
>>> gdf = gdf.select(["skey", "polygons", "linestrings"])
>>> print(gdf.geometry.name)
>>> gdf.geom_type
is_3D Test if a Geometry value has Z coordinate value. GeoDataFrame
Resultant column contains:
  • 1, if the Geometry contains Z coordinates
  • 0, if the Geometry does not contain Z coordinates
>>> gdf = GeoDataFrame("sample_shapes")
>>> gdf = gdf.select(["skey", "polygons", "linestrings"])
>>> print(gdf.geometry.name)
>>> gdf.is_3D
is_empty Test if a Geometry value corresponds to the empty set. GeoDataFrame
Resultant column contains:
  • 1, if the geometry is empty
  • 0, if the geometry is not empty
>>> gdf = GeoDataFrame("sample_shapes")
>>> gdf = gdf.select(["skey", "polygons", "linestrings"])
>>> print(gdf.geometry.name)
>>> gdf.is_empty
is_simple Test if a Geometry value has no anomalous geometric points, such as self intersection tangency. GeoDataFrame
Resultant column contains:
  • 1, if the geometry is simple, with no anomalous points
  • 0, if the geometry is not simple
>>> gdf = GeoDataFrame("sample_shapes")
>>> gdf = gdf.select(["skey", "polygons", "linestrings"])
>>> print(gdf.geometry.name)
>>> gdf.is_simple
is_valid Test if a Geometry value is well-formed. GeoDataFrame
Resultant column contains:
  • 1, if the geometry is valid
  • 0, if the geometry is not valid
>>> gdf = GeoDataFrame("sample_shapes")
>>> gdf = gdf.select(["skey", "polygons", "linestrings"])
>>> print(gdf.geometry.name)
>>> gdf.is_valid
max_x Return the maximum X coordinate of a Geometry value. GeoDataFrame

Resultant column contains a NULL, if the Geometry is an empty set.

>>> gdf = GeoDataFrame("sample_shapes")
>>> gdf = gdf.select(["skey", "polygons", "linestrings"])
>>> print(gdf.geometry.name)
>>> gdf.max_x
max_y Return the maximum Y coordinate of a Geometry value. GeoDataFrame

Resultant column contains a NULL, if the Geometry is an empty set.

>>> gdf = GeoDataFrame("sample_shapes")
>>> gdf = gdf.select(["skey", "polygons", "linestrings"])
>>> print(gdf.geometry.name)
>>> gdf.max_y
max_z Return the maximum Z coordinate of a Geometry value. GeoDataFrame

Resultant column contains a NULL, if the Geometry is an empty set.

>>> gdf = GeoDataFrame("sample_shapes")
>>> gdf = gdf.select(["skey", "polygons", "linestrings"])
>>> print(gdf.geometry.name)
>>> gdf.max_z
min_x Return the minimum X coordinate of a Geometry value. GeoDataFrame

Resultant column contains a NULL, if the Geometry is an empty set.

>>> gdf = GeoDataFrame("sample_shapes")
>>> gdf = gdf.select(["skey", "polygons", "linestrings"])
>>> print(gdf.geometry.name)
>>> gdf.min_x
min_y Return the minimum Y coordinate of a Geometry value. GeoDataFrame

Resultant column contains a NULL, if the Geometry is an empty set.

>>> gdf = GeoDataFrame("sample_shapes")
>>> gdf = gdf.select(["skey", "polygons", "linestrings"])
>>> print(gdf.geometry.name)
>>> gdf.min_y
min_z Return the minimum Z coordinate of a Geometry value. GeoDataFrame

Resultant column contains a NULL, if the Geometry is an empty set.

>>> gdf = GeoDataFrame("sample_shapes")
>>> gdf = gdf.select(["skey", "polygons", "linestrings"])
>>> print(gdf.geometry.name)
>>> gdf.min_z
srid Get the spatial reference system identifier of the Geometry value. GeoDataFrame
>>> gdf = GeoDataFrame("sample_shapes")
>>> gdf = gdf.select(["skey", "polygons", "linestrings"])
>>> print(gdf.geometry.name)
>>> gdf.srid 

Properties for Point Geometry

Property Purpose Return Example
x Get the X coordinate of an ST_Point value. GeoDataFrame
>>> gdf = GeoDataFrame("sample_shapes")
>>> gdf = gdf.select(["skey", "points", "linestrings"])[gdf.points.geom_type == "ST_Point"]
>>> print(gdf.geometry.name)
>>> gdf.x
y Get the Y coordinate of an ST_Point value. GeoDataFrame
>>> gdf = GeoDataFrame("sample_shapes")
>>> gdf = gdf.select(["skey", "points", "linestrings"])[gdf.points.geom_type == "ST_Point"]
>>> print(gdf.geometry.name)
>>> gdf.y
z Get the Z coordinate of an ST_Point value. GeoDataFrame
>>> gdf = GeoDataFrame("sample_shapes")
>>> gdf = gdf.select(["skey", "points", "linestrings"])[gdf.points.geom_type == "ST_Point"]
>>> print(gdf.geometry.name)
>>> gdf.z

Properties for LineString Geometry

Property Purpose Return Example
is_closed_3D Test whether a 3D LineString or 3D MultiLineString is closed, taking into account the Z coordinates in the calculation. GeoDataFrame
Resultant column contains:
  • 1, if the 3D LineString or 3D MultiLineString is closed.
  • 0, if the 3D LineString or 3D MultiLineString is not closed or is empty.
>>> gdf = GeoDataFrame("sample_shapes")
>>> gdf = gdf.select(["skey", "polygons", "linestrings"])[gdf.linestrings.is_3D == 1]
>>> print(gdf.geometry.name)
>>> gdf.geometry = gdf.linestrings
>>> gdf.is_closed_3D
is_closed Test if a Geometry type that represents an ST_LineString, GeoSequence, or ST_MultiLineString value is closed. GeoDataFrame
Resultant column contains:
  • 1, if the ST_LineString, GeoSequence, or ST_LineString components of an ST_MultiLineString are closed.
  • 0, if the ST_LineString, GeoSequence, or ST_LineString components of an ST_MultiLineString are not closed, or if the input geometry is empty.
>>> gdf = GeoDataFrame("sample_shapes")
>>> gdf = gdf.select(["skey", "polygons", "linestrings"])[gdf.skey.isin([1001, 1002, 1003])]
>>> print(gdf.geometry.name)
>>> gdf.geometry = gdf.linestrings
>>> gdf.is_closed
is_ring Test if a Geometry type that represents an ST_LineString or a GeoSequence value is a ring. GeoDataFrame
Resultant column contains:
  • 1, if the ST_LineString or GeoSequence value is simple (has no anomalous geometric points, such as self intersection tangency) and is closed (the start point of the ST_LineString value is equal to the end point)
  • 0, in all other cases.
>>> gdf = GeoDataFrame("sample_shapes")
>>> gdf = gdf.select(["skey", "polygons", "linestrings"])[~gdf.skey.isin([1009, 1008, 1010, 1007])]
>>> print(gdf.geometry.name)
>>> gdf.geometry = gdf.linestrings
>>> gdf.is_ring

Properties for Polygon Geometry

Property Purpose Return Example
area Return the area measurement of an ST_Polygon or ST_MultiPolygon. For ST_MultiPolygon, returns the sum of the area measurements of the component polygons. GeoDataFrame
>>> gdf = GeoDataFrame("sample_shapes")
>>> gdf = gdf.select(["skey", "polygons", "linestrings"])
>>> print(gdf.geometry.name)
>>> gdf.area
exterior Get the exterior ring of a Geometry type that represents an ST_Polygon value. GeoDataFrame with result column containing ST_LineString Geometry values
>>> gdf = GeoDataFrame("sample_shapes")
>>> gdf = gdf.select(["skey", "polygons", "linestrings"])[gdf.skey.isin([1001, 1002, 1003])]
>>> print(gdf.geometry.name)
>>> gdf.exterior
perimeter Return the boundary length of an ST_Polygon, or the sum of the boundary lengths of the component polygons of an ST_MultiPolygon. GeoDataFrame
>>> gdf = GeoDataFrame("sample_shapes")
>>> gdf = gdf.select(["skey", "polygons", "linestrings"])
>>> print(gdf.geometry.name)
>>> gdf.perimeter