use of org.bboxdb.tools.converter.osm.util.Polygon 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);
}
}
use of org.bboxdb.tools.converter.osm.util.Polygon in project bboxdb by jnidzwetzki.
the class BenchmarkFileInsertPerformance method handleLine.
/**
* Handle a line from the input file
* @param line
* @throws BBoxDBException
*/
protected void handleLine(String line) {
try {
final Polygon polygon = Polygon.fromGeoJson(line);
final byte[] tupleBytes = polygon.toGeoJson().getBytes();
final Tuple tuple = new Tuple(Long.toString(polygon.getId()), polygon.getBoundingBox(), tupleBytes);
final EmptyResultFuture insertFuture = bboxdbClient.insertTuple(table, tuple);
// register pending future
pendingFutures.put(insertFuture);
insertedTuples.incrementAndGet();
} catch (BBoxDBException e) {
System.err.println("Got an exeption while reading file: " + e);
System.exit(-1);
}
}
Aggregations