Second example showing how to get polygons from a database using SOCI and put them into GGL, using WKT.
#include <soci.h>
#include <soci-postgresql.h>
#include <boost/algorithm/string.hpp>
#include <boost/optional.hpp>
#include <boost/timer.hpp>
#include <boost/random.hpp>
#include <boost/tuple/tuple.hpp>
#include <iostream>
#include <istream>
#include <ostream>
#include <sstream>
#include <string>
#include <exception>
#include <boost/geometry/geometry.hpp>
struct city
{
    std::string name;
};
namespace soci
{
    template <>
    struct type_conversion<city>
    {
        typedef soci::values base_type;
        static void from_base(const base_type& v, soci::indicator ind, city& value)
        {
            try
            {
                value.name = v.get<std::string>("name");
            }
            catch(const std::exception& e)
            {
                std::cout << e.what() << std::endl;
            }
        }
        static void to_base(const city& value, base_type& v, soci::indicator& ind)
        {
            v.set("name", value.name);
            std::ostringstream out;
            v.set("wkt", out.str());
            ind = i_ok;
        }
    };
}
int main()
{
    try
    {
        soci::session sql(soci::postgresql, "dbname=ggl user=ggl password=ggl");
        typedef std::vector<city> V;
        soci::rowset<city> rows = sql.prepare << "select name,astext(location) as wkt from cities";
        V vec;
        for (V::const_iterator it = vec.begin(); it != vec.end(); ++it)
        {
            static const double sqrkm = 1000.0 * 1000.0;
            std::cout << it->name
                << "    " << boost::geometry::dsv(it->location)
                
                <<  std::endl;
        }
    }
    catch (std::exception const &e)
    {
        std::cerr << "Error: " << e.what() << '\n';
    }
    return 0;
}