use of org.bboxdb.tools.converter.osm.filter.OSMTagEntityFilter in project bboxdb by jnidzwetzki.
the class OSMDataConverter method handleWay.
/**
* Handle a way
* @param entityContainer
*/
protected void handleWay(final Way way) {
try {
for (final OSMType osmType : filter.keySet()) {
final OSMTagEntityFilter entityFilter = filter.get(osmType);
if (entityFilter.match(way.getTags())) {
final Polygon geometricalStructure = new Polygon(way.getId());
for (final Tag tag : way.getTags()) {
geometricalStructure.addProperty(tag.getKey(), tag.getValue());
}
// Perform search async
for (final WayNode wayNode : way.getWayNodes()) {
final SerializableNode node = osmNodeStore.getNodeForId(wayNode.getNodeId());
geometricalStructure.addPoint(node.getLatitude(), node.getLongitude());
}
writePolygonToOutput(osmType, geometricalStructure);
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of org.bboxdb.tools.converter.osm.filter.OSMTagEntityFilter in project bboxdb by jnidzwetzki.
the class OSMDataConverter method handleNode.
/**
* Handle a node
* @param entityContainer
*/
protected void handleNode(final Node node) {
try {
for (final OSMType osmType : filter.keySet()) {
final OSMTagEntityFilter entityFilter = filter.get(osmType);
if (entityFilter.match(node.getTags())) {
final Polygon geometricalStructure = new Polygon(node.getId());
geometricalStructure.addPoint(node.getLatitude(), node.getLongitude());
for (final Tag tag : node.getTags()) {
geometricalStructure.addProperty(tag.getKey(), tag.getValue());
}
writePolygonToOutput(osmType, geometricalStructure);
}
}
osmNodeStore.storeNode(node);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Aggregations