use of de.topobyte.osm4j.core.model.impl.Relation in project osm4j-pbf by topobyte.
the class PrimParser method convert.
public OsmRelation convert(Osmformat.Relation r) {
long id = r.getId();
long lastMid = 0;
List<OsmTag> tags = new ArrayList<>();
for (int j = 0; j < r.getKeysCount(); j++) {
tags.add(new Tag(strings[r.getKeys(j)], strings[r.getVals(j)]));
}
List<RelationMember> members = new ArrayList<>();
for (int j = 0; j < r.getMemidsCount(); j++) {
long mid = lastMid + r.getMemids(j);
lastMid = mid;
String role = strings[r.getRolesSid(j)];
Osmformat.Relation.MemberType type = r.getTypes(j);
EntityType t = getType(type);
RelationMember member = new RelationMember(mid, t, role);
members.add(member);
}
OsmMetadata metadata = null;
if (fetchMetadata && r.hasInfo()) {
Osmformat.Info info = r.getInfo();
metadata = convertMetadata(info);
}
return new Relation(id, members, tags, metadata);
}
Aggregations