| Home | Trees | Indices | Help |
|
|---|
|
|
object --+
|
??.instance --+
|
Layer
A Mapnik map layer.
| Instance Methods | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from Inherited from |
|||
| Class Variables | |
__instance_size__ = 112
|
|
__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. |
|
|
cache_features Get/Set whether features should be cached during rendering if used between multiple styles |
|
|
clear_label_cache Get/Set whether to clear the label collision detector cache for this layer during rendering |
|
|
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 |
|
| Method Details |
__getinitargs__( (Layer)arg1) -> tuple :
C++ signature :
boost::python::tuple __getinitargs__(mapnik::layer)
|
__getstate__( (Layer)arg1) -> tuple :
C++ signature :
boost::python::tuple __getstate__(mapnik::layer)
|
__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=longlat +ellps=WGS84 +datum=WGS84 +no_defs'
Usage:
>>> from mapnik import Layer
>>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')
>>> lyr
<mapnik._mapnik.Layer object at 0x6a270>
C++ signature :
void __init__(_object*,std::string [,std::string])
|
helper for pickle
|
__setstate__( (Layer)arg1, (tuple)arg2) -> None :
C++ signature :
void __setstate__(mapnik::layer {lvalue},boost::python::tuple)
|
envelope( (Layer)arg1) -> Box2d :
Return the geographic envelope/bounding box.
Determined based on the layer datasource.
Usage:
>>> from mapnik import Layer
>>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')
>>> lyr.envelope()
box2d(-1.0,-1.0,0.0,0.0) # default until a datasource is loaded
C++ signature :
mapnik::box2d<double> envelope(mapnik::layer {lvalue})
|
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=longlat +ellps=WGS84 +datum=WGS84 +no_defs')
>>> 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 |
abstractGet/Set the abstract of the layer. Usage: >>> from mapnik import Layer >>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs') >>> lyr.abstract '' # default is en empty string >>> lyr.abstract = 'My Shapefile rendered with Mapnik' >>> lyr.abstract 'My Shapefile rendered with Mapnik'
|
activeGet/Set whether this layer is active and will be rendered. Usage: >>> from mapnik import Layer >>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs') >>> lyr.active True # Active by default >>> lyr.active = False # set False to disable layer rendering >>> lyr.active False
|
cache_featuresGet/Set whether features should be cached during rendering if used between multiple styles Usage: >>> lyr.cache_features False # False by default >>> lyr.cache_features = True # set to True to enable feature caching
|
clear_label_cacheGet/Set whether to clear the label collision detector cache for this layer during rendering Usage: >>> lyr.clear_label_cache False # False by default, meaning label positions from other layers will impact placement >>> lyr.clear_label_cache = True # set to True to clear the label collision detector cache
|
datasourceThe datasource attached to this layer. Usage: >>> from mapnik import Layer, Datasource >>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs') >>> lyr.datasource = Datasource(type='shape',file='world_borders') >>> lyr.datasource <mapnik.Datasource object at 0x65470>
|
maxzoomGet/Set the maximum zoom lever of the layer. Usage: >>> from mapnik import Layer >>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs') >>> lyr.maxzoom 1.7976931348623157e+308 # default is the numerical maximum >>> lyr.maxzoom = 1.0/1000000 >>> lyr.maxzoom 9.9999999999999995e-07
|
minzoomGet/Set the minimum zoom lever of the layer. Usage: >>> from mapnik import Layer >>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs') >>> lyr.minzoom # default is 0 0.0 >>> lyr.minzoom = 1.0/1000000 >>> lyr.minzoom 9.9999999999999995e-07
|
nameGet/Set the name of the layer. Usage: >>> from mapnik import Layer >>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs') >>> lyr.name 'My Layer' >>> lyr.name = 'New Name' >>> lyr.name 'New Name'
|
queryableGet/Set whether this layer is queryable. Usage: >>> from mapnik import layer >>> lyr = layer('My layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs') >>> lyr.queryable False # Not queryable by default >>> lyr.queryable = True >>> lyr.queryable True
|
srsGet/Set the SRS of the layer. Usage: >>> from mapnik import layer >>> lyr = layer('My layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs') >>> lyr.srs '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs' # 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'
|
styles
The styles list attached to this layer.
Usage:
>>> from mapnik import layer
>>> lyr = layer('My layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')
>>> 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'
|
titleGet/Set the title of the layer. Usage: >>> from mapnik import layer >>> lyr = layer('My layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs') >>> lyr.title '' >>> lyr.title = 'My first layer' >>> lyr.title 'My first layer'
|
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Tue Apr 24 13:21:24 2012 | http://epydoc.sourceforge.net |