use of com.revolsys.record.io.format.openstreetmap.model.OsmDocument in project com.revolsys.open by revolsys.
the class OpenStreetMapApiLayer method getTile.
private synchronized OsmDocument getTile(final BoundingBox boundingBox) {
OsmDocument document = this.boundingBoxTileMap.get(boundingBox);
if (document == null) {
document = OsmDocument.newDocument(this.serverUrl, boundingBox);
this.boundingBoxTileMap.put(boundingBox, document);
}
return document;
}
use of com.revolsys.record.io.format.openstreetmap.model.OsmDocument in project com.revolsys.open by revolsys.
the class OsmOverpassLayer method getRecords.
@Override
public List<LayerRecord> getRecords(BoundingBox boundingBox) {
if (hasGeometryField()) {
boundingBox = convertBoundingBox(boundingBox);
if (Property.hasValue(boundingBox)) {
final Map<Identifier, LayerRecord> recordMap = new HashMap<>();
final List<BoundingBox> boundingBoxes = getTileBoundingBoxes(boundingBox);
for (final BoundingBox tileBoundingBox : boundingBoxes) {
final OsmDocument document = getTile(tileBoundingBox);
for (final OsmElement record : document.getRecords()) {
final Geometry geometry = record.getGeometry();
if (geometry != null && !geometry.isEmpty()) {
if (boundingBox.intersects(geometry.getBoundingBox())) {
final Identifier identifier = record.getIdentifier();
// final OsmProxyLayerRecord layerRecord = new
// OsmProxyLayerRecord(
// this, document, identifier);
// recordMap.put(identifier, layerRecord);
}
}
}
}
this.boundingBoxTileMap.keySet().retainAll(boundingBoxes);
return new ArrayList<>(recordMap.values());
}
}
return Collections.emptyList();
}
use of com.revolsys.record.io.format.openstreetmap.model.OsmDocument in project com.revolsys.open by revolsys.
the class OsmOverpassLayer method getTile.
private synchronized OsmDocument getTile(final BoundingBox boundingBox) {
OsmDocument document = this.boundingBoxTileMap.get(boundingBox);
if (document == null) {
document = OsmDocument.newDocument(this.serverUrl, boundingBox);
this.boundingBoxTileMap.put(boundingBox, document);
}
return document;
}
use of com.revolsys.record.io.format.openstreetmap.model.OsmDocument in project com.revolsys.open by revolsys.
the class OpenStreetMapApiLayer method getRecords.
@Override
public List<LayerRecord> getRecords(BoundingBox boundingBox) {
if (hasGeometryField()) {
boundingBox = convertBoundingBox(boundingBox);
if (Property.hasValue(boundingBox)) {
final Map<Identifier, LayerRecord> recordMap = new HashMap<>();
final List<BoundingBox> boundingBoxes = getTileBoundingBoxes(boundingBox);
for (final BoundingBox tileBoundingBox : boundingBoxes) {
final OsmDocument document = getTile(tileBoundingBox);
for (final OsmElement record : document.getRecords()) {
final Geometry geometry = record.getGeometry();
if (geometry != null && !geometry.isEmpty()) {
if (boundingBox.intersects(geometry.getBoundingBox())) {
final Identifier identifier = record.getIdentifier();
final OsmProxyLayerRecord layerRecord = new OsmProxyLayerRecord(this, document, identifier);
recordMap.put(identifier, layerRecord);
}
}
}
}
this.boundingBoxTileMap.keySet().retainAll(boundingBoxes);
return new ArrayList<>(recordMap.values());
}
}
return Collections.emptyList();
}
Aggregations