use of com.baremaps.osm.domain.Header in project baremaps by baremaps.
the class PostgresHeaderRepository method getValue.
private Header getValue(ResultSet resultSet) throws SQLException {
long replicationSequenceNumber = resultSet.getLong(1);
LocalDateTime replicationTimestamp = resultSet.getObject(2, LocalDateTime.class);
String replicationUrl = resultSet.getString(3);
String source = resultSet.getString(4);
String writingProgram = resultSet.getString(5);
return new Header(replicationSequenceNumber, replicationTimestamp, replicationUrl, source, writingProgram);
}
use of com.baremaps.osm.domain.Header in project baremaps by baremaps.
the class HeaderBlockReader method read.
/**
* Returns the {@code HeaderBlock}.
*
* @return the header block
*/
public HeaderBlock read() {
LocalDateTime timestamp = LocalDateTime.ofEpochSecond(headerBlock.getOsmosisReplicationTimestamp(), 0, ZoneOffset.UTC);
Long replicationSequenceNumber = headerBlock.getOsmosisReplicationSequenceNumber();
String replicationBaseUrl = headerBlock.getOsmosisReplicationBaseUrl();
String source = headerBlock.getSource();
String writingProgram = headerBlock.getWritingprogram();
Header header = new Header(replicationSequenceNumber, timestamp, replicationBaseUrl, source, writingProgram);
HeaderBBox headerBBox = headerBlock.getBbox();
double minLon = headerBBox.getLeft() * .000000001;
double maxLon = headerBBox.getRight() * .000000001;
double minLat = headerBBox.getBottom() * .000000001;
double maxLat = headerBBox.getTop() * .000000001;
Bound bound = new Bound(maxLat, maxLon, minLat, minLon);
return new HeaderBlock(blob, header, bound);
}
use of com.baremaps.osm.domain.Header in project baremaps by baremaps.
the class DiffService method call.
@Override
public List<Tile> call() throws Exception {
logger.info("Importing changes");
Header header = headerRepository.selectLatest();
String replicationUrl = header.getReplicationUrl();
Long sequenceNumber = header.getReplicationSequenceNumber() + 1;
URI changeUri = resolve(replicationUrl, sequenceNumber, "osc.gz");
Blob blob = blobStore.get(changeUri);
ProgressLogger progressLogger = new ProgressLogger(blob.getContentLength(), 5000);
ProjectionTransformer projectionTransformer = new ProjectionTransformer(srid, 4326);
try (InputStream changesInputStream = new GZIPInputStream(new InputStreamProgress(blob.getInputStream(), progressLogger))) {
return new OsmChangeParser().changes(changesInputStream).flatMap(this::geometriesForChange).map(projectionTransformer::transform).flatMap(this::tilesForGeometry).distinct().collect(Collectors.toList());
}
}
Aggregations