From d3b375713b269848f3bc1f26a3a9383912aeaecd Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Tue, 10 Jul 2012 14:51:13 -0700 Subject: [PATCH] properly populate the context --- plugins/input/templates/helloworld/hello_featureset.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/input/templates/helloworld/hello_featureset.cpp b/plugins/input/templates/helloworld/hello_featureset.cpp index eb3f19a10..b24d4d37e 100644 --- a/plugins/input/templates/helloworld/hello_featureset.cpp +++ b/plugins/input/templates/helloworld/hello_featureset.cpp @@ -16,6 +16,12 @@ mapnik::feature_ptr hello_featureset::next() { if (feature_id_ == 1) { + // let us pretend it just has one column/attribute name + std::string attribute("key"); + + // the featureset context needs to know the field schema + ctx_->push(attribute); + // create a new feature mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx_,feature_id_)); @@ -24,7 +30,7 @@ mapnik::feature_ptr hello_featureset::next() // create an attribute pair of key:value UnicodeString ustr = tr_->transcode("hello world!"); - feature->put("key",ustr); + feature->put(attribute,ustr); // we need a geometry to display so just for fun here // we take the center of the bbox that was used to query