class documentation

class SpatialReference(GDALBase): (source)

View In Hierarchy

A wrapper for the OGRSpatialReference object. According to the GDAL web site, the SpatialReference object "provide[s] services to represent coordinate systems (projections and datums) and to transform between them."

Method __getitem__ Return the value of the given string attribute node, None if the node doesn't exist. Can also take a tuple as a parameter, (target, child), where child is the index of the attribute in the WKT. For example:...
Method __init__ Create a GDAL OSR Spatial Reference object from the given input. The input may be string of OGC Well Known Text (WKT), an integer EPSG code, a PROJ string, and/or a projection "well known" shorthand string (one of 'WGS84', 'WGS72', 'NAD27', 'NAD83').
Method __str__ Use 'pretty' WKT.
Method attr_value The attribute value for the given target node (e.g. 'PROJCS'). The index keyword specifies an index of the child node to return.
Method auth_code Return the authority code for the given string target node.
Method auth_name Return the authority name for the given string target node.
Method clone Return a clone of this SpatialReference object.
Method from_esri Morph this SpatialReference from ESRI's format to EPSG.
Method identify_epsg This method inspects the WKT of this SpatialReference, and will add EPSG authority nodes where an EPSG identifier is applicable.
Method import_epsg Import the Spatial Reference from the EPSG code (an integer).
Method import_proj Import the Spatial Reference from a PROJ string.
Method import_user_input Import the Spatial Reference from the given user input string.
Method import_wkt Import the Spatial Reference from OGC WKT (string)
Method import_xml Import the Spatial Reference from an XML string.
Method to_esri Morph this SpatialReference to ESRI's format.
Method validate Check to see if the given spatial reference is valid.
Instance Variable axis_order Undocumented
Instance Variable ptr Undocumented
Property angular_name Return the name of the angular units.
Property angular_units Return the value of the angular units.
Property ellipsoid Return a tuple of the ellipsoid parameters: (semimajor axis, semiminor axis, and inverse flattening)
Property geographic Return True if this SpatialReference is geographic (root node is GEOGCS).
Property inverse_flattening Return the Inverse Flattening for this Spatial Reference.
Property linear_name Return the name of the linear units.
Property linear_units Return the value of the linear units.
Property local Return True if this SpatialReference is local (root node is LOCAL_CS).
Property name Return the name of this Spatial Reference.
Property pretty_wkt Return the 'pretty' representation of the WKT.
Property proj Return the PROJ representation for this Spatial Reference.
Property proj4 Alias for proj().
Property projected Return True if this SpatialReference is a projected coordinate system (root node is PROJCS).
Property semi_major Return the Semi Major Axis for this Spatial Reference.
Property semi_minor Return the Semi Minor Axis for this Spatial Reference.
Property srid Return the SRID of top-level authority, or None if undefined.
Property units Return a 2-tuple of the units value and the units name. Automatically determine whether to return the linear or angular units.
Property wkt Return the WKT representation of this Spatial Reference.
Property xml Return the XML representation of this Spatial Reference.

Inherited from CPointerBase (via GDALBase):

Method __del__ Free the memory used by the C++ object.
Method ptr.setter Undocumented
Class Variable destructor Undocumented
Instance Variable _ptr Undocumented
def __getitem__(self, target): (source)

Return the value of the given string attribute node, None if the node doesn't exist. Can also take a tuple as a parameter, (target, child), where child is the index of the attribute in the WKT. For example: >>> wkt = 'GEOGCS["WGS 84", DATUM["WGS_1984, ... AUTHORITY["EPSG","4326"]]' >>> srs = SpatialReference(wkt) # could also use 'WGS84', or 4326 >>> print(srs['GEOGCS']) WGS 84 >>> print(srs['DATUM']) WGS_1984 >>> print(srs['AUTHORITY']) EPSG >>> print(srs['AUTHORITY', 1]) # The authority value 4326 >>> print(srs['TOWGS84', 4]) # the fourth value in this wkt 0 >>> # For the units authority, have to use the pipe symbole. >>> print(srs['UNIT|AUTHORITY']) EPSG >>> print(srs['UNIT|AUTHORITY', 1]) # The authority value for the units 9122

def __init__(self, srs_input='', srs_type='user', axis_order=None): (source)

Create a GDAL OSR Spatial Reference object from the given input. The input may be string of OGC Well Known Text (WKT), an integer EPSG code, a PROJ string, and/or a projection "well known" shorthand string (one of 'WGS84', 'WGS72', 'NAD27', 'NAD83').

def __str__(self): (source)

Use 'pretty' WKT.

def attr_value(self, target, index=0): (source)

The attribute value for the given target node (e.g. 'PROJCS'). The index keyword specifies an index of the child node to return.

def auth_code(self, target): (source)

Return the authority code for the given string target node.

def auth_name(self, target): (source)

Return the authority name for the given string target node.

def clone(self): (source)

Return a clone of this SpatialReference object.

def from_esri(self): (source)

Morph this SpatialReference from ESRI's format to EPSG.

def identify_epsg(self): (source)

This method inspects the WKT of this SpatialReference, and will add EPSG authority nodes where an EPSG identifier is applicable.

def import_epsg(self, epsg): (source)

Import the Spatial Reference from the EPSG code (an integer).

def import_proj(self, proj): (source)

Import the Spatial Reference from a PROJ string.

def import_user_input(self, user_input): (source)

Import the Spatial Reference from the given user input string.

def import_wkt(self, wkt): (source)

Import the Spatial Reference from OGC WKT (string)

def import_xml(self, xml): (source)

Import the Spatial Reference from an XML string.

def to_esri(self): (source)

Morph this SpatialReference to ESRI's format.

def validate(self): (source)

Check to see if the given spatial reference is valid.

axis_order = (source)

Undocumented

@property
angular_name = (source)

Return the name of the angular units.

@property
angular_units = (source)

Return the value of the angular units.

Return a tuple of the ellipsoid parameters: (semimajor axis, semiminor axis, and inverse flattening)

Return True if this SpatialReference is geographic (root node is GEOGCS).

@property
inverse_flattening = (source)

Return the Inverse Flattening for this Spatial Reference.

@property
linear_name = (source)

Return the name of the linear units.

@property
linear_units = (source)

Return the value of the linear units.

Return True if this SpatialReference is local (root node is LOCAL_CS).

Return the name of this Spatial Reference.

Return the 'pretty' representation of the WKT.

Return the PROJ representation for this Spatial Reference.

Alias for proj().

Return True if this SpatialReference is a projected coordinate system (root node is PROJCS).

Return the Semi Major Axis for this Spatial Reference.

Return the Semi Minor Axis for this Spatial Reference.

Return the SRID of top-level authority, or None if undefined.

Return a 2-tuple of the units value and the units name. Automatically determine whether to return the linear or angular units.

Return the WKT representation of this Spatial Reference.

Return the XML representation of this Spatial Reference.