Package mapnik :: Module _mapnik :: Class Layer

Class Layer

 object --+    
          |    
??.instance --+
              |
             Layer

A Mapnik map layer.

Instance Methods
 
__getinitargs__(...)
__getinitargs__( (Layer)arg1) -> tuple :
 
__getstate__(...)
__getstate__( (Layer)arg1) -> tuple :
 
__init__(...)
__init__( (object)arg1, (str)arg2 [, (str)arg3]) -> None : Create a Layer with a named string and, optionally, an srs string.
 
__reduce__(...)
helper for pickle
 
__setstate__(...)
__setstate__( (Layer)arg1, (tuple)arg2) -> None :
 
envelope(...)
envelope( (Layer)arg1) -> Envelope : Return the geographic envelope/bounding box.
 
visible(...)
visible( (Layer)arg1, (float)arg2) -> bool : Return True if this layer's data is active and visible at a given scale.

Inherited from unreachable.instance: __new__

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

Class Variables
  __instance_size__ = 64
  __safe_for_unpickling__ = True
Properties
  abstract
Get/Set the abstract of the layer.
  active
Get/Set whether this layer is active and will be rendered.
  clear_label_cache
Get/Set whether this layer's labels are cached.
  datasource
The datasource attached to this layer.
  maxzoom
Get/Set the maximum zoom lever of the layer.
  minzoom
Get/Set the minimum zoom lever of the layer.
  name
Get/Set the name of the layer.
  queryable
Get/Set whether this layer is queryable.
  srs
Get/Set the SRS of the layer.
  styles
The styles list attached to this layer.
  title
Get/Set the title of the layer.

Inherited from object: __class__

Method Details

__getinitargs__(...)

 

__getinitargs__( (Layer)arg1) -> tuple :

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

__getstate__(...)

 

__getstate__( (Layer)arg1) -> tuple :

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

__init__(...)
(Constructor)

 

__init__( (object)arg1, (str)arg2 [, (str)arg3]) -> None :
    Create a Layer with a named string and, optionally, an srs string.
    
    The srs can be either a Proj.4 epsg code ('+init=epsg:<code>') or
    of a Proj.4 literal ('+proj=<literal>').
    If no srs is specified it will default to '+proj=latlong +datum=WGS84'
    
    Usage:
    >>> from mapnik import Layer
    >>> lyr = Layer('My Layer','+proj=latlong +datum=WGS84')
    >>> lyr
    <mapnik._mapnik.Layer object at 0x6a270>
    

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

Overrides: object.__init__

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

__setstate__(...)

 

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

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

envelope(...)

 

envelope( (Layer)arg1) -> Envelope :
    Return the geographic envelope/bounding box.
    Determined based on the layer datasource.
    
    Usage:
    >>> from mapnik import Layer
    >>> lyr = Layer('My Layer','+proj=latlong +datum=WGS84')
    >>> lyr.envelope()
    Envelope(-1.0,-1.0,0.0,0.0) # default until a datasource is loaded
    

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

visible(...)

 

visible( (Layer)arg1, (float)arg2) -> bool :
    Return True if this layer's data is active and visible at a given scale.
    
    Otherwise returns False.
    Accepts a scale value as an integer or float input.
    Will return False if:
        scale >= minzoom - 1e-6
        or:
        scale < maxzoom + 1e-6
    
    Usage:
    >>> from mapnik import Layer
    >>> lyr = Layer('My Layer','+proj=latlong +datum=WGS84')
    >>> lyr.visible(1.0/1000000)
    True
    >>> lyr.active = False
    >>> lyr.visible(1.0/1000000)
    False
    

    C++ signature :
        bool visible(mapnik::Layer {lvalue},double)


Property Details

abstract

Get/Set the abstract of the layer.

Usage: >>> from mapnik import Layer >>> lyr = Layer('My Layer','+proj=latlong +datum=WGS84') >>> lyr.abstract '' # default is en empty string >>> lyr.abstract = 'My Shapefile rendered with Mapnik' >>> lyr.abstract 'My Shapefile rendered with Mapnik'

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

active

Get/Set whether this layer is active and will be rendered.

Usage: >>> from mapnik import Layer >>> lyr = Layer('My Layer','+proj=latlong +datum=WGS84') >>> lyr.active True # Active by default >>> lyr.active = False # set False to disable layer rendering >>> lyr.active False

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

clear_label_cache

Get/Set whether this layer's labels are cached.

Usage: TODO

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

datasource

The datasource attached to this layer.

Usage: >>> from mapnik import Layer, Datasource >>> lyr = Layer('My Layer','+proj=latlong +datum=WGS84') >>> lyr.datasource = Datasource(type='shape',file='world_borders') >>> lyr.datasource <mapnik.Datasource object at 0x65470>

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

maxzoom

Get/Set the maximum zoom lever of the layer.

Usage: >>> from mapnik import Layer >>> lyr = Layer('My Layer','+proj=latlong +datum=WGS84') >>> lyr.maxzoom 1.7976931348623157e+308 # default is the numerical maximum >>> lyr.maxzoom = 1.0/1000000 >>> lyr.maxzoom 9.9999999999999995e-07

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

minzoom

Get/Set the minimum zoom lever of the layer.

Usage: >>> from mapnik import Layer >>> lyr = Layer('My Layer','+proj=latlong +datum=WGS84') >>> lyr.minzoom # default is 0 0.0 >>> lyr.minzoom = 1.0/1000000 >>> lyr.minzoom 9.9999999999999995e-07

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

name

Get/Set the name of the layer.

Usage: >>> from mapnik import Layer >>> lyr = Layer('My Layer','+proj=latlong +datum=WGS84') >>> lyr.name 'My Layer' >>> lyr.name = 'New Name' >>> lyr.name 'New Name'

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

queryable

Get/Set whether this layer is queryable.

Usage: >>> from mapnik import Layer >>> lyr = Layer('My Layer','+proj=latlong +datum=WGS84') >>> lyr.queryable False # Not queryable by default >>> lyr.queryable = True >>> lyr.queryable True

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

srs

Get/Set the SRS of the layer.

Usage: >>> from mapnik import Layer >>> lyr = Layer('My Layer','+proj=latlong +datum=WGS84') >>> lyr.srs '+proj=latlong +datum=WGS84' # The default srs if not initialized with custom srs >>> # set to google mercator with Proj.4 literal ... >>> lyr.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(...)

styles

The styles list attached to this layer.

Usage:
>>> from mapnik import Layer
>>> lyr = Layer('My Layer','+proj=latlong +datum=WGS84')
>>> lyr.styles
<mapnik._mapnik.Names object at 0x6d3e8>
>>> len(lyr.styles)
0
 # no styles until you append them
lyr.styles.append('My Style') # mapnik uses named styles for flexibility
>>> len(lyr.styles)
1
>>> lyr.styles[0]
'My Style'

Get Method:
unreachable(...)

title

Get/Set the title of the layer.

Usage: >>> from mapnik import Layer >>> lyr = Layer('My Layer','+proj=latlong +datum=WGS84') >>> lyr.title '' >>> lyr.title = 'My first layer' >>> lyr.title 'My first layer'

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