1.added Describe() to Datasource, return list of attributes/types.

2.modified WMS to work with new Projection
This commit is contained in:
Artem Pavlenko 2006-10-16 21:34:09 +00:00
parent c195e1d24d
commit 2351cb38d0
3 changed files with 30 additions and 5 deletions

View file

@ -64,11 +64,17 @@ class _Projection(Projection,_injector):
return forward(pt,self)
def inverse(self,pt):
return inverse(pt,self)
class _Datasource(Datasource,_injector):
def describe(self):
return Describe(self)
def Datasource (**keywords):
return CreateDatasource(keywords)
#register datasources
from mapnik import DatasourceCache
DatasourceCache.instance().register_datasources('%s' % inputpluginspath)

View file

@ -255,12 +255,12 @@ class CRS:
def Inverse(self, x, y):
if not self.proj:
self.proj = Projection(['init=%s' % str(self).lower()])
self.proj = Projection('init=%s' % str(self).lower())
return self.proj.Inverse(x, y)
def Forward(self, x, y):
if not self.proj:
self.proj = Projection(['init=%s' % str(self).lower()])
self.proj = Projection('init=%s' % str(self).lower())
return self.proj.Forward(x, y)
class CRSFactory:
@ -379,4 +379,4 @@ class BaseExceptionHandler:
fh = StringIO()
im.save(fh, PIL_TYPE_MAPPING[params['format']])
fh.seek(0)
return Response(params['format'], fh.read())
return Response(params['format'], fh.read())

View file

@ -20,11 +20,15 @@
*
*****************************************************************************/
//$Id$
// stl
#include <sstream>
// boost
#include <boost/python.hpp>
// mapnik
#include <mapnik/envelope.hpp>
#include <mapnik/datasource.hpp>
#include <mapnik/datasource_cache.hpp>
#include <mapnik/feature_layer_desc.hpp>
namespace
{
@ -47,6 +51,20 @@ namespace
return mapnik::datasource_cache::create(params);
}
std::string describe(boost::shared_ptr<mapnik::datasource> const& ds)
{
std::stringstream ss;
if (ds)
{
ss << ds->get_descriptor() << "\n";
}
else
{
ss << "Null\n";
}
return ss.str();
}
}
void export_datasource()
@ -64,5 +82,6 @@ void export_datasource()
"These vary depending on the type of data source.")
;
def("Describe",&describe);
def("CreateDatasource",&create_datasource);
}