1. added installation instructions

2. support for more types in postgis datasource
This commit is contained in:
Artem Pavlenko 2005-06-15 20:50:02 +00:00
parent ec999cf543
commit ae86b29d7f
5 changed files with 53 additions and 14 deletions

28
INSTALL
View file

@ -1,4 +1,26 @@
Installation Instructions INSTALLATION INSTRUCTIONS
*************************
Prerequisites
First of all you will have to install 'scons'. See scons user guide on how to get started.
Mapnik is relying on a number of boost libraries (filesystem, python, regex, spirit etc). You can download the latest release (1.32.0) or grab a CVS snapshot from http://boost.org. You don't need to build anything, just unzip the source into read/write location on your disk.
The same requirements apply for AGG library (available from http://www.antigrain.com)
Other dependencies include:
1. libltdl (dynamic linking)
2. libz
3. libpng
4. libjpeg
5. freetype2
6. postgresql (+postgis)
Building
Once you satisfy all dependencies you can build mapnik by issuing the following command:
:/> scons DATASOURCES=postgis PREFIX=/where/to/install install
This should compile, link and install all relevant libraries/headers in PREFIX.
By default release versions are built, but you can specify "debug=yes" to build debug versions. At this time only GCC toolkit is supported and you'll have to modify SConstruct/SConscript files if you're planning to use something else.
TODO!

1
README
View file

@ -0,0 +1 @@
See INSTALL file for installation instructions

View file

@ -126,6 +126,9 @@ PostgisDatasource::PostgisDatasource(const Parameters& params)
case 23: // int4 case 23: // int4
desc_.add_descriptor(attribute_descriptor(fld_name,Integer,false,length)); desc_.add_descriptor(attribute_descriptor(fld_name,Integer,false,length));
break; break;
case 701: // float8
desc_.add_descriptor(attribute_descriptor(fld_name,Double,false,length));
case 1042: // bpchar
case 1043: // varchar case 1043: // varchar
desc_.add_descriptor(attribute_descriptor(fld_name,String)); desc_.add_descriptor(attribute_descriptor(fld_name,String));
break; break;

View file

@ -30,11 +30,7 @@ PostgisFeatureset::PostgisFeatureset(const ref_ptr<ResultSet>& rs,
: rs_(rs), : rs_(rs),
num_attrs_(num_attrs), num_attrs_(num_attrs),
totalGeomSize_(0), totalGeomSize_(0),
count_(0) count_(0) {}
{
}
Feature* PostgisFeatureset::next() Feature* PostgisFeatureset::next()
{ {
@ -42,7 +38,7 @@ Feature* PostgisFeatureset::next()
if (rs_->next()) if (rs_->next())
{ {
const char* buf = rs_->getValue(0); const char* buf = rs_->getValue(0);
int id = (buf[0]&255) << 24 | (buf[1]&255) << 16 | (buf[2] & 255) << 8 | buf[3] & 255; int id = int4net(buf);
int size=rs_->getFieldLength(1); int size=rs_->getFieldLength(1);
const char *data=rs_->getValue(1); const char *data=rs_->getValue(1);
@ -59,12 +55,30 @@ Feature* PostgisFeatureset::next()
const char* buf=rs_->getValue(start + pos); const char* buf=rs_->getValue(start + pos);
int field_size = rs_->getFieldLength(start + pos); int field_size = rs_->getFieldLength(start + pos);
int oid = rs_->getTypeOID(start + pos); int oid = rs_->getTypeOID(start + pos);
if (oid==23)
if (oid==23) //int4
{ {
int val = (buf[0]&255) << 24 | (buf[1]&255) << 16 | (buf[2] & 255) << 8 | buf[3] & 255; int val = int4net(buf);
feature->add_property(val); feature->add_property(val);
} }
else if (oid==1043) else if (oid==21) //int2
{
int val = int2net(buf);
feature->add_property(val);
}
else if (oid == 700) // float4
{
float val;
float4net(val,buf);
feature->add_property((double)val);
}
else if (oid == 701) // float8
{
double val;
float8net(val,buf);
feature->add_property(val);
}
else if (oid==1042 || oid==1043) //bpchar or varchar
{ {
feature->add_property(string(buf)); feature->add_property(string(buf));
} }

View file

@ -24,6 +24,7 @@
#include <map> #include <map>
#include <vector> #include <vector>
#include <cassert> #include <cassert>
#include "global.hpp"
#include "ptr.hpp" #include "ptr.hpp"
#include "factory.hpp" #include "factory.hpp"
#include "filter.hpp" #include "filter.hpp"
@ -65,12 +66,10 @@
#include "filter_factory.hpp" #include "filter_factory.hpp"
#include "text_symbolizer.hpp" #include "text_symbolizer.hpp"
#include "label_placement.hpp" #include "label_placement.hpp"
#include "feature_layer_desc.hpp" #include "feature_layer_desc.hpp"
namespace mapnik namespace mapnik
{ {
//typedef geometry_type geometry_type;
} }
#endif //MAPNIK_HPP #endif //MAPNIK_HPP