pull/1/head
Mike Barry 2021-04-12 06:59:34 -04:00
rodzic 890c3c150d
commit 7f6ccadc21
3 zmienionych plików z 12 dodań i 5 usunięć

Wyświetl plik

@ -10,6 +10,7 @@ import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;
import org.apache.commons.io.FileUtils;
import org.locationtech.jts.geom.Envelope;
import org.slf4j.Logger;
@ -87,10 +88,11 @@ public class OpenMapTilesMain {
.process("natural_earth", renderer, featureMap, config)
);
AtomicLong featureCount = new AtomicLong(0);
try (var osmReader = new OpenStreetMapReader(osmInputFile, nodeLocations, stats)) {
stats.time("osm_pass1", () -> osmReader.pass1(config));
stats
.time("osm_pass2", () -> osmReader.pass2(renderer, featureMap, Math.max(threads / 4, 1), threads - 1, config));
stats.time("osm_pass2",
() -> featureCount.set(osmReader.pass2(renderer, featureMap, Math.max(threads / 4, 1), threads - 1, config)));
}
LOGGER.info("Deleting node.db to make room for mbtiles");
@ -98,7 +100,7 @@ public class OpenMapTilesMain {
nodeDb.delete();
stats.time("sort", featureMap::sort);
stats.time("mbtiles", () -> MbtilesWriter.writeOutput(featureMap, output, config));
stats.time("mbtiles", () -> MbtilesWriter.writeOutput(featureCount.get(), featureMap, output, config));
stats.stopTimer("import");

Wyświetl plik

@ -3,5 +3,6 @@ package com.onthegomap.flatmap;
public class VectorTile {
public byte[] encode() {
return new byte[]{};
}
}

Wyświetl plik

@ -23,6 +23,7 @@ import com.onthegomap.flatmap.collections.MergeSortFeatureMap;
import com.onthegomap.flatmap.stats.Stats;
import com.onthegomap.flatmap.worker.Topology;
import java.io.Closeable;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicLong;
@ -104,7 +105,7 @@ public class OpenStreetMapReader implements Closeable {
topology.awaitAndLog(loggers, config.logIntervalSeconds());
}
public void pass2(FeatureRenderer renderer, MergeSortFeatureMap writer, int readerThreads, int processThreads,
public long pass2(FeatureRenderer renderer, MergeSortFeatureMap writer, int readerThreads, int processThreads,
FlatMapConfig config) {
Profile profile = config.profile();
AtomicLong nodesProcessed = new AtomicLong(0);
@ -168,6 +169,8 @@ public class OpenStreetMapReader implements Closeable {
.addTopologyStats(topology);
topology.awaitAndLog(logger, config.logIntervalSeconds());
return featuresWritten.get();
}
private long getBigObjectSizeBytes() {
@ -176,11 +179,12 @@ public class OpenStreetMapReader implements Closeable {
@Override
public void close() {
public void close() throws IOException {
multipolygonWayGeometries = null;
wayToRelations = null;
waysInMultipolygon = null;
relationInfo = null;
nodeDb.close();
}
public static class RelationInfo {