IdaGeoDataFrame
An IdaGeoDataFrame is a reference to a spatial table in a remote Netezza instance.
The most important property of an IdaGeoDataFrame is that it always has a reference to one IdaGeoSeries column that holds a special status. This IdaGeoSeries is referred to as the IdaGeoDataFrame‘s “geometry”. When a spatial method is applied to an IdaGeoDataFrame (or a spatial attribute like area is called), this commands will always act on the “geometry” attribute.
The “geometry” attribute – no matter its name – can be accessed through the geometry attribute of an IdaGeoDataFrame.
Open an IdaGeoDataFrame
- class nzpyida.geo_frame.IdaGeoDataFrame(idadb, tablename, indexer=None, geometry=None)[source]
An IdaGeoDataFrame container inherits from IdaDataFrame.
It has a property called “geometry” which refers to a column with geometry type. It is set as a string with a column name, either at instantiation time or with the set_geometry() method.
If the “geometry” property is set, when calling a geospatial method from IdaDataFrame the method will be carried on the column this property refers to.
The property “geometry” returns an IdaGeoSeries.
See IdaDataFrame. See IdaGeoSeries.
Notes
IdaGeoDataFrame objects are not supported on Netezza.
Examples
>>> idageodf = IdaGeoDataFrame(idadb, 'SAMPLES.GEO_COUNTY', indexer='OBJECTID')
>>> idageodf[['NAME', 'SHAPE']].head() NAME SHAPE 0 Becker <Geometry binary data> 1 Jim Hogg <Geometry binary data> 2 Henry <Geometry binary data> 3 Keith <Geometry binary data> 4 Clinton <Geometry binary data>
>>> idageodf.geometry AttributeError: Geometry property has not been set yet. Use set_geometry method to set it.
>>> idageodf.set_geometry('SHAPE') >>> idageodf.geometry.column 'SHAPE'
>>> type(idageodf.geometry) <class 'ibmdbpy.geoSeries.IdaGeoSeries'>
>>> idageoseries = idageodf.geometry >>> idageoseries.head() 0 <Geometry binary data> 1 <Geometry binary data> 2 <Geometry binary data> 3 <Geometry binary data> 4 <Geometry binary data> Name: SHAPE, dtype: object
>>> idageodf['County area'] = idageodf.area(unit='mile')
>>> counties_with_areas = idageodf[['NAME', 'SHAPE', 'County area']] In case >>> counties_with_areas.dtypes (In case you are working with nzspatial_esri) TYPENAME NAME VARCHAR SHAPE ST_GEOMETRY County area DOUBLE
>>> counties_with_areas.dtypes (In case you are working with nzspatial) TYPENAME NAME VARCHAR SHAPE VARCHAR County area DOUBLE
>>> counties_with_areas.head() NAME SHAPE County area 0 Menard <Geometry binary data> 902.281540 1 Boone <Geometry binary data> 282.045087 2 Ochiltree <Geometry binary data> 918.188142 3 Sharkey <Geometry binary data> 435.548518 4 Audubon <Geometry binary data> 444.827726
- Attributes:
columnsIndex containing the column names in self.
emptyBoolean that is True if the table is empty (no rows).
geometryReturns an IdaGeoSeries with the column whose name is stored in _geometry_colname attribute.
indexerThe indexer attribute refers to the name of a column that should be used to index the table.
- name
Methods
as_dataframe()Download and return an in-memory representation of the dataset as a Pandas DataFrame.
commit()Commit operations in the database.
contains(ida2)Valid types for the column in the calling IdaGeoDataFrame: ST_Geometry or one of its subtypes.
corr([method, features, ignore_indexer])Compute the correlation matrix, composed of correlation coefficients between all pairs of columns in self.
corrwith(other)Compute the correlation matrix, composed of correlation coefficients between the columns of self and the columns of another IdaDataFrame.
count()Compute the count of non-missing values for all columns of self.
count_distinct()Compute the count of distinct values for all numeric columns of self.
count_groupby([columns, count_only, having])Count the occurence of the values of a column or group of columns
cov()Compute the covariance matrix, composed of covariance coefficients between all pairs of columns in self.
crosses(ida2)Valid types for the column in the calling IdaGeoDataFrame: ST_Geometry or one of its subtypes.
delete_na(columns[, logic, inplace])Filter rows containing NULL values.
describe([percentiles])A basic statistical summary about current IdaDataFrame.
difference(ida2)This method takes a second IdaGeoDataFrame an an input and returns the difference of the geometries from both IdaGeoDataFrames as a new geometry stored in the RESULT column of the resulting IdaGeoDataFrame.
disjoint(ida2)Valid types for the column in the calling IdaGeoDataFrame: ST_Geometry or one of its subtypes.
distance(ida2[, unit])Valid types for the column in the calling IdaGeoDataFrame: ST_Geometry or one of its subtypes.
equals(ida2)Valid types for the column in the calling IdaGeoDataFrame: ST_Geometry or one of its subtypes.
exists()Convenience function delegated from IdaDataBase.
from_IdaDataFrame(idadf[, geometry])Creates an IdaGeoDataFrame from an IdaDataFrame.
get_primary_key()Get the name of the primary key of self, if there is one.
groupby(by)Creates the groupby object
head([nrow, sort])Print the n first rows of the instance, n is set to 5 by default.
ida_query(query[, silent, first_row_only, ...])Convenience function delegated from IdaDataBase.
ida_scalar_query(query[, silent, autocommit])Convenience function delegated from IdaDataBase.
info([buf])Some information about current IdaDataFrame.
intersection(ida2)This method takes a second IdaGeoDataFrame an an input and returns the intersection of the geometries from both IdaGeoDataFrames as a new geometry stored in the RESULT column of the resulting IdaGeoDataFrame.
intersects(ida2)Valid types for the column in the calling IdaGeoDataFrame: ST_Geometry or one of its subtypes.
is_table()Convenience function delegated from IdaDataBase.
is_view()Convenience function delegated from IdaDataBase.
join(other[, on, how, lsuffix, rsuffix])Implement pandas-like interface to join tables
levels([columns])Return the numbers of distinct values
mad()Compute the mean absolute distance for all numeric columns of self.
max()Compute the maximum value over for all numeric columns of self.
mbr_intersects(ida2)This method takes a second IdaGeoDataFrame an an input and checks if the Minimum Bounding rectangles of the geometries from both IdaGeoDataFrames intersect and stores the result as 0 or 1 in the RESULT column of the resulting IdaGeoDataFrame.
mean()Compute the mean for each numeric columns of self.
mean_freq_of_instance([columns])Return the average occurence of the values of a column or group of columns
median()Compute the median for all numeric columns of self.
merge(right[, how, on, left_on, right_on, ...])Implement pandas-like interface to merge IdaDataFrames
min()Compute the minimum value for all numerics column of self.
mode()Compute the most common value for each non numeric column self.
overlaps(ida2)Valid types for the column in the calling IdaGeoDataFrame: ST_Geometry or one of its subtypes.
pivot_table([values, columns, max_entries, ...])Compute an aggregation function over all rows of each column that is specified as a value on the dataset.
quantile([q])Compute row wise quantiles for each numeric column.
rank()Compute the rank over all entries for all columns of self.
rollback()Rollback operations in the database.
save_as(tablename[, clear_existing])Save self as a table name in the remote database with the name tablename.
set_geometry(column_name)Receives a column name to set as the "geometry" column of the IdaDataFrame.
sort([columns, axis, ascending, inplace])Sort the IdaDataFrame row wise or column wise.
std()Compute the standard deviation for all numeric columns of self.
sum()Compute the sum of values for all numeric columns of self.
summary()A basic statistical summary about current IdaDataFrame.
tail([nrow, sort])Print the n last rows of the instance, n is set to 5 by default.
touches(ida2)Valid types for the column in the calling IdaGeoDataFrame: ST_Geometry or one of its subtypes.
train_test_split(train_table, test_table, ...)Split the table into train and test sets
union(ida2)This method takes a second IdaGeoDataFrame an an input and returns the union of the geometries from both IdaGeoDataFrames as a new geometry stored in the RESULT column of the resulting IdaGeoDataFrame.
unique(column)Return the unique values of a column
var()Compute the variance for all numeric columns of self.
within(ida2)Valid types for the column in the calling IdaGeoDataFrame: ST_Geometry or one of its subtypes.
mean_groupby
print
within_class_std
within_class_var
- __init__(idadb, tablename, indexer=None, geometry=None)[source]
Constructor for IdaGeoDataFrame objects. See IdaDataFrame.__init__ documentation.
- Parameters:
- geometrystr, optional
Column name to set the “geometry” property of the IdaGeoDataFrame. The column must have geometry type.
- Attributes:
- _geometry_colnamestr
Name of the column that “geometry” property refers to. This attribute must be set through the set_geometry() method.
- geometryIdaGeoSeries
The column referenced by _geometry_colname attribute.
Set geometry
- IdaGeoDataFrame.set_geometry(column_name)[source]
Receives a column name to set as the “geometry” column of the IdaDataFrame.
- Parameters:
- column_namestr
Name of the column to be set as geometry column of the IdaDataFrame. It must have geometry type.
- Raises:
- KeyError
If the column is not present in the IdaGeoDataFrame.
- TypeError
If the column doesn’t have geometry type.
Create from an IdaDataFrame
- classmethod IdaGeoDataFrame.from_IdaDataFrame(idadf, geometry=None)[source]
Creates an IdaGeoDataFrame from an IdaDataFrame.
- Parameters:
- geometrystr, optional
Column name to set the “geometry” property of the IdaGeoDataFrame. The column must have geometry type.
- Raises:
- TypeError
If idadf is not an IdaDataFrame.
Get the geometry attribute
- IdaGeoDataFrame.geometry
Returns an IdaGeoSeries with the column whose name is stored in _geometry_colname attribute.
The setter calls the set_geometry() method.
- Returns:
- IdaGeoSeries
- Raises:
- AttributeError
If the property has not been set yet.
Geospatial Methods that return an IdaGeoDataFrame
Some geospatial methods operate on two IdaGeoDataFrames to return a result as a boolean or a new geometry. Such methods can be accessed with the IdaGeoDataFrame object to return a new IdaGeoDataFrame with three columns respectively, indexer of the first IdaGeoDataFrame with which the method is called, the indexer of the second IdaGeoDataFrame which is passed as an argument to the method and a third column which contains the result of the geometric operation between the geometry columns of the first and second IdaGeoDataFrames.
Contains
- IdaGeoDataFrame.contains(ida2)[source]
Valid types for the column in the calling IdaGeoDataFrame: ST_Geometry or one of its subtypes.
Returns an IdaGeoDataFrame of indices of the two input IdaGeoDataFrames and a result column with 1 or 0 depending upon whether the second geometry contains the first.
For None geometries the output is None.
- Parameters:
- ida2IdaGeoDataFrame
Name of the second IdaGeoDataFrame on which the function ST_EQUALS() will be invoked.
- Returns:
- Returns an IdaGeoDataFrame with three columns:
- INDEXERIDA1indexer of the first IdaGeoSeries (None if not set),
- INDEXERIDA2indexer of the second IdaGeoSeries (None if not set),
- RESULTthe result of the operation
References
Netezza Performance Server Analytics ST_CONTAINS() function.
Examples
>>> idageodf_customer = IdaGeoDataFrame(idadb,'SAMPLES.GEO_CUSTOMER',indexer='OBJECTID') >>> idageodf_customer.set_geometry('SHAPE') >>> idageodf_county = IdaGeoDataFrame(idadb,'SAMPLES.GEO_COUNTY',indexer='OBJECTID') >>> idageodf_county.set_geometry('SHAPE') >>> ida1 = idageodf_customer[idageodf_customer['INSURANCE_VALUE']>250000] >>> ida2 = idageodf_county[idageodf_county['NAME']=='Madison'] >>> result = ida2.contains(ida1) >>> result[result['RESULT']==1].head() INDEXERIDA1 INDEXERIDA2 RESULT 21473 134 1 21413 134 1 21414 134 1 21417 134 1 21419 134 1
Crosses
- IdaGeoDataFrame.crosses(ida2)[source]
Valid types for the column in the calling IdaGeoDataFrame: ST_Geometry or one of its subtypes.
Returns an IdaGeoDataFrame of indices of the two input IdaGeoDataFrames and a result column with 1 or 0 depending upon whether the geometry of the first IdaGeoDataFrame crosses the second.
For None geometries the output is None.
- Parameters:
- ida2IdaGeoDataFrame
Name of the second IdaGeoDataFrame on which the function ST_EQUALS() will be invoked.
- Returns:
- Returns an IdaGeoDataFrame with three columns:
- INDEXERIDA1indexer of the first IdaGeoSeries (None if not set),
- INDEXERIDA2indexer of the second IdaGeoSeries (None if not set),
- RESULTthe result of the operation
See also
linear_unitslist of valid units.
References
Netezza Performance Server Analytics ST_CROSSES() function.
Examples
>>> counties = IdaGeoDataFrame(idadb,'SAMPLES.GEO_COUNTY',indexer='OBJECTID') >>> counties.set_geometry('SHAPE') >>> ida1 = counties[counties['NAME'] == 'Austin'] >>> ida2 = counties[counties['NAME'] == 'Kent'] >>> result = ida1.crosses(ida2) >>> result.head() INDEXERIDA1 INDEXERIDA2 RESULT 2 163 0 2 1840 0 2 109 0
Difference
- IdaGeoDataFrame.difference(ida2)[source]
This method takes a second IdaGeoDataFrame an an input and returns the difference of the geometries from both IdaGeoDataFrames as a new geometry stored in the RESULT column of the resulting IdaGeoDataFrame.
For None geometries the output is None. For empty geometries the output is None.
- Parameters:
- ida2IdaGeoDataFrame
Name of the second IdaGeoDataFrame on which the function ST_EQUALS() will be invoked.
- Returns:
- Returns an IdaGeoDataFrame with three columns:
- INDEXERIDA1indexer of the first IdaGeoSeries (None if not set),
- INDEXERIDA2indexer of the second IdaGeoSeries (None if not set),
- RESULTthe result of the operation
References
Netezza Performance Server Analytics ST_Difference() function.
Examples
>>> counties = IdaGeoDataFrame(idadb,'SAMPLES.GEO_COUNTY',indexer='OBJECTID') >>> counties.set_geometry('SHAPE') >>> ida1 = counties[counties['NAME'] == 'Austin'] >>> ida2 = counties[counties['NAME'] == 'Kent'] >>> result = ida1.difference(ida2) >>> result.head() INDEXERIDA1 INDEXERIDA2 RESULT 2 163 <Geometry binary data> 2 1840 <Geometry binary data> 2 109 <Geometry binary data>
Disjoint
- IdaGeoDataFrame.disjoint(ida2)[source]
Valid types for the column in the calling IdaGeoDataFrame: ST_Geometry or one of its subtypes.
Returns an IdaGeoDataFrame of indices of the two input IdaGeoDataFrames and a result column with 1 or 0 depending upon whether the geometries in the input dataframes are disjoint.
For None geometries the output is None.
- Parameters:
- ida2IdaGeoDataFrame
Name of the second IdaGeoDataFrame on which the function ST_EQUALS() will be invoked.
- Returns:
- Returns an IdaGeoDataFrame with three columns:
- INDEXERIDA1indexer of the first IdaGeoSeries (None if not set),
- INDEXERIDA2indexer of the second IdaGeoSeries (None if not set),
- RESULTthe result of the operation
References
Netezza Performance Server Analytics ST_DISJOINT() function.
Examples
>>> counties = IdaGeoDataFrame(idadb,'SAMPLES.GEO_COUNTY',indexer='OBJECTID') >>> counties.set_geometry('SHAPE') >>> ida1 = counties[counties['NAME'] == 'Austin'] >>> ida2 = counties[counties['NAME'] == 'Kent'] >>> result = ida1.disjoint(ida2) >>> result.head() INDEXERIDA1 INDEXERIDA2 RESULT 2 163 1 2 1840 1 2 109 1
Distance
- IdaGeoDataFrame.distance(ida2, unit=None)[source]
Valid types for the column in the calling IdaGeoDataFrame: ST_Geometry or one of its subtypes.
Returns an IdaGeoDataFrame of indices of the two input IdaGeoDataFrames and a result column with a numeric value which is the geographic distance measured between the geometries of the input IdaGeoDataFrames.
For None geometries the output is None.
- Parameters:
- ida2IdaGeoDataFrame
Name of the second IdaGeoDataFrame on which the function ST_EQUALS() will be invoked.
- unitstr, 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:
- Returns an IdaGeoDataFrame with three columns:
- INDEXERIDA1indexer of the first IdaGeoSeries (None if not set),
- INDEXERIDA2indexer of the second IdaGeoSeries (None if not set),
- RESULTthe result of the operation
References
Netezza Performance Server Analytics ST_DISTANCE() function.
Examples
>>> counties = IdaGeoDataFrame(idadb,'SAMPLES.GEO_COUNTY',indexer='OBJECTID') >>> counties.set_geometry('SHAPE') >>> ida1 = counties[counties['NAME'] == 'Austin'] >>> ida2 = counties[counties['NAME'] == 'Kent'] >>> result = ida1.distance(ida2,unit = 'KILOMETER') >>> result.head() INDEXERIDA1 INDEXERIDA2 RESULT 2 163 26.918942 2 1840 4.868971 2 109 16.387094
Equals
- IdaGeoDataFrame.equals(ida2)[source]
Valid types for the column in the calling IdaGeoDataFrame: ST_Geometry or one of its subtypes.
Returns an IdaGeoDataFrame of indices of the two input IdaGeoDataFrames and a result column with 1 or 0 depending upon whether the geometry of the first IdaGeoDataFrame crosses the second.
For None geometries the output is None.
- Parameters:
- ida2IdaGeoDataFrame
Name of the second IdaGeoDataFrame on which the function ST_EQUALS() will be invoked.
- Returns:
- Returns an IdaGeoDataFrame with three columns:
- INDEXERIDA1indexer of the first IdaGeoSeries (None if not set),
- INDEXERIDA2indexer of the second IdaGeoSeries (None if not set),
- RESULTthe result of the operation
References
Netezza Performance Server Analytics ST_CROSSES() function.
Examples
>>> counties = IdaGeoDataFrame(idadb,'SAMPLES.GEO_COUNTY',indexer='OBJECTID') >>> counties.set_geometry('SHAPE') >>> ida1 = counties[counties['NAME'] == 'Austin'] >>> ida2 = counties[counties['NAME'] == 'Kent'] >>> result = ida1.equals(ida2) >>> result.head() INDEXERIDA1 INDEXERIDA2 RESULT 2 163 0 2 1840 0 2 109 0
Intersection
- IdaGeoDataFrame.intersection(ida2)[source]
This method takes a second IdaGeoDataFrame an an input and returns the intersection of the geometries from both IdaGeoDataFrames as a new geometry stored in the RESULT column of the resulting IdaGeoDataFrame.
For None geometries the output is None. For empty geometries the output is POINT EMPTY.
- Parameters:
- ida2IdaGeoDataFrame
Name of the second IdaGeoDataFrame on which the function ST_EQUALS() will be invoked.
- Returns:
- Returns an IdaGeoDataFrame with three columns:
- INDEXERIDA1indexer of the first IdaGeoSeries (None if not set),
- INDEXERIDA2indexer of the second IdaGeoSeries (None if not set),
- RESULTthe result of the operation
References
Netezza Performance Server Analytics ST_Intersection() function.
Examples
>>> counties = IdaGeoDataFrame(idadb,'SAMPLES.GEO_COUNTY',indexer='OBJECTID') >>> counties.set_geometry('SHAPE') >>> ida1 = counties[counties['NAME'] == 'Austin'] >>> ida2 = counties[counties['NAME'] == 'Kent'] >>> result = ida1.intersection(ida2) >>> result.head() INDEXERIDA1 INDEXERIDA2 RESULT 2 163 POINT EMPTY 2 1840 POINT EMPTY 2 109 POINT EMPTY
Intersects
- IdaGeoDataFrame.intersects(ida2)[source]
Valid types for the column in the calling IdaGeoDataFrame: ST_Geometry or one of its subtypes.
Returns an IdaGeoDataFrame of indices of the two input IdaGeoDataFrames and a result column with 1 or 0 depending upon whether the geometries of the input IdaGeoDataFrames intersect each other.
For None geometries the output is None.
- Parameters:
- ida2IdaGeoDataFrame
Name of the second IdaGeoDataFrame on which the function ST_EQUALS() will be invoked.
- Returns:
- Returns an IdaGeoDataFrame with three columns:
- INDEXERIDA1indexer of the first IdaGeoSeries (None if not set),
- INDEXERIDA2indexer of the second IdaGeoSeries (None if not set),
- RESULTthe result of the operation
References
Netezza Performance Server Analytics ST_INTERSECTS() function.
Examples
>>> counties = IdaGeoDataFrame(idadb,'SAMPLES.GEO_COUNTY',indexer='OBJECTID') >>> counties.set_geometry('SHAPE') >>> ida1 = counties[counties['NAME'] == 'Austin'] >>> ida2 = counties[counties['NAME'] == 'Kent'] >>> result = ida1.intersects(ida2) >>> result.head() INDEXERIDA1 INDEXERIDA2 RESULT 2 163 0 2 1840 0 2 109 0
Mbr_Intersects
- IdaGeoDataFrame.mbr_intersects(ida2)[source]
This method takes a second IdaGeoDataFrame an an input and checks if the Minimum Bounding rectangles of the geometries from both IdaGeoDataFrames intersect and stores the result as 0 or 1 in the RESULT column of the resulting IdaGeoDataFrame.
For None geometries the output is None. For empty geometries the output is None.
- Parameters:
- ida2IdaGeoDataFrame
Name of the second IdaGeoDataFrame on which the function ST_EQUALS() will be invoked.
- Returns:
- Returns an IdaGeoDataFrame with three columns:
- INDEXERIDA1indexer of the first IdaGeoSeries (None if not set),
- INDEXERIDA2indexer of the second IdaGeoSeries (None if not set),
- RESULTthe result of the operation
References
Netezza Performance Server Analytics ST_MBRIntersects() function.
Examples
>>> counties = IdaGeoDataFrame(idadb,'SAMPLES.GEO_COUNTY',indexer='OBJECTID') >>> counties.set_geometry('SHAPE') >>> ida1 = counties[counties['NAME'] == 'Austin'] >>> ida2 = counties[counties['NAME'] == 'Kent'] >>> result = ida1.difference(ida2) >>> result.head() INDEXERIDA1 INDEXERIDA2 RESULT 2 163 0 2 1840 0 2 109 0
Overlaps
- IdaGeoDataFrame.overlaps(ida2)[source]
Valid types for the column in the calling IdaGeoDataFrame: ST_Geometry or one of its subtypes.
Returns an IdaGeoDataFrame of indices of the two input IdaGeoDataFrames and a result column with 1 or 0 depending upon whether the geometries of the input IdaGeoDataFrames overlap each other.
For None geometries the output is None.
- Parameters:
- ida2IdaGeoDataFrame
Name of the second IdaGeoDataFrame on which the function ST_EQUALS() will be invoked.
- Returns:
- Returns an IdaGeoDataFrame with three columns:
- INDEXERIDA1indexer of the first IdaGeoSeries (None if not set),
- INDEXERIDA2indexer of the second IdaGeoSeries (None if not set),
- RESULTthe result of the operation
References
Netezza Performance Server Analytics ST_OVERLAPS() function.
Examples
>>> counties = IdaGeoDataFrame(idadb,'SAMPLES.GEO_COUNTY',indexer='OBJECTID') >>> counties.set_geometry('SHAPE') >>> ida1 = counties[counties['NAME'] == 'Austin'] >>> ida2 = counties[counties['NAME'] == 'Kent'] >>> result = ida1.overlaps(ida2) >>> result.head() INDEXERIDA1 INDEXERIDA2 RESULT 2 163 0 2 1840 0 2 109 0
Touches
- IdaGeoDataFrame.touches(ida2)[source]
Valid types for the column in the calling IdaGeoDataFrame: ST_Geometry or one of its subtypes.
Returns an IdaGeoDataFrame of indices of the two input IdaGeoDataFrames and a result column with 1 or 0 depending upon whether the boundary of the first geometry touches the second.
For None geometries the output is None.
- Parameters:
- ida2IdaGeoDataFrame
Name of the second IdaGeoDataFrame on which the function ST_EQUALS() will be invoked.
- Returns:
- Returns an IdaGeoDataFrame with three columns:
- INDEXERIDA1indexer of the first IdaGeoSeries (None if not set),
- INDEXERIDA2indexer of the second IdaGeoSeries (None if not set),
- RESULTthe result of the operation
References
Netezza Performance Server Analytics ST_TOUCHES() function.
Examples
>>> counties = IdaGeoDataFrame(idadb,'SAMPLES.GEO_COUNTY',indexer='OBJECTID') >>> counties.set_geometry('SHAPE') >>> ida1 = counties[counties['NAME'] == 'Austin'] >>> ida2 = counties[counties['NAME'] == 'Kent'] >>> result = ida1.touches(ida2) >>> result.head() INDEXERIDA1 INDEXERIDA2 RESULT 2 163 0 2 1840 0 2 109 0
Union
- IdaGeoDataFrame.union(ida2)[source]
This method takes a second IdaGeoDataFrame an an input and returns the union of the geometries from both IdaGeoDataFrames as a new geometry stored in the RESULT column of the resulting IdaGeoDataFrame.
For None geometries the output is None. For empty geometries the output is None.
- Parameters:
- ida2IdaGeoDataFrame
Name of the second IdaGeoDataFrame on which the function ST_EQUALS() will be invoked.
- Returns:
- Returns an IdaGeoDataFrame with three columns:
- INDEXERIDA1indexer of the first IdaGeoSeries (None if not set),
- INDEXERIDA2indexer of the second IdaGeoSeries (None if not set),
- RESULTthe result of the operation
References
Netezza Performance Server Analytics ST_Union() function.
Examples
>>> counties = IdaGeoDataFrame(idadb,'SAMPLES.GEO_COUNTY',indexer='OBJECTID') >>> counties.set_geometry('SHAPE') >>> ida1 = counties[counties['NAME'] == 'Austin'] >>> ida2 = counties[counties['NAME'] == 'Kent'] >>> result = ida1.union(ida2) >>> result.head() INDEXERIDA1 INDEXERIDA2 RESULT 2 163 <Geometry binary data> 2 1840 <Geometry binary data> 2 109 <Geometry binary data>
Within
- IdaGeoDataFrame.within(ida2)[source]
Valid types for the column in the calling IdaGeoDataFrame: ST_Geometry or one of its subtypes.
Returns an IdaGeoDataFrame of indices of the two input IdaGeoDataFrames and a result column with 1 or 0 depending upon whether the first geometry is inside the second.
For None geometries the output is None.
- Parameters:
- ida2IdaGeoDataFrame
Name of the second IdaGeoDataFrame on which the function ST_EQUALS() will be invoked.
- Returns:
- Returns an IdaGeoDataFrame with three columns:
- INDEXERIDA1indexer of the first IdaGeoSeries (None if not set),
- INDEXERIDA2indexer of the second IdaGeoSeries (None if not set),
- RESULTthe result of the operation
References
Netezza Performance Server Analytics ST_WITHIN() function.
Examples
>>> idageodf_customer = IdaGeoDataFrame(idadb,'SAMPLES.GEO_CUSTOMER',indexer='OBJECTID') >>> idageodf_customer.set_geometry('SHAPE') >>> idageodf_county = IdaGeoDataFrame(idadb,'SAMPLES.GEO_COUNTY',indexer='OBJECTID') >>> idageodf_county.set_geometry('SHAPE') >>> ida1 = idageodf_customer[idageodf_customer['INSURANCE_VALUE']>250000] >>> ida2 = idageodf_county[idageodf_county['NAME']=='Madison'] >>> result = ida1.within(ida2) >>> result[result['RESULT']==1].head() INDEXERIDA1 INDEXERIDA2 RESULT 134 21473 1 134 21413 1 134 21414 1 134 21417 1 134 21419 1