properly populate the context
This commit is contained in:
parent
86f137fd25
commit
d3b375713b
1 changed files with 7 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue