Package mapnik :: Module _mapnik :: Class Map

Class Map

 object --+    
          |    
??.instance --+
              |
             Map

The map object.

Instance Methods
 
__getinitargs__(...)
__getinitargs__( (Map)arg1) -> tuple :
 
__getstate__(...)
__getstate__( (Map)arg1) -> tuple :
 
__init__(...)
__init__( (object)arg1, (int)width, (int)height [, (str)srs]) -> None : Create a Map with a width and height as integers and, optionally, an srs string either with a Proj.4 epsg code ('+init=epsg:<code>') or with a Proj.4 literal ('+proj=<literal>').
 
__reduce__(...)
helper for pickle
 
__setstate__(...)
__setstate__( (Map)arg1, (tuple)arg2) -> None :
 
append_style(...)
append_style( (Map)arg1, (str)arg2, (Style)arg3) -> bool : Insert a Mapnik Style onto the map by appending it.
 
buffered_envelope(...)
buffered_envelope( (Map)arg1) -> Envelope : Get the Envelope() of the Map given the Map.buffer_size.
 
envelope(...)
envelope( (Map)arg1) -> Envelope : Return the Map Envelope object and print the string representation of the current extent of the map.
 
find_style(...)
find_style( (Map)arg1, (str)arg2) -> Style : Query the Map for a style by name and return a style object if found or raise KeyError style if not found.
 
get_aspect_fix_mode(...)
get_aspect_fix_mode( (Map)arg1) -> aspect_fix_mode : Get aspect fix mode.
 
pan(...)
pan( (Map)arg1, (int)arg2, (int)arg3) -> None : Set the Map center at a given x,y location as integers in the coordinates of the pixmap or map surface.
 
pan_and_zoom(...)
pan_and_zoom( (Map)arg1, (int)arg2, (int)arg3, (float)arg4) -> None : Set the Map center at a given x,y location and zoom factor as a float.
 
query_map_point(...)
query_map_point( (Map)arg1, (int)arg2, (float)arg3, (float)arg4) -> Featureset : Query a Map Layer (by layer index) for features intersecting the given x,y location in the coordinates of the pixmap or map surface.
 
query_point(...)
query_point( (Map)arg1, (int)arg2, (float)arg3, (float)arg4) -> Featureset : Query a Map Layer (by layer index) for features intersecting the given x,y location in the coordinates of map projection.
 
remove_all(...)
remove_all( (Map)arg1) -> None : Remove all Mapnik Styles and Layers from the Map.
 
remove_style(...)
remove_style( (Map)arg1, (str)arg2) -> None : Remove a Mapnik Style from the map.
 
resize(...)
resize( (Map)arg1, (int)arg2, (int)arg3) -> None : Resize a Mapnik Map.
 
scale(...)
scale( (Map)arg1) -> float : Return the Map Scale.
 
scale_denominator(...)
scale_denominator( (Map)arg1) -> float : Return the Map Scale Denominator.
 
view_transform(...)
view_transform( (Map)arg1) -> ViewTransform : Map CoordinateTransform object.
 
zoom(...)
zoom( (Map)arg1, (float)arg2) -> None : Zoom in by a given factor.
 
zoom_all(...)
zoom_all( (Map)arg1) -> None : Set the geographical extent of the map to the combined extents of all active layers.
 
zoom_to_box(...)
zoom_to_box( (Map)arg1, (Envelope)arg2) -> None : Set the geographical extent of the map by specifying a Mapnik Envelope.

Inherited from unreachable.instance: __new__

Inherited from object: __delattr__, __getattribute__, __hash__, __reduce_ex__, __repr__, __setattr__, __str__

Class Variables
  __instance_size__ = 128
  __safe_for_unpickling__ = True
Properties
  aspect_fix_mode
Get/Set aspect fix mode.
  background
The background color of the map.
  buffer_size
Get/Set the size of buffer around map in pixels.
  height
Get/Set the height of the map in pixels.
  layers
The list of map layers.
  srs
Spatial reference in Proj.4 format.
  width
Get/Set the width of the map in pixels.

Inherited from object: __class__

Method Details

__getinitargs__(...)

 

__getinitargs__( (Map)arg1) -> tuple :

    C++ signature :
        boost::python::tuple __getinitargs__(mapnik::Map)

__getstate__(...)

 

__getstate__( (Map)arg1) -> tuple :

    C++ signature :
        boost::python::tuple __getstate__(mapnik::Map)

__init__(...)
(Constructor)

 

__init__( (object)arg1, (int)width, (int)height [, (str)srs]) -> None :
    Create a Map with a width and height as integers and, optionally,
    an srs string either with a Proj.4 epsg code ('+init=epsg:<code>')
    or with a Proj.4 literal ('+proj=<literal>').
    If no srs is specified the map will default to '+proj=latlong +datum=WGS84'
    
    Usage:
    >>> from mapnik import Map
    >>> m = Map(600,400)
    >>> m
    <mapnik._mapnik.Map object at 0x6a240>
    >>> m.srs
    '+proj=latlong +datum=WGS84'
    

    C++ signature :
        void __init__(_object*,int,int [,std::string])

Overrides: object.__init__

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

__setstate__(...)

 

__setstate__( (Map)arg1, (tuple)arg2) -> None :

    C++ signature :
        void __setstate__(mapnik::Map {lvalue},boost::python::tuple)

append_style(...)

 

append_style( (Map)arg1, (str)arg2, (Style)arg3) -> bool :
    Insert a Mapnik Style onto the map by appending it.
    
    Usage:
    >>> sty
    <mapnik._mapnik.Style object at 0x6a330>
    >>> m.append_style('Style Name', sty)
    True # style object added to map by name
    >>> m.append_style('Style Name', sty)
    False # you can only append styles with unique names
    

    C++ signature :
        bool append_style(mapnik::Map {lvalue},std::string,mapnik::feature_type_style)

buffered_envelope(...)

 

buffered_envelope( (Map)arg1) -> Envelope :
    Get the Envelope() of the Map given
    the Map.buffer_size.
    
    Usage:
    >>> m = Map(600,400)
    >>> m.envelope()
    Envelope(-1.0,-1.0,0.0,0.0)
    >>> m.buffered_envelope()
    Envelope(-1.0,-1.0,0.0,0.0)
    >>> m.buffer_size = 1
    >>> m.buffered_envelope()
    Envelope(-1.02222222222,-1.02222222222,0.0222222222222,0.0222222222222)
    

    C++ signature :
        mapnik::Envelope<double> buffered_envelope(mapnik::Map {lvalue})

envelope(...)

 

envelope( (Map)arg1) -> Envelope :
    Return the Map Envelope object
    and print the string representation
    of the current extent of the map.
    
    Usage:
    >>> m.envelope()
    Envelope(-0.185833333333,-0.96,0.189166666667,-0.71)
    >>> dir(m.envelope())
    ...'center', 'contains', 'expand_to_include', 'forward',
    ...'height', 'intersect', 'intersects', 'inverse', 'maxx',
    ...'maxy', 'minx', 'miny', 'width'
    

    C++ signature :
        mapnik::Envelope<double> envelope(mapnik::Map {lvalue})

find_style(...)

 

find_style( (Map)arg1, (str)arg2) -> Style :
    Query the Map for a style by name and return
    a style object if found or raise KeyError
    style if not found.
    
    Usage:
    >>> m.find_style('Style Name')
    <mapnik._mapnik.Style object at 0x654f0>
    

    C++ signature :
        mapnik::feature_type_style find_style(mapnik::Map,std::string)

get_aspect_fix_mode(...)

 

get_aspect_fix_mode( (Map)arg1) -> aspect_fix_mode :
    Get aspect fix mode.
    Usage:
    
    >>> m.get_aspect_fix_mode()
    

    C++ signature :
        mapnik::Map::aspect_fix_mode get_aspect_fix_mode(mapnik::Map {lvalue})

pan(...)

 

pan( (Map)arg1, (int)arg2, (int)arg3) -> None :
    Set the Map center at a given x,y location
    as integers in the coordinates of the pixmap or map surface.
    
    Usage:
    >>> m = Map(600,400)
    >>> m.envelope().center()
    Coord(-0.5,-0.5) # default Map center
    >>> m.pan(-1,-1)
    >>> m.envelope().center()
    Coord(0.00166666666667,-0.835)
    

    C++ signature :
        void pan(mapnik::Map {lvalue},int,int)

pan_and_zoom(...)

 

pan_and_zoom( (Map)arg1, (int)arg2, (int)arg3, (float)arg4) -> None :
    Set the Map center at a given x,y location
    and zoom factor as a float.
    
    Usage:
    >>> m = Map(600,400)
    >>> m.envelope().center()
    Coord(-0.5,-0.5) # default Map center
    >>> m.scale()
    -0.0016666666666666668
    >>> m.pan_and_zoom(-1,-1,0.25)
    >>> m.scale()
    0.00062500000000000001
    

    C++ signature :
        void pan_and_zoom(mapnik::Map {lvalue},int,int,double)

query_map_point(...)

 

query_map_point( (Map)arg1, (int)arg2, (float)arg3, (float)arg4) -> Featureset :
    Query a Map Layer (by layer index) for features 
    intersecting the given x,y location in the coordinates
    of the pixmap or map surface.
    Will return a Mapnik Featureset if successful
    otherwise will return None.
    
    Usage:
    >>> featureset = m.query_map_point(0,200,200)
    >>> featureset
    <mapnik._mapnik.Featureset object at 0x23b0b0>
    >>> featureset.features
    >>> [<mapnik.Feature object at 0x3995630>]
    

    C++ signature :
        boost::shared_ptr<mapnik::Featureset> query_map_point(mapnik::Map {lvalue},unsigned int,double,double)

query_point(...)

 

query_point( (Map)arg1, (int)arg2, (float)arg3, (float)arg4) -> Featureset :
    Query a Map Layer (by layer index) for features 
    intersecting the given x,y location in the coordinates
    of map projection.
    Will return a Mapnik Featureset if successful
    otherwise will return None.
    
    Usage:
    >>> featureset = m.query_point(0,-122,48)
    >>> featureset
    <mapnik._mapnik.Featureset object at 0x23b0b0>
    >>> featureset.features
    >>> [<mapnik.Feature object at 0x3995630>]
    

    C++ signature :
        boost::shared_ptr<mapnik::Featureset> query_point(mapnik::Map {lvalue},unsigned int,double,double)

remove_all(...)

 

remove_all( (Map)arg1) -> None :
    Remove all Mapnik Styles and Layers from the Map.
    
    Usage:
    >>> m.remove_all()
    

    C++ signature :
        void remove_all(mapnik::Map {lvalue})

remove_style(...)

 

remove_style( (Map)arg1, (str)arg2) -> None :
    Remove a Mapnik Style from the map.
    
    Usage:
    >>> m.remove_style('Style Name')
    

    C++ signature :
        void remove_style(mapnik::Map {lvalue},std::string)

resize(...)

 

resize( (Map)arg1, (int)arg2, (int)arg3) -> None :
    Resize a Mapnik Map.
    
    Usage:
    >>> m.resize(64,64)
    

    C++ signature :
        void resize(mapnik::Map {lvalue},unsigned int,unsigned int)

scale(...)

 

scale( (Map)arg1) -> float :
    Return the Map Scale.
    Usage:
    
    >>> m.scale()
    

    C++ signature :
        double scale(mapnik::Map {lvalue})

scale_denominator(...)

 

scale_denominator( (Map)arg1) -> float :
    Return the Map Scale Denominator.
    Usage:
    
    >>> m.scale_denominator
    

    C++ signature :
        double scale_denominator(mapnik::Map {lvalue})

view_transform(...)

 

view_transform( (Map)arg1) -> ViewTransform :
    Map CoordinateTransform object.
    
    Usage:
    >>> m.view_transform()
    

    C++ signature :
        mapnik::CoordTransform view_transform(mapnik::Map {lvalue})

zoom(...)

 

zoom( (Map)arg1, (float)arg2) -> None :
    Zoom in by a given factor.
    Usage:
    
    >>> m.zoom(0.25)
    

    C++ signature :
        void zoom(mapnik::Map {lvalue},double)

zoom_all(...)

 

zoom_all( (Map)arg1) -> None :
    Set the geographical extent of the map
    to the combined extents of all active layers.
    
    Usage:
    >>> m.zoom_all()
    

    C++ signature :
        void zoom_all(mapnik::Map {lvalue})

zoom_to_box(...)

 

zoom_to_box( (Map)arg1, (Envelope)arg2) -> None :
    Set the geographical extent of the map
    by specifying a Mapnik Envelope.
    
    Usage:
    >>> extext = Envelope(-180.0, -90.0, 180.0, 90.0)
    >>> m.zoom_to_box(extent)
    

    C++ signature :
        void zoom_to_box(mapnik::Map {lvalue},mapnik::Envelope<double>)


Property Details

aspect_fix_mode

Get/Set aspect fix mode. Usage:

>>> m.aspect_fix_mode = aspect_fix_mode.GROW_BBOX
Get Method:
unreachable(...)
Set Method:
unreachable(...)

background

The background color of the map.

Usage: >>> m.background = Color('steelblue')

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

buffer_size

Get/Set the size of buffer around map in pixels.

Usage: >>> m.buffer_size 0 # zero by default >>> m.buffer_size = 2 >>> m.buffer_size 2

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

height

Get/Set the height of the map in pixels. Minimum settable size is 16 pixels.

Usage: >>> m.height 400 >>> m.height = 600 >>> m.height 600

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

layers

The list of map layers.

Usage: >>> m.layers <mapnik._mapnik.Layers object at 0x6d458>>>> m.layers[0] <mapnik._mapnik.Layer object at 0x5fe130>

Get Method:
unreachable(...)

srs

Spatial reference in Proj.4 format.
Either an epsg code or proj literal.
For example, a proj literal:
        '+proj=latlong +datum=WGS84'
and a proj epsg code:
        '+init=epsg:4326'

Note: using epsg codes requires the installation of
the Proj.4 'epsg' data file normally found in '/usr/local/share/proj'

Usage:
>>> m.srs
'+proj=latlong +datum=WGS84' # The default srs if not initialized with custom srs
>>> # set to google mercator with Proj.4 literal
... 
>>> m.srs = '+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 +over'

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

width

Get/Set the width of the map in pixels. Minimum settable size is 16 pixels.

Usage: >>> m.width 600 >>> m.width = 800 >>> m.width 800

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