Package mapnik :: Class Coord

Class Coord

 object --+    
          |    
??.instance --+
              |
             Coord
Known Subclasses:

Represents a point with two coordinates (either lon/lat or x/y).

Following operators are defined for Coord:

Addition and subtraction of Coord objects:

>>> Coord(10, 10) + Coord(20, 20)
Coord(30.0, 30.0)
>>> Coord(10, 10) - Coord(20, 20)
Coord(-10.0, -10.0)

Addition, subtraction, multiplication and division between a Coord and a float:

>>> Coord(10, 10) + 1
Coord(11.0, 11.0)
>>> Coord(10, 10) - 1
Coord(-9.0, -9.0)
>>> Coord(10, 10) * 2
Coord(20.0, 20.0)
>>> Coord(10, 10) / 2
Coord(5.0, 5.0)

Equality of coords (as pairwise equality of components): >>> Coord(10, 10) is Coord(10, 10) False >>> Coord(10, 10) == Coord(10, 10) True

Instance Methods
 
__add__(...)
__add__( (Coord)arg1, (Coord)arg2) -> object :
 
__div__(...)
__div__( (Coord)arg1, (float)arg2) -> object :
 
__eq__(...)
__eq__( (Coord)arg1, (Coord)arg2) -> object :
 
__getinitargs__(...)
__getinitargs__( (Coord)arg1) -> tuple :
 
__init__(...)
__init__( (object)arg1, (float)x, (float)y) -> None : Constructs a new point with the given coordinates.
 
__mul__(...)
__mul__( (Coord)arg1, (float)arg2) -> object :
 
__radd__(...)
__radd__( (Coord)arg1, (float)arg2) -> object :
 
__reduce__(...)
helper for pickle
 
__repr__(self)
repr(x)
 
__rmul__(...)
__rmul__( (Coord)arg1, (float)arg2) -> object :
 
__sub__(...)
__sub__( (Coord)arg1, (Coord)arg2) -> object :
 
_c___repr__(x)
repr(x)
 
forward(self, projection)
Projects the point from the geographic coordinate space into the cartesian space.
 
inverse(self, projection)
Projects the point from the cartesian space into the geographic space.

Inherited from unreachable.instance: __new__

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables
  __instance_size__ = 32
  __safe_for_unpickling__ = True
  _c___doc__ = None
  _c___module__ = 'mapnik._mapnik'
Properties
  x
Gets or sets the x/lon coordinate of the point.
  y
Gets or sets the y/lat coordinate of the point.

Inherited from object: __class__

Method Details

__add__(...)
(Addition operator)

 

__add__( (Coord)arg1, (Coord)arg2) -> object :

    C++ signature :
        _object* __add__(mapnik::coord<double, 2> {lvalue},mapnik::coord<double, 2>)

__add__( (Coord)arg1, (float)arg2) -> object :

    C++ signature :
        _object* __add__(mapnik::coord<double, 2> {lvalue},float)

__div__(...)

 

__div__( (Coord)arg1, (float)arg2) -> object :

    C++ signature :
        _object* __div__(mapnik::coord<double, 2> {lvalue},float)

__eq__(...)
(Equality operator)

 

__eq__( (Coord)arg1, (Coord)arg2) -> object :

    C++ signature :
        _object* __eq__(mapnik::coord<double, 2> {lvalue},mapnik::coord<double, 2>)

__getinitargs__(...)

 

__getinitargs__( (Coord)arg1) -> tuple :

    C++ signature :
        boost::python::tuple __getinitargs__(mapnik::coord<double, 2>)

__init__(...)
(Constructor)

 

__init__( (object)arg1, (float)x, (float)y) -> None :
    Constructs a new point with the given coordinates.
    

    C++ signature :
        void __init__(_object*,double,double)

Overrides: object.__init__

__mul__(...)

 

__mul__( (Coord)arg1, (float)arg2) -> object :

    C++ signature :
        _object* __mul__(mapnik::coord<double, 2> {lvalue},float)

__radd__(...)
(Right-side addition operator)

 

__radd__( (Coord)arg1, (float)arg2) -> object :

    C++ signature :
        _object* __radd__(mapnik::coord<double, 2> {lvalue},float)

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

__repr__(self)
(Representation operator)

 

repr(x)

Overrides: object.__repr__
(inherited documentation)

__rmul__(...)

 

__rmul__( (Coord)arg1, (float)arg2) -> object :

    C++ signature :
        _object* __rmul__(mapnik::coord<double, 2> {lvalue},float)

__sub__(...)
(Subtraction operator)

 

__sub__( (Coord)arg1, (Coord)arg2) -> object :

    C++ signature :
        _object* __sub__(mapnik::coord<double, 2> {lvalue},mapnik::coord<double, 2>)

__sub__( (Coord)arg1, (float)arg2) -> object :

    C++ signature :
        _object* __sub__(mapnik::coord<double, 2> {lvalue},float)

forward(self, projection)

 

Projects the point from the geographic coordinate
space  into the cartesian space. The x component is
considered to be longitude, the y component the
latitude.

Returns the easting (x) and northing (y) as a
coordinate pair.

Example: Project the geographic coordinates of the
         city center of Stuttgart into the local
         map projection (GK Zone 3/DHDN, EPSG 31467)
>>> p = Projection('+init=epsg:31467')
>>> Coord(9.1, 48.7).forward(p)
Coord(3507360.12813,5395719.2749)

inverse(self, projection)

 

Projects the point from the cartesian space
into the geographic space. The x component is
considered to be the easting, the y component
to be the northing.

Returns the longitude (x) and latitude (y) as a
coordinate pair.

Example: Project the cartesian coordinates of the
         city center of Stuttgart in the local
         map projection (GK Zone 3/DHDN, EPSG 31467)
         into geographic coordinates:
>>> p = Projection('+init=epsg:31467')
>>> Coord(3507360.12813,5395719.2749).inverse(p)
Coord(9.1, 48.7)


Property Details

x

Gets or sets the x/lon coordinate of the point.

Get Method:
unreachable(...)
Set Method:
unreachable(...)

y

Gets or sets the y/lat coordinate of the point.

Get Method:
unreachable(...)
Set Method:
unreachable(...)