First example showing how to get spatial data from a database using SOCI and put them into GGL
#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>
int main()
{
    try
    {
        soci::session sql(soci::postgresql, "dbname=ggl user=ggl password=ggl");
        int count;
        sql << "select count(*) from cities", soci::into(count);
        std::cout << "# Capitals: " << count << std::endl;
        typedef std::vector<boost::tuple<double, double> > V;
        soci::rowset<boost::tuple<double, double> > rows
            = sql.prepare << "select x(location),y(location) from cities";
        V vec;
        for (V::const_iterator it = vec.begin(); it != vec.end(); ++it)
        {
            std::cout << it->get<0>() << " " << it->get<1>() << std::endl;
        }
        
        for (V::const_iterator it1 = vec.begin(); it1 != vec.end(); ++it1)
        {
            for (V::const_iterator it2 = vec.begin(); it2 != vec.end(); ++it2)
            {
            }
        }
    }
    catch (std::exception const &e)
    {
        std::cerr << "Error: " << e.what() << '\n';
    }
    return 0;
}