Package mapproxy :: Package core :: Module srs :: Class _SRS
[hide private]
[frames] | no frames]

Class _SRS

source code

object --+
         |
        _SRS

Instance Methods [hide private]
 
__init__(self, srs_code)
Create a new SRS with the given srs_code code.
source code
 
transform_to(self, other_srs, points) source code
 
transform_bbox_to(self, other_srs, bbox, with_points=16) source code
 
align_bbox(self, bbox)
Align bbox to reasonable values to prevent errors in transformations.
source code
 
__eq__(self, other) source code
 
__ne__(self, other) source code
 
__str__(self)
str(x)
source code
 
__repr__(self)
repr(x)
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__

Class Variables [hide private]
  proj_init = {'EPSG:900913': lambda: Proj('+proj=merc +a=637813...
This class represents a Spatial Reference System.
Properties [hide private]
  is_latlong
  is_axis_order_ne
Returns True if the axis order is North, then East (i.e.
  is_axis_order_en
Returns True if the axis order is East then North (i.e.

Inherited from object: __class__

Method Details [hide private]

__init__(self, srs_code)
(Constructor)

source code 
Create a new SRS with the given srs_code code.
Overrides: object.__init__

transform_to(self, other_srs, points)

source code 
>>> srs1 = SRS(4326)
>>> srs2 = SRS(900913)
>>> [str(round(x, 5)) for x in srs1.transform_to(srs2, (8.22, 53.15))]
['915046.21432', '7010792.20171']
>>> srs1.transform_to(srs1, (8.25, 53.5))
(8.25, 53.5)
>>> [(str(round(x, 5)), str(round(y, 5))) for x, y in
...  srs1.transform_to(srs2, [(8.2, 53.1), (8.22, 53.15), (8.3, 53.2)])]
... #doctest: +NORMALIZE_WHITESPACE
[('912819.8245', '7001516.67745'),
 ('915046.21432', '7010792.20171'),
 ('923951.77358', '7020078.53264')]
Parameters:
  • points ((x, y) or [(x1, y1), (x2, y2), …])

transform_bbox_to(self, other_srs, bbox, with_points=16)

source code 
>>> ['%.3f' % x for x in
...  SRS(4326).transform_bbox_to(SRS(900913), (-180.0, -90.0, 180.0, 90.0))]
['-20037508.343', '-147730762.670', '20037508.343', '147730758.195']
>>> ['%.5f' % x for x in
...  SRS(4326).transform_bbox_to(SRS(900913), (8.2, 53.1, 8.3, 53.2))]
['912819.82450', '7001516.67745', '923951.77358', '7020078.53264']
>>> SRS(4326).transform_bbox_to(SRS(4326), (8.25, 53.0, 8.5, 53.75))
(8.25, 53.0, 8.5, 53.75)
Parameters:
  • with_points - the number of points to use for the transformation. A bbox transformation with only two or four points may cut off some parts due to distortions.

align_bbox(self, bbox)

source code 

Align bbox to reasonable values to prevent errors in transformations. E.g. transformations from EPSG:4326 with lat=90 or -90 will fail, so we subtract a tiny delta.

At the moment only EPSG:4326 bbox will be modifyed.

>>> SRS(4326).align_bbox((-180, -90, 180, 90))
(-180, -89.999999990000006, 180, 89.999999990000006)

__str__(self)
(Informal representation operator)

source code 
>>> print(SRS(4326))
SRS EPSG:4326 ('+units=m +init=epsg:4326 ')
Overrides: object.__str__

__repr__(self)
(Representation operator)

source code 
>>> repr(SRS(4326))
"SRS('EPSG:4326')"
Overrides: object.__repr__

Class Variable Details [hide private]

proj_init

This class represents a Spatial Reference System.
Value:
{'EPSG:900913': lambda: Proj('+proj=merc +a=6378137 +b=6378137 +lat_ts\
=0.0 ' '+lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m ' '+nadgrids=@null \
+no_defs'), 'CRS:84': lambda: Proj(init= 'epsg:4326'),}

Property Details [hide private]

is_latlong

>>> SRS(4326).is_latlong
True
>>> SRS(31466).is_latlong
False
Get Method:
unreachable.is_latlong(self)

is_axis_order_ne

Returns True if the axis order is North, then East (i.e. y/x or lat/lon).

>>> SRS(4326).is_axis_order_ne
True
>>> SRS('CRS:84').is_axis_order_ne
False
>>> SRS(31468).is_axis_order_ne
True
>>> SRS(31463).is_axis_order_ne
False
>>> SRS(25831).is_axis_order_ne
False
Get Method:
unreachable.is_axis_order_ne(self) - Returns True if the axis order is North, then East (i.e.

is_axis_order_en

Returns True if the axis order is East then North (i.e. x/y or lon/lat).
Get Method:
unreachable.is_axis_order_en(self) - Returns True if the axis order is East then North (i.e.