IdaGeoSeries

The spatial methods of an IdaGeoDataFrame can be used to operate on the geometry attribute and wil return a IdaGeoSeries object in each case. An IdaGeoSeries is essentially a reference to a spatial column of dashDB/DB2 where each entry in the column is a set of shapes corresponding to one observation represented by DB2GSE.ST_GEOMETRY. An entry may consist of only one shape (like a ST_POINT/ST_LINESTRING/ST_POLYGON) or multiple shapes that are meant to be thought of as one observation (like the many polygons that make up the County of Santa Cruz in California or a state like Connecticut).

dashDB has three basic classes of geometric objects (which are actually DB2 spatial objects following OGC guidelines):

  • ST_Point / ST_MultiPoint
  • ST_Linestring / ST_MultiLineString
  • ST_Polygon / ST_MultiPolygon

Open an IdaGeoSeries

class ibmdbpy.geoSeries.IdaGeoSeries(idadb, tablename, indexer, column)[source]

An IdaSeries whose column must have geometry type. It has geospatial methods based on DashDB/DB2 Spatial Extender (DB2GSE).

# TODO: add examples

__init__(idadb, tablename, indexer, column)[source]

Ensures that the specified column has geometry type. See __init__ of IdaSeries.

Parameters:

column : str

Column name. It must have geometry type.

Notes

Even though geometry types are unorderable in DB2GSE, the IdaGeoSeries might have as indexer another column of the table whose column the IdaGeoSeries refers to.

Geospatial Methods which return an IdaGeoSeries

Once the geometry property of the IdaGeoDataFrame is set, the geospatial methods of IdaGeoSeries can be accessed with the IdaGeoDataFrame object. Currently the following methods are supported.

Area

IdaGeoSeries.area(unit=None)[source]

Valid types for the column in the calling IdaGeoSeries: ST_Geometry or one of its subtypes.

Returns an IdaSeries with doubles representing the area covered by each of the geometries in the calling IdaGeoSeries, in the given unit or else in the default unit.

If the geometry is a polygon or multipolygon, then the area covered by the geometry is returned. The area of points, linestrings, multipoints, and multilinestrings is 0 (zero).

For None geometries the output is None. For empty geometries the output is None.

Parameters:

unit : str, optional

Name of the unit, it is case-insensitive. If omitted, the following rules are used:

  • If geometry is in a projected or geocentric coordinate

system, the linear unit associated with this coordinate system is used. * If geometry is in a geographic coordinate system, the angular unit associated with this coordinate system is used.

Returns:

IdaSeries.

See also

linear_units
list of valid units.

Notes

Restrictions on unit conversions: An error (SQLSTATE 38SU4) is returned if any of the following conditions occur:

  • The geometry is in an unspecified coordinate system and the unit

parameter is specified. * The geometry is in a projected coordinate system and an angular unit is specified. * The geometry is in a geographic coordinate system, and a linear unit is specified.

# TODO: handle this SQLSTATE error

References

DB2 Spatial Extender ST_AREA() function.

Examples

>>> counties = IdaGeoDataFrame(idadb,'SAMPLES.GEO_COUNTY',indexer='OBJECTID')
>>> counties.set_geometry('SHAPE')
>>> counties['area_in_km'] = counties.area(unit = 'KILOMETER')
>>> counties[['NAME','area_in_km']].head()
NAME         area_in_km
Wood         1606.526429
Cass         2485.836511
Washington   1459.393496
Fulton       1382.620091
Clay         2725.095566

Boundary

IdaGeoSeries.boundary()[source]

Valid types for the column in the calling IdaGeoSeries: ST_Geometry or one of its subtypes.

Returns an IdaGeoSeries of geometries which are the boundary of each of the geometries in the calling IdaGeoSeries.

The resulting geometry is represented in the spatial reference system of the given geometry.

If the given geometry is a point, multipoint, closed curve, or closed multicurve, or if it is empty, then the result is an empty geometry of type ST_Point. For curves or multicurves that are not closed, the start points and end points of the curves are returned as an ST_MultiPoint value, unless such a point is the start or end point of an even number of curves. For surfaces and multisurfaces, the curve defining the boundary of the given geometry is returned, either as an ST_Curve or an ST_MultiCurve value.

If possible, the specific type of the returned geometry will be ST_Point, ST_LineString, or ST_Polygon. For example, the boundary of a polygon with no holes is a single linestring, represented as ST_LineString. The boundary of a polygon with one or more holes consists of multiple linestrings, represented as ST_MultiLineString.

For None geometries the output is None.

Returns:IdaGeoSeries.

References

DB2 Spatial Extender ST_BOUNDARY() function.

Examples

>>> counties = IdaGeoDataFrame(idadb,'SAMPLES.GEO_COUNTY',indexer='OBJECTID')
>>> counties.set_geometry('SHAPE')
>>> counties['boundary'] = counties.boundary()
>>> counties[['NAME','boundary']].head()
NAME         boundary
Madison      LINESTRING (-90.4500428418 32.5737889565, -90....
Lake         LINESTRING (-114.6043395348 47.7897504535, -11...
Broward      LINESTRING (-80.8798118938 26.2594597939, -80....
Buena Vista  LINESTRING (-95.3880180283 42.5617494883, -95....
Jones        LINESTRING (-77.0903250894 34.8027619185, -77..

Buffer

IdaGeoSeries.buffer(distance, unit=None)[source]

Valid types for the column in the calling IdaGeoSeries: ST_Geometry or one of its subtypes.

Returns an IdaGeoSeries of geometries in which each point is the specified distance away from the geometries in the calling IdaGeoSeries, measured in the given unit.

Parameters:

distance : float

Distance, can be positive or negative.

unit : str, optional

Name of the unit, it is case-insensitive. If omitted, the following rules are used:

  • If geometry is in a projected or geocentric coordinate

system, the linear unit associated with this coordinate system is the default. * If geometry is in a geographic coordinate system, the angular unit associated with this coordinate system is the default.

Returns:

IdaGeoSeries.

See also

linear_units
list of valid units.

Notes

Restrictions on unit conversions: An error (SQLSTATE 38SU4) is returned if any of the following conditions occur:

  • The geometry is in an unspecified coordinate system and the unit

parameter is specified. * The geometry is in a projected coordinate system and an angular unit is specified. * The geometry is in a geographic coordinate system, but is not an ST_Point value , and a linear unit is specified.

# TODO: handle this SQLSTATE error

References

DB2 Spatial Extender ST_BUFFER() function.

Examples

>>> tornadoes = IdaGeoDataFrame(idadb,'SAMPLES.GEO_TORNADO',indexer='OBJECTID')
>>> tornadoes.set_geometry('SHAPE')
>>> tornadoes['buffer_20_km'] = tornadoes.buffer(distance = 20, unit = 'KILOMETER')
>>> tornadoes[['OBJECTID','SHAPE','buffer_20_km']].head()
OBJECTID  SHAPE                                        buffer_20_km
1         MULTILINESTRING ((-90.2200062071 38.770....  POLYGON ((-90.3065519651 38.9369737029, -90.32..
2         MULTILINESTRING ((-89.3000059755 39.100....  POLYGON ((-89.3798853739 39.2690904737, -89.39.
3         MULTILINESTRING ((-84.5800047496 40.880....  POLYGON ((-84.7257488606 41.0222185578, -84.73...
4         MULTILINESTRING ((-94.3700070010 34.400....  POLYGON ((-94.5212609425 34.5296645617, -94.53...
5         MULTILINESTRING ((-90.6800062393 37.600....  POLYGON ((-90.8575378881 37.7120296620, -90.86...

Centroid

IdaGeoSeries.centroid()[source]

Valid types for the column in the calling IdaGeoSeries: ST_Geometry or one of its subtypes.

Returns an IdaGeoSeries of points which represent the geometric center of each of the geometries in the calling IdaGeoSeries.

The geometric center is the center of the minimum bounding rectangle of the given geometry, as a point.

The resulting point is represented in the spatial reference system of the given geometry.

For None geometries the output is None.

Returns:IdaGeoSeries.

References

DB2 Spatial Extender ST_CENTROID() function.

Examples

>>> counties = IdaGeoDataFrame(idadb,'SAMPLES.GEO_COUNTY',indexer='OBJECTID')
>>> counties.set_geometry('SHAPE')
>>> counties['centroid'] = counties.centroid()
>>> counties[['NAME','centroid']].head()
NAME         centroid
Wood         POINT (-83.6490410160 41.3923524865)
Cass         POINT (-94.3483719161 33.0944709011)
Washington   POINT (-89.4241634562 38.3657576429)
Fulton       POINT (-74.4337987380 43.1359187016)
Clay         POINT (-96.5066339619 46.8908550036)

Convex Hull

IdaGeoSeries.convex_hull()[source]

Valid types for the column in the calling IdaGeoSeries: ST_Geometry or one of its subtypes.

Returns an IdaGeoSeries of geometries which are the convex hull of each of the geometries in the calling IdaGeoSeries.

The resulting geometry is represented in the spatial reference system of the given geometry.

If possible, the specific type of the returned geometry will be ST_Point, ST_LineString, or ST_Polygon. For example, the boundary of a polygon with no holes is a single linestring, represented as ST_LineString. The boundary of a polygon with one or more holes consists of multiple linestrings, represented as ST_MultiLineString.

For None geometries the output is None. For empty geometries the output is None.

Returns:IdaGeoSeries.

References

DB2 Spatial Extender ST_CONVEXHULL() function.

Examples

# TODO add examples

coordDim

IdaGeoSeries.coord_dim()[source]

Valid types for the column in the calling IdaGeoSeries: ST_Geometry or one of its subtypes.

Returns an IdaSeries with integers representing the dimensionality of the coordinates of each of the geometries in the calling IdaGeoSeries.

If the given geometry does not have Z and M coordinates, the dimensionality is 2. If it has Z coordinates and no M coordinates, or if it has M coordinates and no Z coordinates, the dimensionality is 3. If it has Z and M coordinates, the dimensionality is 4.

For None geometries the output is None.

Returns:IdaSeries.

References

DB2 Spatial Extender ST_COORDDIM() function.

Examples

# TODO add examples

Dimension

IdaGeoSeries.dimension()[source]

Valid types for the column in the calling IdaGeoSeries: ST_Geometry.

Returns an IdaSeries with integers representing the dimension of each of the geometries in the calling IdaGeoSeries.

If the given geometry is empty, then -1 is returned. For points and multipoints, the dimension is 0 (zero). For curves and multicurves, the dimension is 1. For polygons and multipolygons, the dimension is 2.

For None geometries the output is None.

Returns:IdaSeries.

References

DB2 Spatial Extender ST_DIMENSION() function.

Examples

# TODO add examples

Envelope

IdaGeoSeries.envelope()[source]

Valid types for the column in the calling IdaGeoSeries: ST_Geometry.

Returns an IdaGeoSeries of polygons which are an envelope around each of the geometries in the calling IdaGeoSeries. The envelope is a rectangle that is represented as a polygon.

If the given geometry is a point, a horizontal linestring, or a vertical linestring, then a rectangle, which is slightly larger than the given geometry, is returned. Otherwise, the minimum bounding rectangle of the geometry is returned as the envelope.

For None geometries the output is None. For empty geometries the output is None.

Returns:IdaGeoSeries.

See also

mbr

References

DB2 Spatial Extender ST_ENVELOPE() function.

Examples

>>> tornadoes = IdaGeoDataFrame(idadb,'SAMPLES.GEO_TORNADO',indexer='OBJECTID')
>>> tornadoes.set_geometry('SHAPE')
>>> tornadoes['envelope'] = tornadoes.envelope()
>>> tornadoes[['OBJECTID', 'SHAPE', 'envelope']].head()
OBJECTID   SHAPE                                      envelope
1          MULTILINESTRING ((-90.2200062071 38.77..   POLYGON ((-90.2200062071 38.77..
2          MULTILINESTRING ((-89.3000059755 39.10..   POLYGON ((-89.3000059755 39.10..
3          MULTILINESTRING ((-84.5800047496 40.88..   POLYGON ((-84.5800047496 40.88..
4          MULTILINESTRING ((-94.3700070010 34.40..   POLYGON ((-94.3700070010 34.40..
5          MULTILINESTRING ((-90.6800062393 37.60..   POLYGON ((-90.6800062393 37.60..

End Point

..automethod:: IdaGeoSeries.end_point

Exterior Ring

..automethod:: IdaGeoSeries.exterior_ring

Generalize

IdaGeoSeries.generalize(threshold)[source]

Valid types for the column in the calling IdaGeoSeries: ST_Geometry or one of its subtypes.

Returns an IdaGeoSeries of geometries which represent each of the geometries in the calling IdaGeoSeries, but with a reduced number of points, while preserving the general characteristics of the geometry.

The Douglas-Peucker line-simplification algorithm is used, by which the sequence of points that define the geometry is recursively subdivided until a run of the points can be replaced by a straight line segment. In this line segment, none of the defining points deviates from the straight line segment by more than the given threshold. Z and M coordinates are not considered for the simplification. The resulting geometry is in the spatial reference system of the given geometry.

For empty geometries, the output is an empty geometry of type ST_Point. For None geometries the output is None.

Parameters:

threshold : float

Threshold to be used for the line-simplification algorithm. The threshold must be greater than or equal to 0. The larger the threshold, the smaller the number of points that will be used to represent the generalized geometry.

Returns:

IdaGeoSeries.

References

DB2 Spatial Extender ST_GENERALIZE() function.

Examples

>>> tornadoes = IdaGeoDataFrame(idadb,'SAMPLES.GEO_TORNADO',indexer='OBJECTID')
>>> tornadoes.set_geometry('SHAPE')
>>> tornadoes['generalize'] = tornadoes.generalize(threshold = 4)
>>> tornadoes[['OBJECTID','generalize']].head()
OBJECTID  generalize
1         MULTILINESTRING ((-90.2200062071 38.7700071663...
2         MULTILINESTRING ((-89.3000059755 39.1000072739...
3         MULTILINESTRING ((-84.5800047496 40.8800078382...
4         MULTILINESTRING ((-94.3700070010 34.4000061520...
5         MULTILINESTRING ((-90.6800062393 37.6000069289...

Geometry Type

IdaGeoSeries.geometry_type()[source]

Valid types for the column in the calling IdaGeoSeries: ST_Geometry.

Returns an IdaSeries with strings representing the fully qualified type name of the dynamic type of each of the geometries in the calling IdaGeoSeries.

Returns:IdaSeries.

References

DB2 Spatial Extender ST_GEOMETRYTYPE() function.

Examples

# TODO add examples

is 3d

IdaGeoSeries.is_3d()[source]

Valid types for the column in the calling IdaGeoSeries: ST_Geometry or one of its subtypes.

Returns an IdaSeries with integers (1 if it has Z coordiantes, 0 otherwise) for each of the geometries in the calling IdaGeoSeries.

For None geometries the output is None. For empty geometries the output is None.

Returns:IdaSeries.

References

DB2 Spatial Extender ST_IS3D() function.

Examples

# TODO add examples

is Closed

IdaGeoSeries.is_closed()[source]

Valid types for the column in the calling IdaGeoSeries: ST_LINESTRING, ST_MULTILINESTRING.

Returns an IdaSeries with integers (1 if it is closed, 0 otherwise) for each of the curves or multicurves in the calling IdaGeoSeries.

A curve is closed if the start point and end point are equal. If the curve has Z coordinates, the Z coordinates of the start and end point must be equal. Otherwise, the points are not considered equal, and the curve is not closed. A multicurve is closed if each of its curves are closed.

For None curves or multicurves the output is None. For empty curves or multicurves the output is 0.

Returns:IdaSeries.

References

DB2 Spatial Extender ST_ISCLOSED() function.

Examples

# TODO add examples

is Empty

IdaGeoSeries.is_empty()[source]

Valid types for the column in the calling IdaGeoSeries: ST_Geometry or one of its subtypes.

Returns an IdaSeries with integers (1 if it is empty, 0 otherwise) for each of the geometries in the calling IdaGeoSeries.

For None geometries the output is None.

Returns:IdaSeries.

References

DB2 Spatial Extender ST_ISEMPTY() function.

Examples

# TODO add examples

is Measured

IdaGeoSeries.is_measured()[source]

Valid types for the column in the calling IdaGeoSeries: ST_Geometry or one of its subtypes.

Returns an IdaSeries with integers (1 if it has M coordiantes, 0 otherwise) for each of the geometries in the calling IdaGeoSeries.

For None geometries the output is None. For empty geometries the output is None.

Returns:IdaSeries.

References

DB2 Spatial Extender ST_ISMEASURED() function.

Examples

# TODO add examples

is Simple

IdaGeoSeries.is_simple()[source]

Valid types for the column in the calling IdaGeoSeries: ST_Geometry or one of its subtypes.

Returns an IdaSeries with integers (1 if it is simple, 0 otherwise) for each of the geometries in the calling IdaGeoSeries.

Points, surfaces, and multisurfaces are always simple. A curve is simple if it does not pass through the same point twice. Amultipoint is simple if it does not contain two equal points. A multicurve is simple if all of its curves are simple and the only intersections occur at points that are on the boundary of the curves in the multicurve.

For None geometries the output is None. For empty geometries the output is 1.

Returns:IdaSeries.

References

DB2 Spatial Extender ST_ISSIMPLE() function.

Examples

# TODO add examples

is Valid

IdaGeoSeries.is_valid()[source]

Valid types for the column in the calling IdaGeoSeries: ST_Geometry or one of its subtypes.

Returns an IdaSeries with integers (1 if it is valid, 0 otherwise) for each of the geometries in the calling IdaGeoSeries.

A geometry is valid only if all of the attributes in the structured type are consistent with the internal representation of geometry data, and if the internal representation is not corrupted.

For None geometries the output is None.

Returns:IdaSeries.

References

DB2 Spatial Extender ST_ISVALID() function.

Examples

# TODO add examples

Length

IdaGeoSeries.length(unit=None)[source]

Valid types for the column in the calling IdaGeoSeries: ST_LINESTRING, ST_MULTILINESTRING.

Returns an IdaSeries with doubles representing the length of each of the curves or multicurves in the calling IdaGeoSeries, in the given unit or else in the default unit.

For None curves or multicurves the output is None. For empty curves or multicurves the output is None.

Parameters:

unit : str, optional

Name of the unit, it is case-insensitive. If omitted, the following rules are used:

  • If curve is in a projected or geocentric coordinate system,

the linear unit associated with this coordinate system is the default. * If curve is in a geographic coordinate system, the angular unit associated with this coordinate system is the default.

Returns:

IdaSeries.

See also

linear_units
list of valid units.

Notes

Restrictions on unit conversions: An error (SQLSTATE 38SU4) is returned if any of the following conditions occur:

  • The curve is in an unspecified coordinate system and the unit

parameter is specified. * The curve is in a projected coordinate system and an angular unit is specified. * The curve is in a geographic coordinate system, and a linear unit is specified.

# TODO: handle this SQLSTATE error

References

DB2 Spatial Extender ST_LENGTH() function.

Examples

>>> tornadoes = IdaGeoDataFrame(idadb,'SAMPLES.GEO_TORNADO',indexer='OBJECTID')
>>> tornadoes.set_geometry('SHAPE')
>>> tornadoes['length'] = tornadoes.length(unit = 'KILOMETER')
>>> tornadoes[['OBJECTID', 'SHAPE', 'length']].head()
OBJECTID    SHAPE                                              length
1           MULTILINESTRING ((-90.2200062071 38.7700071663..   17.798545
2           MULTILINESTRING ((-89.3000059755 39.1000072739...  6.448745
3           MULTILINESTRING ((-84.5800047496 40.8800078382...  0.014213
4           MULTILINESTRING ((-94.3700070010 34.4000061520..   0.014173
5           MULTILINESTRING ((-90.6800062393 37.6000069289..   4.254681

max M

IdaGeoSeries.max_m()[source]

Valid types for the column in the calling IdaGeoSeries: ST_Geometry or one of its subtypes.

Returns an IdaSeries with doubles representing the maximum M coordinate for each of the geometries in the calling IdaGeoSeries.

For None geometries the output is None. For empty geometries the output is None. For geometries without M coordinate the output is None.

Returns:IdaSeries.

References

DB2 Spatial Extender ST_MAXM() function.

Examples

# TODO add examples

max X

IdaGeoSeries.max_x()[source]

Valid types for the column in the calling IdaGeoSeries: ST_Geometry or one of its subtypes.

Returns an IdaSeries with doubles representing the maximum X coordinate for each of the geometries in the calling IdaGeoSeries.

For None geometries the output is None. For empty geometries the output is None.

Returns:IdaSeries.

References

DB2 Spatial Extender ST_MAXX() function.

Examples

# TODO add examples

max Y

IdaGeoSeries.max_y()[source]

Valid types for the column in the calling IdaGeoSeries: ST_Geometry or one of its subtypes.

Returns an IdaSeries with doubles representing the maximum Y coordinate for each of the geometries in the calling IdaGeoSeries.

For None geometries the output is None. For empty geometries the output is None.

Returns:IdaSeries.

References

DB2 Spatial Extender ST_MAXY() function.

Examples

# TODO add examples

max Z

IdaGeoSeries.max_z()[source]

Valid types for the column in the calling IdaGeoSeries: ST_Geometry or one of its subtypes.

Returns an IdaSeries with doubles representing the maximum Z coordinate for each of the geometries in the calling IdaGeoSeries.

For None geometries the output is None. For empty geometries the output is None. For geometries without Z coordinate the output is None.

Returns:IdaSeries.

References

DB2 Spatial Extender ST_MAXZ() function.

Examples

# TODO add examples

MBR

IdaGeoSeries.mbr()[source]

Valid types for the column in the calling IdaGeoSeries: ST_Geometry or one of its subtypes.

Returns an IdaGeoSeries of geometries which are the minimum bounding rectangle of each of the geometries in the calling IdaGeoSeries.

If the given geometry is a point, then the point itself is returned. If the geometry is a horizontal linestring or a vertical linestring, the horizontal or vertical linestring itself is returned.

For None geometries the output is None. For empty geometries the output is None.

Returns:IdaGeoSeries.

References

DB2 Spatial Extender ST_MBR() function.

Examples

# TODO add examples

Mid Point

IdaGeoSeries.mid_point()[source]

Valid types for the column in the calling IdaGeoSeries: ST_LINESTRING.

Returns an IdaGeoSeries of points which are equidistant from both ends of each of the curves in the calling IdaGeoSeries, measured along the curve.

The resulting point is represented in the spatial reference system of the given curve.

If the curve contains Z coordinates or M coordinates (measures), the midpoint is determined solely by the values of the X and Y coordinates in the curve. The Z coordinate and measure in the returned point are interpolated.

For None curves the output is None. For empty curves, the output is an empty point.

Returns:IdaGeoSeries.

References

DB2 Spatial Extender ST_MIDPOINT() function.

Examples

# TODO add examples

min M

IdaGeoSeries.min_m()[source]

Valid types for the column in the calling IdaGeoSeries: ST_Geometry or one of its subtypes.

Returns an IdaSeries with doubles representing the minimum M coordinate for each of the geometries in the calling IdaGeoSeries.

For None geometries the output is None. For empty geometries the output is None. For geometries without M coordinate the output is None.

Returns:IdaSeries.

References

DB2 Spatial Extender ST_MINM() function.

Examples

# TODO add examples

min X

IdaGeoSeries.min_x()[source]

Valid types for the column in the calling IdaGeoSeries: ST_Geometry or one of its subtypes.

Returns an IdaSeries with doubles representing the minimum X coordinate for each of the geometries in the calling IdaGeoSeries.

For None geometries the output is None. For empty geometries the output is None.

Returns:IdaSeries.

References

DB2 Spatial Extender ST_MINX() function.

Examples

# TODO add examples

min Y

IdaGeoSeries.min_y()[source]

Valid types for the column in the calling IdaGeoSeries: ST_Geometry or one of its subtypes.

Returns an IdaSeries with doubles representing the minimum Y coordinate for each of the geometries in the calling IdaGeoSeries.

For None geometries the output is None. For empty geometries the output is None.

Returns:IdaSeries.

References

DB2 Spatial Extender ST_MINY() function.

Examples

# TODO add examples

min Z

IdaGeoSeries.min_z()[source]

Valid types for the column in the calling IdaGeoSeries: ST_Geometry or one of its subtypes.

Returns an IdaSeries with doubles representing the minimum Z coordinate for each of the geometries in the calling IdaGeoSeries.

For None geometries the output is None. For empty geometries the output is None. For geometries without Z coordinate the output is None.

Returns:IdaSeries.

References

DB2 Spatial Extender ST_MINZ() function.

Examples

# TODO add examples

num Geometries

IdaGeoSeries.num_geometries()[source]

Valid types for the column in the calling IdaGeoSeries: ST_MULTIPOINT, ST_MULTIPOLYGON, ST_MULTILINESTRING.

Returns an IdaSeries with integers representing the number of geometries in each of the collections in the calling IdaGeoSeries.

For None collections the output is None. For empty collections the output is None.

Returns:IdaSeries.

References

DB2 Spatial Extender ST_NUMGEOMETRIES() function.

Examples

# TODO add examples

num Interior Ring

IdaGeoSeries.num_interior_ring()[source]

Valid types for the column in the calling IdaGeoSeries: ST_POLYGON.

Returns an IdaSeries with integers representing the number of interior rings of each of the polygons in the calling IdaGeoSeries.

For None collections the output is None. For empty collections the output is None.

Returns:IdaSeries.

References

DB2 Spatial Extender ST_NUMINTERIORRING() function.

Examples

# TODO add examples

num Linestrings

IdaGeoSeries.num_line_strings()[source]

Valid types for the column in the calling IdaGeoSeries: ST_MULTILINESTRING.

Returns an IdaSeries with integers representing the number of linestrings of each of the multilinestrings in the calling IdaGeoSeries.

For None multilinestrings the output is None. For empty multilinestrings the output is None.

Returns:IdaSeries.

References

DB2 Spatial Extender ST_NUMLINESTRINGS() function.

Examples

# TODO add examples

num Points

IdaGeoSeries.num_points()[source]

Valid types for the column in the calling IdaGeoSeries: ST_Geometry or one of its subtypes.

Returns an IdaSeries with integers representing the number of points of each of the geometries in the calling IdaGeoSeries.

For None geometries the output is None. For empty geometries the output is None.

Returns:IdaSeries.

References

DB2 Spatial Extender ST_NUMPOINTS() function.

Examples

# TODO add examples

num Polygons

IdaGeoSeries.num_polygons()[source]

Valid types for the column in the calling IdaGeoSeries: ST_MULTIPOLYGON.

Returns an IdaSeries with integers representing the number of polygons of each of the multipolygons in the calling IdaGeoSeries.

For None multipolygons the output is None. For empty multipolygons the output is None.

Returns:IdaSeries.

References

DB2 Spatial Extender ST_NUMLINESTRINGS() function.

Examples

# TODO add examples

perimeter

IdaGeoSeries.perimeter(unit=None)[source]

Valid types for the column in the calling IdaGeoSeries: ST_POLYGON, ST_MULTIPOLYGON.

Returns an IdaSeries with doubles representing the perimeter of each of the surfaces or multisurfaces in the calling IdaGeoSeries, in the given unit or else in the default unit.

For None curves or multicurves the output is None. For empty curves or multicurves the output is None.

Parameters:

unit : str, optional

Name of the unit, it is case-insensitive. If omitted, the following rules are used:

  • If surface is in a projected or geocentric coordinate system,

the linear unit associated with this coordinate system is the default. * If surface is in a geographic coordinate system, the angular unit associated with this coordinate system is the default.

Returns:

IdaSeries.

See also

linear_units
list of valid units.

Notes

Restrictions on unit conversions: An error (SQLSTATE 38SU4) is returned if any of the following conditions occur:

  • The geometry is in an unspecified coordinate system and the unit

parameter is specified. * The geometry is in a projected coordinate system and an angular unit is specified. * The geometry is in a geographic coordinate system and a linear unit is specified.

# TODO: handle this SQLSTATE error

References

DB2 Spatial Extender ST_PERIMETER() function.

Examples

# TODO add examples

Start Point

..automethod:: IdageoSeries.start_point

SR ID

IdaGeoSeries.srid()[source]

Valid types for the column in the calling IdaGeoSeries: ST_Geometry or one of its subtypes.

Returns an IdaSeries with integers representing the spatial reference system of each of the geometries in the calling IdaGeoSeries.

For None geometries the output is None.

Returns:IdaSeries.

References

DB2 Spatial Extender ST_SRID() function.

Examples

# TODO add examples

SRS Name

IdaGeoSeries.srs_name()[source]

Valid types for the column in the calling IdaGeoSeries: ST_Geometry or one of its subtypes.

Returns an IdaSeries with strings representing the name of the spatial reference system of each of the geometries in the calling IdaGeoSeries.

Returns:IdaSeries.

References

DB2 Spatial Extender ST_SRSNAME() function.

Examples

>>> tornadoes = IdaGeoDataFrame(idadb,'SAMPLES.GEO_TORNADO',indexer='OBJECTID')
>>> tornadoes.set_geometry('SHAPE')
>>> tornadoes['srs_name'] = tornadoes.srs_name()
>>> tornadoes[['OBJECTID', 'SHAPE', 'srs_name']].head()
OBJECTID   SHAPE                                                    srs_name
1              MULTILINESTRING ((-90.2200062071 38.7700071663...    SAMPLE_GCS_WGS_1984
2              MULTILINESTRING ((-89.3000059755 39.1000072739...    SAMPLE_GCS_WGS_1984
3              MULTILINESTRING ((-84.5800047496 40.8800078382...    SAMPLE_GCS_WGS_1984
4              MULTILINESTRING ((-94.3700070010 34.4000061520...    SAMPLE_GCS_WGS_1984
5              MULTILINESTRING ((-90.6800062393 37.6000069289...    SAMPLE_GCS_WGS_1984

X coordinate

IdaGeoSeries.x()[source]

Valid types for the column in the calling IdaGeoSeries: ST_POINT.

Returns an IdaSeries with doubles representing the X coordinate of each of the points in the calling IdaGeoSeries.

For None points the output is None. For empty points the output is None.

Returns:IdaSeries.

References

DB2 Spatial Extender ST_X() function.

Examples

# TODO add examples

Y coordinate

IdaGeoSeries.y()[source]

Valid types for the column in the calling IdaGeoSeries: ST_POINT.

Returns an IdaSeries with doubles representing the Y coordinate of each of the points in the calling IdaGeoSeries.

For None points the output is None. For empty points the output is None.

Returns:IdaSeries.

References

DB2 Spatial Extender ST_Y() function.

Examples

# TODO add examples

Z coordinate

IdaGeoSeries.z()[source]

Valid types for the column in the calling IdaGeoSeries: ST_POINT.

Returns an IdaSeries with doubles representing the Z coordinate of each of the points in the calling IdaGeoSeries.

For None points the output is None. For empty points the output is None.

Returns:IdaSeries.

References

DB2 Spatial Extender ST_Z() function.

Examples

# TODO add examples