use of org.openstreetmap.osmosis.core.domain.v0_6.Bound in project atlas by osmlab.
the class OsmPbfReader method process.
@Override
public void process(final EntityContainer entityContainer) {
final Entity rawEntity = entityContainer.getEntity();
if (shouldProcessEntity(this.loadingOption, rawEntity)) {
if (rawEntity instanceof Node && this.nodeIdentifiersToInclude.contains(rawEntity.getId())) {
processNode(rawEntity);
} else if (rawEntity instanceof Way && this.wayIdentifiersToInclude.contains(rawEntity.getId())) {
processWay(rawEntity);
} else if (this.loadingOption.isLoadOsmRelation() && rawEntity instanceof Relation) {
processRelation(rawEntity);
} else if (rawEntity instanceof Bound) {
logger.trace("Encountered PBF Bound {}, skipping over it.", rawEntity.getId());
}
} else {
recordNodeIdentifiersFromFilteredEntity(rawEntity);
logFilteredStatistics(rawEntity);
logger.trace("Filtering out OSM {} {} from Raw Atlas", rawEntity.getType(), rawEntity.getId());
}
}
use of org.openstreetmap.osmosis.core.domain.v0_6.Bound in project osmosis by openstreetmap.
the class OsmosisBinaryParser method parse.
@Override
public void parse(Osmformat.HeaderBlock block) {
for (String s : block.getRequiredFeaturesList()) {
if (s.equals("OsmSchema-V0.6")) {
// We can parse this.
continue;
}
if (s.equals("DenseNodes")) {
// We can parse this.
continue;
}
throw new OsmosisRuntimeException("File requires unknown feature: " + s);
}
if (block.hasBbox()) {
String source = OsmosisConstants.VERSION;
if (block.hasSource()) {
source = block.getSource();
}
double multiplier = .000000001;
double rightf = block.getBbox().getRight() * multiplier;
double leftf = block.getBbox().getLeft() * multiplier;
double topf = block.getBbox().getTop() * multiplier;
double bottomf = block.getBbox().getBottom() * multiplier;
Bound bounds = new Bound(rightf, leftf, topf, bottomf, source);
sink.process(new BoundContainer(bounds));
}
}
use of org.openstreetmap.osmosis.core.domain.v0_6.Bound in project osmosis by openstreetmap.
the class HeaderBoundReader method apply.
@Override
public BoundContainer apply(Osmformat.HeaderBlock header) {
Bound bound;
if (header.hasBbox()) {
Osmformat.HeaderBBox bbox = header.getBbox();
bound = new Bound(bbox.getRight() * COORDINATE_SCALING_FACTOR, bbox.getLeft() * COORDINATE_SCALING_FACTOR, bbox.getTop() * COORDINATE_SCALING_FACTOR, bbox.getBottom() * COORDINATE_SCALING_FACTOR, header.getSource());
} else {
bound = new Bound(header.getSource());
}
return new BoundContainer(bound);
}
use of org.openstreetmap.osmosis.core.domain.v0_6.Bound in project osmosis by openstreetmap.
the class PbfBlobDecoder method processNodes.
private void processNodes(List<Osmformat.Node> nodes, PbfFieldDecoder fieldDecoder) {
for (Osmformat.Node node : nodes) {
org.openstreetmap.osmosis.core.domain.v0_6.Node osmNode;
CommonEntityData entityData;
if (node.hasInfo()) {
entityData = buildCommonEntityData(node.getId(), node.getKeysList(), node.getValsList(), node.getInfo(), fieldDecoder);
} else {
entityData = buildCommonEntityData(node.getId(), node.getKeysList(), node.getValsList(), fieldDecoder);
}
osmNode = new org.openstreetmap.osmosis.core.domain.v0_6.Node(entityData, fieldDecoder.decodeLatitude(node.getLat()), fieldDecoder.decodeLongitude(node.getLon()));
// Add the bound object to the results.
decodedEntities.add(new NodeContainer(osmNode));
}
}
use of org.openstreetmap.osmosis.core.domain.v0_6.Bound in project osmosis by openstreetmap.
the class BoundSetterTest method removeExistingBoundTest.
/**
* Tests the bound removal.
*/
@Test
public void removeExistingBoundTest() {
SinkEntityInspector inspector = new SinkEntityInspector();
BoundSetter setter = new BoundSetter(null);
setter.setSink(inspector);
setter.process(new BoundContainer(new Bound("Test")));
setter.process(new NodeContainer(new Node(new CommonEntityData(1, 1, new Date(), OsmUser.NONE, 1), 1, 1)));
setter.complete();
setter.close();
EntityContainer ec = inspector.getProcessedEntities().iterator().next();
Assert.assertEquals(EntityType.Node, ec.getEntity().getType());
}
Aggregations