postgis: make sure to add key_field to feature context
This commit is contained in:
parent
da845cfaa3
commit
1c07372a13
1 changed files with 11 additions and 8 deletions
|
@ -502,15 +502,18 @@ featureset_ptr postgis_datasource::features(const query& q) const
|
|||
std::ostringstream s;
|
||||
s << "SELECT ST_AsBinary(\"" << geometryColumn_ << "\") AS geom";
|
||||
|
||||
mapnik::context_ptr ctx = boost::make_shared<mapnik::context_type>();
|
||||
|
||||
if (!key_field_.empty())
|
||||
{
|
||||
mapnik::sql_utils::quote_attr(s,key_field_);
|
||||
ctx->push(key_field_);
|
||||
}
|
||||
|
||||
std::set<std::string> const& props=q.property_names();
|
||||
std::set<std::string>::const_iterator pos=props.begin();
|
||||
std::set<std::string>::const_iterator end=props.end();
|
||||
|
||||
mapnik::context_ptr ctx = boost::make_shared<mapnik::context_type>();
|
||||
|
||||
for ( ;pos != end;++pos)
|
||||
{
|
||||
mapnik::sql_utils::quote_attr(s,*pos);
|
||||
|
@ -526,9 +529,6 @@ featureset_ptr postgis_datasource::features(const query& q) const
|
|||
}
|
||||
|
||||
boost::shared_ptr<IResultSet> rs = get_resultset(conn, s.str());
|
||||
unsigned num_attr = props.size();
|
||||
if (!key_field_.empty())
|
||||
++num_attr;
|
||||
return boost::make_shared<postgis_featureset>(rs, ctx, desc_.get_encoding(), !key_field_.empty());
|
||||
}
|
||||
else
|
||||
|
@ -574,11 +574,14 @@ featureset_ptr postgis_datasource::features_at_point(coord2d const& pt) const
|
|||
std::ostringstream s;
|
||||
s << "SELECT ST_AsBinary(\"" << geometryColumn_ << "\") AS geom";
|
||||
|
||||
if (!key_field_.empty())
|
||||
mapnik::sql_utils::quote_attr(s,key_field_);
|
||||
|
||||
mapnik::context_ptr ctx = boost::make_shared<mapnik::context_type>();
|
||||
|
||||
if (!key_field_.empty())
|
||||
{
|
||||
mapnik::sql_utils::quote_attr(s,key_field_);
|
||||
ctx->push(key_field_);
|
||||
}
|
||||
|
||||
std::vector<attribute_descriptor>::const_iterator itr = desc_.get_descriptors().begin();
|
||||
std::vector<attribute_descriptor>::const_iterator end = desc_.get_descriptors().end();
|
||||
|
||||
|
|
Loading…
Reference in a new issue