Updated PostGIS (markdown)
parent
3c308ffc12
commit
7263fd6667
1 changed files with 7 additions and 0 deletions
|
@ -126,6 +126,9 @@ Plugin datasource initialization example code can be found on [[PluginArchitectu
|
||||||
A PostGIS datasource may be created as follows:
|
A PostGIS datasource may be created as follows:
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
|
#include <mapnik/version.hpp>
|
||||||
|
#include <mapnik/datasource_cache.hpp>
|
||||||
|
|
||||||
{
|
{
|
||||||
parameters p;
|
parameters p;
|
||||||
p["type"]="postgis";
|
p["type"]="postgis";
|
||||||
|
@ -136,7 +139,11 @@ A PostGIS datasource may be created as follows:
|
||||||
p["password"]="";
|
p["password"]="";
|
||||||
|
|
||||||
Layer lyr("Roads");
|
Layer lyr("Roads");
|
||||||
|
#if MAPNIK_VERSION >= 200200
|
||||||
|
set_datasource(datasource_cache::instance().create(p));
|
||||||
|
#else
|
||||||
set_datasource(datasource_cache::instance()->create(p));
|
set_datasource(datasource_cache::instance()->create(p));
|
||||||
|
#endif
|
||||||
lyr.add_style("roads");
|
lyr.add_style("roads");
|
||||||
m.addLayer(lyr);
|
m.addLayer(lyr);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue