fix GeometryCollection and MultiLineString decoding + add support for standalone Feature and Geometry
This commit is contained in:
parent
0c814dbeb0
commit
e0a251c456
1 changed files with 20 additions and 20 deletions
|
@ -125,20 +125,25 @@ public:
|
||||||
read_feature_collection(feature_collection);
|
read_feature_collection(feature_collection);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 6:
|
case 5:
|
||||||
{
|
{
|
||||||
reader_.get_message();
|
// standalone Feature
|
||||||
MAPNIK_LOG_DEBUG(geobuf) << "standalone Geometry is not supported";
|
auto message = reader_.get_message();
|
||||||
|
read_feature(message);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 7:
|
case 6:
|
||||||
{
|
{
|
||||||
reader_.get_message();
|
// standalone Geometry
|
||||||
MAPNIK_LOG_DEBUG(geobuf) << "Topology is not supported";
|
auto feature = feature_factory::create(ctx_,1);
|
||||||
|
auto message = reader_.get_message();
|
||||||
|
feature->set_geometry(std::move(read_geometry(message)));
|
||||||
|
callback_(feature);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
MAPNIK_LOG_DEBUG(geobuf) << "Unsupported tag=" << reader_.tag();
|
MAPNIK_LOG_DEBUG(geobuf) << "Unsupported tag=" << reader_.tag();
|
||||||
|
reader_.skip();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -203,7 +208,7 @@ private:
|
||||||
auto key_index = *it++;
|
auto key_index = *it++;
|
||||||
auto value_index = *it;
|
auto value_index = *it;
|
||||||
assert(key_index < keys_.size());
|
assert(key_index < keys_.size());
|
||||||
assert(value_index< values_.size());
|
assert(value_index < values_.size());
|
||||||
std::string const& name = keys_[key_index];
|
std::string const& name = keys_[key_index];
|
||||||
util::apply_visitor(detail::value_visitor(feature, *tr_, name), values_[value_index]);
|
util::apply_visitor(detail::value_visitor(feature, *tr_, name), values_[value_index]);
|
||||||
}
|
}
|
||||||
|
@ -280,13 +285,11 @@ private:
|
||||||
read_value(message);
|
read_value(message);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 15:
|
default:
|
||||||
{
|
{
|
||||||
reader.skip();
|
reader.skip();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -336,18 +339,16 @@ private:
|
||||||
case MultiLineString:
|
case MultiLineString:
|
||||||
{
|
{
|
||||||
geom = read_multi_linestring(reader, lengths);
|
geom = read_multi_linestring(reader, lengths);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case MultiPolygon:
|
case MultiPolygon:
|
||||||
{
|
{
|
||||||
geom = read_multi_polygon(reader, lengths);
|
geom = read_multi_polygon(reader, lengths);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GeometryCollection:
|
|
||||||
{
|
|
||||||
throw std::runtime_error("GeometryCollection is not supported");
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
|
reader.skip();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -528,7 +529,8 @@ private:
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
lengths = std::move(read_lengths(reader));
|
auto val = read_lengths(reader);
|
||||||
|
if (!val.empty()) lengths = std::move(val);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3:
|
case 3:
|
||||||
|
@ -541,7 +543,8 @@ private:
|
||||||
if (geom.is<geometry::geometry_empty>())
|
if (geom.is<geometry::geometry_empty>())
|
||||||
geom = geometry::geometry_collection<double>();
|
geom = geometry::geometry_collection<double>();
|
||||||
auto & collection = geom.get<geometry::geometry_collection<double>>();
|
auto & collection = geom.get<geometry::geometry_collection<double>>();
|
||||||
collection.push_back(std::move(read_coords(reader, type, lengths)));
|
auto message = reader.get_message();
|
||||||
|
collection.push_back(std::move(read_geometry(message)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 13:
|
case 13:
|
||||||
|
@ -550,14 +553,11 @@ private:
|
||||||
read_value(value);
|
read_value(value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 14:
|
default:
|
||||||
case 15:
|
|
||||||
{
|
{
|
||||||
reader.skip();
|
reader.skip();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return geom;
|
return geom;
|
||||||
|
|
Loading…
Reference in a new issue