diff --git a/bindings/python/mapnik/__init__.py b/bindings/python/mapnik/__init__.py index 7e143b569..c304c6825 100644 --- a/bindings/python/mapnik/__init__.py +++ b/bindings/python/mapnik/__init__.py @@ -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) diff --git a/bindings/python/mapnik/ogcserver/common.py b/bindings/python/mapnik/ogcserver/common.py index 64548ecbb..5330333bd 100644 --- a/bindings/python/mapnik/ogcserver/common.py +++ b/bindings/python/mapnik/ogcserver/common.py @@ -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()) \ No newline at end of file + return Response(params['format'], fh.read()) diff --git a/bindings/python/mapnik_datasource.cpp b/bindings/python/mapnik_datasource.cpp index f60fcd698..bb20e4188 100644 --- a/bindings/python/mapnik_datasource.cpp +++ b/bindings/python/mapnik_datasource.cpp @@ -20,11 +20,15 @@ * *****************************************************************************/ //$Id$ - +// stl +#include +// boost #include +// mapnik #include #include #include +#include namespace { @@ -47,6 +51,20 @@ namespace return mapnik::datasource_cache::create(params); } + + std::string describe(boost::shared_ptr 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); }