Search in sources :

Example 1 with LongAlignedDataDenseMap

use of com.baremaps.store.LongAlignedDataDenseMap in project baremaps by baremaps.

the class Import method call.

@Override
public Integer call() throws Exception {
    BlobStore blobStore = options.blobStore();
    DataSource datasource = PostgresUtils.datasource(database);
    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);
    Path directory = Files.createTempDirectory(Paths.get("."), "baremaps_");
    Path nodes = Files.createDirectories(directory.resolve("nodes"));
    Path referencesKeys = Files.createDirectories(directory.resolve("references_keys"));
    Path referencesValues = Files.createDirectories(directory.resolve("references_values"));
    LongDataMap<Coordinate> coordinates = new LongAlignedDataDenseMap<>(new LonLatDataType(), new OnDiskMemory(nodes));
    LongDataMap<List<Long>> references = new LongDataSortedMap<>(new AlignedDataList<>(new PairDataType<>(new LongDataType(), new LongDataType()), new OnDiskMemory(referencesKeys)), new DataStore<>(new LongListDataType(), new OnDiskMemory(referencesValues)));
    logger.info("Importing data");
    new ImportService(file, blobStore, coordinates, references, headerRepository, nodeRepository, wayRepository, relationRepository, srid).call();
    logger.info("Done");
    return 0;
}
Also used : PostgresHeaderRepository(com.baremaps.osm.postgres.PostgresHeaderRepository) HeaderRepository(com.baremaps.osm.repository.HeaderRepository) LongListDataType(com.baremaps.store.type.LongListDataType) Node(com.baremaps.osm.domain.Node) Way(com.baremaps.osm.domain.Way) Relation(com.baremaps.osm.domain.Relation) ImportService(com.baremaps.osm.repository.ImportService) LongDataSortedMap(com.baremaps.store.LongDataSortedMap) LongAlignedDataDenseMap(com.baremaps.store.LongAlignedDataDenseMap) AlignedDataList(com.baremaps.store.AlignedDataList) List(java.util.List) BlobStore(com.baremaps.blob.BlobStore) PairDataType(com.baremaps.store.type.PairDataType) Path(java.nio.file.Path) PostgresWayRepository(com.baremaps.osm.postgres.PostgresWayRepository) OnDiskMemory(com.baremaps.store.memory.OnDiskMemory) LonLatDataType(com.baremaps.store.type.LonLatDataType) DataSource(javax.sql.DataSource) Coordinate(org.locationtech.jts.geom.Coordinate) PostgresNodeRepository(com.baremaps.osm.postgres.PostgresNodeRepository) PostgresRelationRepository(com.baremaps.osm.postgres.PostgresRelationRepository) LongDataType(com.baremaps.store.type.LongDataType) PostgresHeaderRepository(com.baremaps.osm.postgres.PostgresHeaderRepository)

Aggregations

BlobStore (com.baremaps.blob.BlobStore)1 Node (com.baremaps.osm.domain.Node)1 Relation (com.baremaps.osm.domain.Relation)1 Way (com.baremaps.osm.domain.Way)1 PostgresHeaderRepository (com.baremaps.osm.postgres.PostgresHeaderRepository)1 PostgresNodeRepository (com.baremaps.osm.postgres.PostgresNodeRepository)1 PostgresRelationRepository (com.baremaps.osm.postgres.PostgresRelationRepository)1 PostgresWayRepository (com.baremaps.osm.postgres.PostgresWayRepository)1 HeaderRepository (com.baremaps.osm.repository.HeaderRepository)1 ImportService (com.baremaps.osm.repository.ImportService)1 AlignedDataList (com.baremaps.store.AlignedDataList)1 LongAlignedDataDenseMap (com.baremaps.store.LongAlignedDataDenseMap)1 LongDataSortedMap (com.baremaps.store.LongDataSortedMap)1 OnDiskMemory (com.baremaps.store.memory.OnDiskMemory)1 LonLatDataType (com.baremaps.store.type.LonLatDataType)1 LongDataType (com.baremaps.store.type.LongDataType)1 LongListDataType (com.baremaps.store.type.LongListDataType)1 PairDataType (com.baremaps.store.type.PairDataType)1 Path (java.nio.file.Path)1 List (java.util.List)1