Skip to content

Commit

Permalink
Merge pull request mapnik#2589 from CartoDB/fix-pgraster-datasource-n…
Browse files Browse the repository at this point in the history
…ull-scale

Ignore overviews with 0 scale in pgraster
  • Loading branch information
Dane Springmeyer committed Dec 4, 2014
2 parents ea61c57 + c4684e0 commit 82df66e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions plugins/input/pgraster/pgraster_datasource.cpp
Expand Up @@ -352,12 +352,22 @@ pgraster_datasource::pgraster_datasource(parameters const& params)
shared_ptr<ResultSet> rs = conn->executeQuery(s.str());
while (rs->next())
{
overviews_.resize(overviews_.size()+1);
pgraster_overview& ov = overviews_.back();
pgraster_overview ov = pgraster_overview();

ov.schema = rs->getValue("sch");
ov.table = rs->getValue("tab");
ov.column = rs->getValue("col");
ov.scale = atof(rs->getValue("scl"));

if(ov.scale == 0.0f)
{
MAPNIK_LOG_WARN(pgraster) << "pgraster_datasource: found invalid overview "
<< ov.schema << "." << ov.table << "." << ov.column << " with scale " << ov.scale;
continue;
}

overviews_.push_back(ov);

MAPNIK_LOG_DEBUG(pgraster) << "pgraster_datasource: found overview " << ov.schema << "." << ov.table << "." << ov.column << " with scale " << ov.scale;
}
rs->close();
Expand Down

0 comments on commit 82df66e

Please sign in to comment.