whitespace fixes
This commit is contained in:
parent
77c58e487d
commit
3fa794c6ac
2 changed files with 20 additions and 20 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
*
|
*
|
||||||
* This file is part of Mapnik (c++ mapping toolkit)
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Artem Pavlenko
|
* Copyright (C) 2011 Artem Pavlenko
|
||||||
|
@ -36,25 +36,25 @@
|
||||||
int main (int argc, char ** argv )
|
int main (int argc, char ** argv )
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( argc !=2)
|
if ( argc !=2)
|
||||||
{
|
{
|
||||||
std::cerr << "Usage: " << argv[0] << " <path-to-shapefile>\n";
|
std::cerr << "Usage: " << argv[0] << " <path-to-shapefile>\n";
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cerr << "Geometry to WKB converter\n";
|
std::cerr << "Geometry to WKB converter\n";
|
||||||
|
|
||||||
mapnik::datasource_cache::instance()->register_datasources("/opt/mapnik/lib/mapnik/input/");
|
mapnik::datasource_cache::instance()->register_datasources("/opt/mapnik/lib/mapnik/input/");
|
||||||
|
|
||||||
std::string filename(argv[1]);
|
std::string filename(argv[1]);
|
||||||
std::cerr << filename << std::endl;
|
std::cerr << filename << std::endl;
|
||||||
|
|
||||||
mapnik::parameters p;
|
mapnik::parameters p;
|
||||||
p["type"] = "shape";
|
p["type"] = "shape";
|
||||||
p["file"] = filename;
|
p["file"] = filename;
|
||||||
|
|
||||||
mapnik::datasource_ptr ds;
|
mapnik::datasource_ptr ds;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ds = mapnik::datasource_cache::instance()->create(p);
|
ds = mapnik::datasource_cache::instance()->create(p);
|
||||||
|
@ -64,21 +64,21 @@ int main (int argc, char ** argv )
|
||||||
std::cerr << "Can't create datasource!\n";
|
std::cerr << "Can't create datasource!\n";
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ds)
|
if (ds)
|
||||||
{
|
{
|
||||||
std::cerr << ds->envelope() << std::endl;
|
std::cerr << ds->envelope() << std::endl;
|
||||||
|
|
||||||
mapnik::query q(ds->envelope());
|
mapnik::query q(ds->envelope());
|
||||||
mapnik::layer_descriptor layer_desc = ds->get_descriptor();
|
mapnik::layer_descriptor layer_desc = ds->get_descriptor();
|
||||||
BOOST_FOREACH ( mapnik::attribute_descriptor const& attr_desc, layer_desc.get_descriptors())
|
BOOST_FOREACH ( mapnik::attribute_descriptor const& attr_desc, layer_desc.get_descriptors())
|
||||||
{
|
{
|
||||||
q.add_property_name(attr_desc.get_name());
|
q.add_property_name(attr_desc.get_name());
|
||||||
}
|
}
|
||||||
|
|
||||||
mapnik::featureset_ptr fs = ds->features(q);
|
mapnik::featureset_ptr fs = ds->features(q);
|
||||||
mapnik::feature_ptr f = fs->next();
|
mapnik::feature_ptr f = fs->next();
|
||||||
|
|
||||||
while(f)
|
while(f)
|
||||||
{
|
{
|
||||||
std::cerr << *f << std::endl;
|
std::cerr << *f << std::endl;
|
||||||
|
@ -96,13 +96,13 @@ int main (int argc, char ** argv )
|
||||||
std::cerr << mapnik::util::to_hex(wkb->buffer(),wkb->size()) << std::endl;
|
std::cerr << mapnik::util::to_hex(wkb->buffer(),wkb->size()) << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
f = fs->next();
|
f = fs->next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -141,14 +141,14 @@ void pgsql2sqlite(Connection conn,
|
||||||
int geometry_oid = -1;
|
int geometry_oid = -1;
|
||||||
|
|
||||||
std::string output_table_insert_sql = "insert into " + output_table_name + " values (?";
|
std::string output_table_insert_sql = "insert into " + output_table_name + " values (?";
|
||||||
|
|
||||||
context_ptr ctx = boost::make_shared<context_type>();
|
context_ptr ctx = boost::make_shared<context_type>();
|
||||||
|
|
||||||
for ( unsigned pos = 0; pos < num_fields ; ++pos)
|
for ( unsigned pos = 0; pos < num_fields ; ++pos)
|
||||||
{
|
{
|
||||||
const char* field_name = cursor->getFieldName(pos);
|
const char* field_name = cursor->getFieldName(pos);
|
||||||
ctx->push(field_name);
|
ctx->push(field_name);
|
||||||
|
|
||||||
if (pos > 0)
|
if (pos > 0)
|
||||||
{
|
{
|
||||||
create_sql << ",";
|
create_sql << ",";
|
||||||
|
@ -221,7 +221,7 @@ void pgsql2sqlite(Connection conn,
|
||||||
sqlite::record_type output_rec;
|
sqlite::record_type output_rec;
|
||||||
output_rec.push_back(sqlite::value_type(pkid));
|
output_rec.push_back(sqlite::value_type(pkid));
|
||||||
bool empty_geom = true;
|
bool empty_geom = true;
|
||||||
const char * buf = 0;
|
const char * buf = 0;
|
||||||
for (unsigned pos=0 ; pos < num_fields; ++pos)
|
for (unsigned pos=0 ; pos < num_fields; ++pos)
|
||||||
{
|
{
|
||||||
if (! cursor->isNull(pos))
|
if (! cursor->isNull(pos))
|
||||||
|
|
Loading…
Reference in a new issue