2006-03-31 10:32:02 +00:00
|
|
|
/*****************************************************************************
|
2011-11-14 03:54:32 +00:00
|
|
|
*
|
2006-03-31 10:32:02 +00:00
|
|
|
* This file is part of Mapnik (c++ mapping toolkit)
|
2006-01-31 23:09:52 +00:00
|
|
|
*
|
2011-10-12 00:52:15 +00:00
|
|
|
* Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
|
2006-01-31 23:09:52 +00:00
|
|
|
*
|
2006-03-31 10:32:02 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
2006-01-31 23:09:52 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2006-03-31 10:32:02 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2006-01-31 23:09:52 +00:00
|
|
|
*
|
2006-03-31 10:32:02 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
2006-01-31 23:09:52 +00:00
|
|
|
|
2014-08-12 17:44:11 +00:00
|
|
|
#include <mapnik/config.hpp>
|
2013-10-23 22:42:01 +00:00
|
|
|
|
2009-02-16 01:53:34 +00:00
|
|
|
// boost
|
2014-10-21 23:37:27 +00:00
|
|
|
#include "boost_std_shared_shim.hpp"
|
|
|
|
#pragma GCC diagnostic push
|
|
|
|
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
|
|
|
#pragma GCC diagnostic ignored "-Wunused-local-typedef"
|
|
|
|
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
|
|
|
|
2006-01-31 23:09:52 +00:00
|
|
|
#include <boost/python.hpp>
|
|
|
|
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
|
2014-10-21 23:37:27 +00:00
|
|
|
#pragma GCC diagnostic pop
|
2009-02-16 01:53:34 +00:00
|
|
|
|
|
|
|
// mapnik
|
2006-10-04 11:22:18 +00:00
|
|
|
#include <mapnik/layer.hpp>
|
2009-02-16 01:53:34 +00:00
|
|
|
#include <mapnik/datasource.hpp>
|
2009-05-20 00:18:46 +00:00
|
|
|
#include <mapnik/datasource_cache.hpp>
|
2006-01-31 23:09:52 +00:00
|
|
|
|
2009-12-16 20:02:06 +00:00
|
|
|
using mapnik::layer;
|
2006-01-31 23:09:52 +00:00
|
|
|
using mapnik::parameters;
|
2009-05-20 00:18:46 +00:00
|
|
|
using mapnik::datasource_cache;
|
2009-02-16 01:53:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
struct layer_pickle_suite : boost::python::pickle_suite
|
|
|
|
{
|
2010-06-02 11:03:30 +00:00
|
|
|
static boost::python::tuple
|
|
|
|
getinitargs(const layer& l)
|
|
|
|
{
|
|
|
|
return boost::python::make_tuple(l.name(),l.srs());
|
|
|
|
}
|
2009-02-16 01:53:34 +00:00
|
|
|
|
2010-06-02 11:03:30 +00:00
|
|
|
static boost::python::tuple
|
|
|
|
getstate(const layer& l)
|
|
|
|
{
|
2009-02-16 01:53:34 +00:00
|
|
|
boost::python::list s;
|
|
|
|
std::vector<std::string> const& style_names = l.styles();
|
|
|
|
for (unsigned i = 0; i < style_names.size(); ++i)
|
|
|
|
{
|
|
|
|
s.append(style_names[i]);
|
2011-11-14 03:54:32 +00:00
|
|
|
}
|
2012-03-12 15:39:59 +00:00
|
|
|
return boost::python::make_tuple(l.clear_label_cache(),l.min_zoom(),l.max_zoom(),l.queryable(),l.datasource()->params(),l.cache_features(),s);
|
2010-06-02 11:03:30 +00:00
|
|
|
}
|
2009-02-16 01:53:34 +00:00
|
|
|
|
2010-06-02 11:03:30 +00:00
|
|
|
static void
|
|
|
|
setstate (layer& l, boost::python::tuple state)
|
|
|
|
{
|
2009-02-16 01:53:34 +00:00
|
|
|
using namespace boost::python;
|
2011-03-01 17:09:29 +00:00
|
|
|
if (len(state) != 9)
|
2009-02-16 01:53:34 +00:00
|
|
|
{
|
2010-06-02 11:03:30 +00:00
|
|
|
PyErr_SetObject(PyExc_ValueError,
|
2011-03-01 17:09:29 +00:00
|
|
|
("expected 9-item tuple in call to __setstate__; got %s"
|
2010-06-02 11:03:30 +00:00
|
|
|
% state).ptr()
|
|
|
|
);
|
|
|
|
throw_error_already_set();
|
2009-02-16 01:53:34 +00:00
|
|
|
}
|
|
|
|
|
2011-12-13 16:34:10 +00:00
|
|
|
l.set_clear_label_cache(extract<bool>(state[0]));
|
2009-02-16 01:53:34 +00:00
|
|
|
|
2012-03-12 15:39:59 +00:00
|
|
|
l.set_min_zoom(extract<double>(state[1]));
|
2009-02-16 01:53:34 +00:00
|
|
|
|
2012-03-12 15:39:59 +00:00
|
|
|
l.set_max_zoom(extract<double>(state[2]));
|
2009-02-16 01:53:34 +00:00
|
|
|
|
2012-03-12 15:39:59 +00:00
|
|
|
l.set_queryable(extract<bool>(state[3]));
|
2009-02-16 01:53:34 +00:00
|
|
|
|
2011-12-13 16:34:10 +00:00
|
|
|
mapnik::parameters params = extract<parameters>(state[4]);
|
2012-09-07 15:23:03 +00:00
|
|
|
l.set_datasource(datasource_cache::instance().create(params));
|
2011-11-14 03:54:32 +00:00
|
|
|
|
2011-12-13 16:34:10 +00:00
|
|
|
boost::python::list s = extract<boost::python::list>(state[5]);
|
2009-02-16 01:53:34 +00:00
|
|
|
for (int i=0;i<len(s);++i)
|
|
|
|
{
|
2010-06-02 11:03:30 +00:00
|
|
|
l.add_style(extract<std::string>(s[i]));
|
2009-02-16 01:53:34 +00:00
|
|
|
}
|
2011-03-01 17:09:29 +00:00
|
|
|
|
2011-12-13 16:34:10 +00:00
|
|
|
l.set_cache_features(extract<bool>(state[6]));
|
2010-06-02 11:03:30 +00:00
|
|
|
}
|
2009-02-16 01:53:34 +00:00
|
|
|
};
|
2006-01-31 23:09:52 +00:00
|
|
|
|
2009-12-16 20:02:06 +00:00
|
|
|
std::vector<std::string> & (mapnik::layer::*_styles_)() = &mapnik::layer::styles;
|
2006-12-20 00:22:45 +00:00
|
|
|
|
2012-08-01 14:44:36 +00:00
|
|
|
void set_maximum_extent(mapnik::layer & l, boost::optional<mapnik::box2d<double> > const& box)
|
|
|
|
{
|
|
|
|
if (box)
|
|
|
|
{
|
|
|
|
l.set_maximum_extent(*box);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
l.reset_maximum_extent();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-29 09:50:37 +00:00
|
|
|
void set_buffer_size(mapnik::layer & l, boost::optional<int> const& buffer_size)
|
|
|
|
{
|
2012-11-09 10:57:10 +00:00
|
|
|
if (buffer_size)
|
|
|
|
{
|
|
|
|
l.set_buffer_size(*buffer_size);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
l.reset_buffer_size();
|
|
|
|
}
|
2012-10-29 09:50:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PyObject * get_buffer_size(mapnik::layer & l)
|
|
|
|
{
|
2013-03-13 01:42:42 +00:00
|
|
|
boost::optional<int> buffer_size = l.buffer_size();
|
2012-11-09 10:57:10 +00:00
|
|
|
if (buffer_size)
|
|
|
|
{
|
2013-03-13 01:42:42 +00:00
|
|
|
#if PY_VERSION_HEX >= 0x03000000
|
|
|
|
return PyLong_FromLong(*buffer_size);
|
|
|
|
#else
|
2012-11-09 10:57:10 +00:00
|
|
|
return PyInt_FromLong(*buffer_size);
|
2013-03-13 01:42:42 +00:00
|
|
|
#endif
|
2012-11-09 10:57:10 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Py_RETURN_NONE;
|
|
|
|
}
|
2012-10-29 09:50:37 +00:00
|
|
|
}
|
|
|
|
|
2006-01-31 23:09:52 +00:00
|
|
|
void export_layer()
|
|
|
|
{
|
|
|
|
using namespace boost::python;
|
2007-11-08 11:06:05 +00:00
|
|
|
class_<std::vector<std::string> >("Names")
|
2010-06-02 11:03:30 +00:00
|
|
|
.def(vector_indexing_suite<std::vector<std::string>,true >())
|
|
|
|
;
|
2011-11-14 03:54:32 +00:00
|
|
|
|
2009-12-16 20:02:06 +00:00
|
|
|
class_<layer>("Layer", "A Mapnik map layer.", init<std::string const&,optional<std::string const&> >(
|
2010-06-02 11:03:30 +00:00
|
|
|
"Create a Layer with a named string and, optionally, an srs string.\n"
|
|
|
|
"\n"
|
|
|
|
"The srs can be either a Proj.4 epsg code ('+init=epsg:<code>') or\n"
|
|
|
|
"of a Proj.4 literal ('+proj=<literal>').\n"
|
2010-08-10 18:18:31 +00:00
|
|
|
"If no srs is specified it will default to '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'\n"
|
2010-06-02 11:03:30 +00:00
|
|
|
"\n"
|
|
|
|
"Usage:\n"
|
|
|
|
">>> from mapnik import Layer\n"
|
2010-08-10 18:18:31 +00:00
|
|
|
">>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
|
2010-06-02 11:03:30 +00:00
|
|
|
">>> lyr\n"
|
|
|
|
"<mapnik._mapnik.Layer object at 0x6a270>\n"
|
|
|
|
))
|
2008-11-16 22:30:44 +00:00
|
|
|
|
2009-04-12 20:57:08 +00:00
|
|
|
.def_pickle(layer_pickle_suite())
|
2011-11-14 03:54:32 +00:00
|
|
|
|
|
|
|
.def("envelope",&layer::envelope,
|
2010-06-02 11:03:30 +00:00
|
|
|
"Return the geographic envelope/bounding box."
|
|
|
|
"\n"
|
|
|
|
"Determined based on the layer datasource.\n"
|
|
|
|
"\n"
|
|
|
|
"Usage:\n"
|
|
|
|
">>> from mapnik import Layer\n"
|
2010-08-10 18:18:31 +00:00
|
|
|
">>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
|
2010-06-02 11:03:30 +00:00
|
|
|
">>> lyr.envelope()\n"
|
|
|
|
"box2d(-1.0,-1.0,0.0,0.0) # default until a datasource is loaded\n"
|
|
|
|
)
|
2011-11-14 03:54:32 +00:00
|
|
|
|
2012-03-12 15:39:59 +00:00
|
|
|
.def("visible", &layer::visible,
|
2010-06-02 11:03:30 +00:00
|
|
|
"Return True if this layer's data is active and visible at a given scale.\n"
|
|
|
|
"\n"
|
|
|
|
"Otherwise returns False.\n"
|
|
|
|
"Accepts a scale value as an integer or float input.\n"
|
|
|
|
"Will return False if:\n"
|
|
|
|
"\tscale >= minzoom - 1e-6\n"
|
|
|
|
"\tor:\n"
|
|
|
|
"\tscale < maxzoom + 1e-6\n"
|
|
|
|
"\n"
|
|
|
|
"Usage:\n"
|
|
|
|
">>> from mapnik import Layer\n"
|
2010-08-10 18:18:31 +00:00
|
|
|
">>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
|
2010-06-02 11:03:30 +00:00
|
|
|
">>> lyr.visible(1.0/1000000)\n"
|
|
|
|
"True\n"
|
|
|
|
">>> lyr.active = False\n"
|
|
|
|
">>> lyr.visible(1.0/1000000)\n"
|
|
|
|
"False\n"
|
|
|
|
)
|
2011-11-14 03:54:32 +00:00
|
|
|
|
2008-11-16 22:30:44 +00:00
|
|
|
.add_property("active",
|
2012-03-12 15:39:59 +00:00
|
|
|
&layer::active,
|
|
|
|
&layer::set_active,
|
2012-08-21 00:16:47 +00:00
|
|
|
"Get/Set whether this layer is active and will be rendered (same as status property).\n"
|
2010-06-02 11:03:30 +00:00
|
|
|
"\n"
|
|
|
|
"Usage:\n"
|
|
|
|
">>> from mapnik import Layer\n"
|
2010-08-10 18:18:31 +00:00
|
|
|
">>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
|
2010-06-02 11:03:30 +00:00
|
|
|
">>> lyr.active\n"
|
|
|
|
"True # Active by default\n"
|
|
|
|
">>> lyr.active = False # set False to disable layer rendering\n"
|
|
|
|
">>> lyr.active\n"
|
|
|
|
"False\n"
|
|
|
|
)
|
2011-11-14 03:54:32 +00:00
|
|
|
|
2012-08-21 00:16:47 +00:00
|
|
|
.add_property("status",
|
|
|
|
&layer::active,
|
|
|
|
&layer::set_active,
|
|
|
|
"Get/Set whether this layer is active and will be rendered.\n"
|
|
|
|
"\n"
|
|
|
|
"Usage:\n"
|
|
|
|
">>> from mapnik import Layer\n"
|
|
|
|
">>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
|
|
|
|
">>> lyr.status\n"
|
|
|
|
"True # Active by default\n"
|
|
|
|
">>> lyr.status = False # set False to disable layer rendering\n"
|
|
|
|
">>> lyr.status\n"
|
|
|
|
"False\n"
|
|
|
|
)
|
|
|
|
|
2008-11-16 22:30:44 +00:00
|
|
|
.add_property("clear_label_cache",
|
2010-06-02 11:03:30 +00:00
|
|
|
&layer::clear_label_cache,
|
|
|
|
&layer::set_clear_label_cache,
|
2011-03-01 17:09:29 +00:00
|
|
|
"Get/Set whether to clear the label collision detector cache for this layer during rendering\n"
|
|
|
|
"\n"
|
|
|
|
"Usage:\n"
|
|
|
|
">>> lyr.clear_label_cache\n"
|
|
|
|
"False # False by default, meaning label positions from other layers will impact placement \n"
|
2011-11-14 03:54:32 +00:00
|
|
|
">>> lyr.clear_label_cache = True # set to True to clear the label collision detector cache\n"
|
2011-03-01 17:09:29 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
.add_property("cache_features",
|
|
|
|
&layer::cache_features,
|
|
|
|
&layer::set_cache_features,
|
|
|
|
"Get/Set whether features should be cached during rendering if used between multiple styles\n"
|
2010-06-02 11:03:30 +00:00
|
|
|
"\n"
|
|
|
|
"Usage:\n"
|
2011-03-01 17:09:29 +00:00
|
|
|
">>> lyr.cache_features\n"
|
|
|
|
"False # False by default\n"
|
2011-11-14 03:54:32 +00:00
|
|
|
">>> lyr.cache_features = True # set to True to enable feature caching\n"
|
2010-06-02 11:03:30 +00:00
|
|
|
)
|
2011-11-14 03:54:32 +00:00
|
|
|
|
2008-11-16 22:30:44 +00:00
|
|
|
.add_property("datasource",
|
2010-06-02 11:03:30 +00:00
|
|
|
&layer::datasource,
|
|
|
|
&layer::set_datasource,
|
|
|
|
"The datasource attached to this layer.\n"
|
|
|
|
"\n"
|
|
|
|
"Usage:\n"
|
|
|
|
">>> from mapnik import Layer, Datasource\n"
|
2010-08-10 18:18:31 +00:00
|
|
|
">>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
|
2010-06-02 11:03:30 +00:00
|
|
|
">>> lyr.datasource = Datasource(type='shape',file='world_borders')\n"
|
|
|
|
">>> lyr.datasource\n"
|
|
|
|
"<mapnik.Datasource object at 0x65470>\n"
|
|
|
|
)
|
2008-11-16 22:30:44 +00:00
|
|
|
|
2012-08-01 14:44:36 +00:00
|
|
|
.add_property("buffer_size",
|
2012-11-09 10:57:10 +00:00
|
|
|
&get_buffer_size,
|
2012-10-29 09:50:37 +00:00
|
|
|
&set_buffer_size,
|
2012-08-01 14:44:36 +00:00
|
|
|
"Get/Set the size of buffer around layer in pixels.\n"
|
|
|
|
"\n"
|
|
|
|
"Usage:\n"
|
2012-10-29 09:50:37 +00:00
|
|
|
">>> print(l.buffer_size)\n"
|
|
|
|
"None # None by default\n"
|
2012-08-01 14:44:36 +00:00
|
|
|
">>> l.buffer_size = 2\n"
|
|
|
|
">>> l.buffer_size\n"
|
|
|
|
"2\n"
|
|
|
|
)
|
2012-10-29 09:50:37 +00:00
|
|
|
|
2012-08-01 14:44:36 +00:00
|
|
|
.add_property("maximum_extent",make_function
|
|
|
|
(&layer::maximum_extent,return_value_policy<copy_const_reference>()),
|
|
|
|
&set_maximum_extent,
|
|
|
|
"The maximum extent of the map.\n"
|
|
|
|
"\n"
|
|
|
|
"Usage:\n"
|
|
|
|
">>> m.maximum_extent = Box2d(-180,-90,180,90)\n"
|
|
|
|
)
|
|
|
|
|
2006-10-03 08:44:04 +00:00
|
|
|
.add_property("maxzoom",
|
2012-03-12 15:39:59 +00:00
|
|
|
&layer::max_zoom,
|
|
|
|
&layer::set_max_zoom,
|
2010-06-02 11:03:30 +00:00
|
|
|
"Get/Set the maximum zoom lever of the layer.\n"
|
|
|
|
"\n"
|
|
|
|
"Usage:\n"
|
|
|
|
">>> from mapnik import Layer\n"
|
2010-08-10 18:18:31 +00:00
|
|
|
">>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
|
2010-06-02 11:03:30 +00:00
|
|
|
">>> lyr.maxzoom\n"
|
|
|
|
"1.7976931348623157e+308 # default is the numerical maximum\n"
|
|
|
|
">>> lyr.maxzoom = 1.0/1000000\n"
|
|
|
|
">>> lyr.maxzoom\n"
|
|
|
|
"9.9999999999999995e-07\n"
|
|
|
|
)
|
2011-11-14 03:54:32 +00:00
|
|
|
|
2008-11-16 22:30:44 +00:00
|
|
|
.add_property("minzoom",
|
2012-03-12 15:39:59 +00:00
|
|
|
&layer::min_zoom,
|
|
|
|
&layer::set_min_zoom,
|
2010-06-02 11:03:30 +00:00
|
|
|
"Get/Set the minimum zoom lever of the layer.\n"
|
|
|
|
"\n"
|
|
|
|
"Usage:\n"
|
|
|
|
">>> from mapnik import Layer\n"
|
2010-08-10 18:18:31 +00:00
|
|
|
">>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
|
2010-06-02 11:03:30 +00:00
|
|
|
">>> lyr.minzoom # default is 0\n"
|
|
|
|
"0.0\n"
|
|
|
|
">>> lyr.minzoom = 1.0/1000000\n"
|
|
|
|
">>> lyr.minzoom\n"
|
|
|
|
"9.9999999999999995e-07\n"
|
2011-11-14 03:54:32 +00:00
|
|
|
)
|
2006-10-03 08:44:04 +00:00
|
|
|
|
2011-11-14 03:54:32 +00:00
|
|
|
.add_property("name",
|
2010-06-02 11:03:30 +00:00
|
|
|
make_function(&layer::name, return_value_policy<copy_const_reference>()),
|
|
|
|
&layer::set_name,
|
|
|
|
"Get/Set the name of the layer.\n"
|
|
|
|
"\n"
|
|
|
|
"Usage:\n"
|
|
|
|
">>> from mapnik import Layer\n"
|
2010-08-10 18:18:31 +00:00
|
|
|
">>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
|
2010-06-02 11:03:30 +00:00
|
|
|
">>> lyr.name\n"
|
|
|
|
"'My Layer'\n"
|
|
|
|
">>> lyr.name = 'New Name'\n"
|
|
|
|
">>> lyr.name\n"
|
|
|
|
"'New Name'\n"
|
|
|
|
)
|
2006-12-17 12:08:11 +00:00
|
|
|
|
2007-01-09 11:23:19 +00:00
|
|
|
.add_property("queryable",
|
2012-03-12 15:39:59 +00:00
|
|
|
&layer::queryable,
|
|
|
|
&layer::set_queryable,
|
2010-06-02 11:03:30 +00:00
|
|
|
"Get/Set whether this layer is queryable.\n"
|
|
|
|
"\n"
|
|
|
|
"Usage:\n"
|
|
|
|
">>> from mapnik import layer\n"
|
2010-08-10 18:18:31 +00:00
|
|
|
">>> lyr = layer('My layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
|
2010-06-02 11:03:30 +00:00
|
|
|
">>> lyr.queryable\n"
|
|
|
|
"False # Not queryable by default\n"
|
|
|
|
">>> lyr.queryable = True\n"
|
|
|
|
">>> lyr.queryable\n"
|
|
|
|
"True\n"
|
|
|
|
)
|
2008-11-16 22:30:44 +00:00
|
|
|
|
2011-11-14 03:54:32 +00:00
|
|
|
.add_property("srs",
|
2010-06-02 11:03:30 +00:00
|
|
|
make_function(&layer::srs,return_value_policy<copy_const_reference>()),
|
|
|
|
&layer::set_srs,
|
|
|
|
"Get/Set the SRS of the layer.\n"
|
|
|
|
"\n"
|
|
|
|
"Usage:\n"
|
|
|
|
">>> from mapnik import layer\n"
|
2010-08-10 18:18:31 +00:00
|
|
|
">>> lyr = layer('My layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
|
2010-06-02 11:03:30 +00:00
|
|
|
">>> lyr.srs\n"
|
2010-08-10 18:18:31 +00:00
|
|
|
"'+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs' # The default srs if not initialized with custom srs\n"
|
2010-06-02 11:03:30 +00:00
|
|
|
">>> # set to google mercator with Proj.4 literal\n"
|
|
|
|
"... \n"
|
2013-01-28 18:48:13 +00:00
|
|
|
">>> lyr.srs = '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over'\n"
|
2010-06-02 11:03:30 +00:00
|
|
|
)
|
2008-11-16 22:30:44 +00:00
|
|
|
|
2012-08-20 23:26:41 +00:00
|
|
|
.add_property("group_by",
|
|
|
|
make_function(&layer::group_by,return_value_policy<copy_const_reference>()),
|
|
|
|
&layer::set_group_by,
|
|
|
|
"Get/Set the optional layer group name.\n"
|
|
|
|
"\n"
|
|
|
|
"More details at https://github.com/mapnik/mapnik/wiki/Grouped-rendering:\n"
|
|
|
|
)
|
|
|
|
|
2008-11-16 22:30:44 +00:00
|
|
|
.add_property("styles",
|
2010-06-02 11:03:30 +00:00
|
|
|
make_function(_styles_,return_value_policy<reference_existing_object>()),
|
|
|
|
"The styles list attached to this layer.\n"
|
|
|
|
"\n"
|
|
|
|
"Usage:\n"
|
|
|
|
">>> from mapnik import layer\n"
|
2010-08-10 18:18:31 +00:00
|
|
|
">>> lyr = layer('My layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
|
2010-06-02 11:03:30 +00:00
|
|
|
">>> lyr.styles\n"
|
|
|
|
"<mapnik._mapnik.Names object at 0x6d3e8>\n"
|
|
|
|
">>> len(lyr.styles)\n"
|
|
|
|
"0\n # no styles until you append them\n"
|
|
|
|
"lyr.styles.append('My Style') # mapnik uses named styles for flexibility\n"
|
|
|
|
">>> len(lyr.styles)\n"
|
|
|
|
"1\n"
|
|
|
|
">>> lyr.styles[0]\n"
|
|
|
|
"'My Style'\n"
|
|
|
|
)
|
2014-05-28 14:40:59 +00:00
|
|
|
// comparison
|
|
|
|
.def(self == self)
|
2006-01-31 23:09:52 +00:00
|
|
|
;
|
|
|
|
}
|