osm input: remove string hack and set feature_id to osm node id
This commit is contained in:
parent
b46c5ddeb1
commit
8c2604e69c
5 changed files with 10 additions and 18 deletions
|
@ -251,6 +251,11 @@ bounds osm_way::get_bounds()
|
|||
|
||||
bool osm_way::is_polygon()
|
||||
{
|
||||
if (keyvals.find("building") != keyvals.end())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
for (unsigned int count = 0; count < ptypes.ptypes.size(); ++count)
|
||||
{
|
||||
if (keyvals.find(ptypes.ptypes[count].first) != keyvals.end() &&
|
||||
|
|
|
@ -54,8 +54,9 @@ public:
|
|||
ptypes.push_back(std::pair<std::string, std::string>("natural", "heath"));
|
||||
ptypes.push_back(std::pair<std::string, std::string>("natural", "marsh"));
|
||||
ptypes.push_back(std::pair<std::string, std::string>("military", "danger_area"));
|
||||
ptypes.push_back(std::pair<std::string, std::string>("landuse","forest"));
|
||||
ptypes.push_back(std::pair<std::string, std::string>("landuse","industrial"));
|
||||
ptypes.push_back(std::pair<std::string, std::string>("landuse", "forest"));
|
||||
ptypes.push_back(std::pair<std::string, std::string>("landuse", "industrial"));
|
||||
ptypes.push_back(std::pair<std::string, std::string>("leisure", "park"));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -45,7 +45,6 @@ osm_featureset<filterT>::osm_featureset(const filterT& filter,
|
|||
: filter_(filter),
|
||||
query_ext_(),
|
||||
tr_(new transcoder(encoding)),
|
||||
feature_id_(1),
|
||||
dataset_ (dataset),
|
||||
attribute_names_ (attribute_names),
|
||||
ctx_(boost::make_shared<mapnik::context_type>())
|
||||
|
@ -62,8 +61,7 @@ feature_ptr osm_featureset<filterT>::next()
|
|||
if (!cur_item) return feature_ptr();
|
||||
if (dataset_->current_item_is_node())
|
||||
{
|
||||
feature = feature_factory::create(ctx_, feature_id_);
|
||||
++feature_id_;
|
||||
feature = feature_factory::create(ctx_, cur_item->id);
|
||||
double lat = static_cast<osm_node*>(cur_item)->lat;
|
||||
double lon = static_cast<osm_node*>(cur_item)->lon;
|
||||
geometry_type* point = new geometry_type(mapnik::Point);
|
||||
|
@ -83,8 +81,7 @@ feature_ptr osm_featureset<filterT>::next()
|
|||
}
|
||||
|
||||
if (!cur_item) return feature_ptr();
|
||||
feature = feature_factory::create(ctx_, feature_id_);
|
||||
++feature_id_;
|
||||
feature = feature_factory::create(ctx_, cur_item->id);
|
||||
geometry_type* geom;
|
||||
if (static_cast<osm_way*>(cur_item)->is_polygon())
|
||||
{
|
||||
|
|
|
@ -61,7 +61,6 @@ private:
|
|||
std::vector<int> attr_ids_;
|
||||
mutable box2d<double> feature_ext_;
|
||||
mutable int total_geom_size;
|
||||
mutable int feature_id_;
|
||||
osm_dataset *dataset_;
|
||||
std::set<std::string> attribute_names_;
|
||||
mapnik::context_ptr ctx_;
|
||||
|
|
|
@ -66,16 +66,6 @@ void osmparser::startElement(xmlTextReaderPtr reader, const xmlChar *name)
|
|||
assert(xid);
|
||||
way->id = atol((char*)xid);
|
||||
cur_item = way;
|
||||
// Prevent ways with no name being assigned a name of "0"
|
||||
cur_item->keyvals["name"] = "";
|
||||
|
||||
// HACK: allows comparison with "" in the XML file. Otherwise it
|
||||
// doesn't work. Only do for the most crucial tags for Freemap's
|
||||
// purposes. TODO investigate why this is
|
||||
cur_item->keyvals["width"] = "";
|
||||
cur_item->keyvals["horse"] = "";
|
||||
cur_item->keyvals["foot"] = "";
|
||||
cur_item->keyvals["bicycle"] = "";
|
||||
xmlFree(xid);
|
||||
}
|
||||
else if (xmlStrEqual(name,BAD_CAST "nd"))
|
||||
|
|
Loading…
Reference in a new issue