use of com.baremaps.osm.postgres.PostgresCoordinateMap in project baremaps by baremaps.
the class Diff method call.
@Override
public Integer call() throws Exception {
BlobStore blobStore = options.blobStore();
DataSource datasource = PostgresUtils.datasource(database);
LongDataMap<Coordinate> coordinates = new PostgresCoordinateMap(datasource);
LongDataMap<List<Long>> references = new PostgresReferenceMap(datasource);
HeaderRepository headerRepository = new PostgresHeaderRepository(datasource);
Repository<Long, Node> nodeRepository = new PostgresNodeRepository(datasource);
Repository<Long, Way> wayRepository = new PostgresWayRepository(datasource);
Repository<Long, Relation> relationRepository = new PostgresRelationRepository(datasource);
logger.info("Saving diff");
Path tmpTiles = Files.createFile(Paths.get("diff.tmp"));
try (PrintWriter printWriter = new PrintWriter(Files.newBufferedWriter(tmpTiles))) {
new DiffService(blobStore, coordinates, references, headerRepository, nodeRepository, wayRepository, relationRepository, srid, zoom).call();
}
blobStore.put(this.tiles, Blob.builder().withContentLength(Files.size(tmpTiles)).withInputStream(Files.newInputStream(tmpTiles)).build());
Files.deleteIfExists(tmpTiles);
logger.info("Done");
return 0;
}
use of com.baremaps.osm.postgres.PostgresCoordinateMap in project baremaps by baremaps.
the class Update method call.
@Override
public Integer call() throws Exception {
BlobStore blobStore = options.blobStore();
DataSource datasource = PostgresUtils.datasource(database);
LongDataMap<Coordinate> coordinates = new PostgresCoordinateMap(datasource);
LongDataMap<List<Long>> references = new PostgresReferenceMap(datasource);
HeaderRepository headerRepository = new PostgresHeaderRepository(datasource);
Repository<Long, Node> nodeRepository = new PostgresNodeRepository(datasource);
Repository<Long, Way> wayRepository = new PostgresWayRepository(datasource);
Repository<Long, Relation> relationRepository = new PostgresRelationRepository(datasource);
logger.info("Importing changes");
new UpdateService(blobStore, coordinates, references, headerRepository, nodeRepository, wayRepository, relationRepository, srid).call();
logger.info("Done");
return 0;
}
Aggregations