Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion lib/cartopy/_crs.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,17 @@ class Geodetic(CRS):
# XXX Providing a default datum is bad. Providing the ellipse on its own is sufficient to define the ellipse,
# and in some cases, can overwrite the desired, well defined ellipse.
def __init__(self, ellipse='WGS84', datum='WGS84'):
"""
Create a Geodetic CRS.

Kwargs:

* ellipse - Ellipsoid definiton.
* datum - Datum definiton.

"""
proj4_params = {'proj': 'lonlat', 'ellps': ellipse, 'datum': datum}
super(Geodetic, self).__init__(proj4_params)
super(Geodetic, self).__init__(proj4_params)

# XXX Implement fwd such as Basemap's Geod. Would be used in the tissot example.
# Could come from http://geographiclib.sourceforge.net
Expand Down
28 changes: 28 additions & 0 deletions lib/cartopy/crs.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,34 @@
import cartopy.trace


class RotatedGeodetic(CRS):
"""
Defines a rotated latitude/longitude coordinate system with spherical topology
and geographical distance.

Coordinates are measured in degrees.

"""
def __init__(self, pole_longitude, pole_latitude, ellipse='WGS84', datum='WGS84'):
"""
Create a RotatedGeodetic CRS.

Args:

* pole_longitude, pole_latitude - Pole position, in unrotated degrees.

Kwargs:

* ellipse - Ellipsoid definiton.
* datum - Datum definiton.

"""
proj4_params = {'proj': 'ob_tran', 'o_proj': 'latlon', 'o_lon_p': 0,
'o_lat_p': pole_latitude, 'lon_0': 180 + pole_longitude,
'to_meter': math.radians(1), 'ellps': ellipse, 'datum': datum}
super(RotatedGeodetic, self).__init__(proj4_params)


class Projection(CRS):
"""
Defines a projected coordinate system with flat topology and Euclidean
Expand Down