Merge branch 'master' into engine-mode

This commit is contained in:
afischerdev 2023-05-21 11:14:00 +02:00 committed by GitHub
commit fcab1a31fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
61 changed files with 389 additions and 507 deletions

View file

@ -287,9 +287,9 @@ public final class MicroCache2 extends MicroCache {
@Override
public int encodeMicroCache(byte[] buffer) {
HashMap<Long, Integer> idMap = new HashMap<Long, Integer>();
HashMap<Long, Integer> idMap = new HashMap<>();
for (int n = 0; n < size; n++) { // loop over nodes
idMap.put(Long.valueOf(expandId(faid[n])), Integer.valueOf(n));
idMap.put(expandId(faid[n]), n);
}
IntegerFifo3Pass linkCounts = new IntegerFifo3Pass(256);
@ -404,7 +404,7 @@ public final class MicroCache2 extends MicroCache {
}
long link64 = ((long) ilonlink) << 32 | ilatlink;
Integer idx = idMap.get(Long.valueOf(link64));
Integer idx = idMap.get(link64);
boolean isInternal = idx != null;
if (isReverse && isInternal) {

View file

@ -39,7 +39,7 @@ public final class StatCoderContext extends BitCoderContext {
public void assignBits(String name) {
long bitpos = getWritingBitPosition();
if (statsPerName == null) {
statsPerName = new TreeMap<String, long[]>();
statsPerName = new TreeMap<>();
}
long[] stats = statsPerName.get(name);
if (stats == null) {

View file

@ -58,7 +58,7 @@ public final class TagValueCoder {
TagValueSet dummy = new TagValueSet(nextTagValueSetId++);
identityMap.put(dummy, dummy);
}
PriorityQueue<TagValueSet> queue = new PriorityQueue<TagValueSet>(2 * identityMap.size(), new TagValueSet.FrequencyComparator());
PriorityQueue<TagValueSet> queue = new PriorityQueue<>(2 * identityMap.size(), new TagValueSet.FrequencyComparator());
queue.addAll(identityMap.values());
while (queue.size() > 1) {
TagValueSet node = new TagValueSet(nextTagValueSetId++);
@ -79,7 +79,7 @@ public final class TagValueCoder {
}
public TagValueCoder() {
identityMap = new HashMap<TagValueSet, TagValueSet>();
identityMap = new HashMap<>();
}
private Object decodeTree(BitCoderContext bc, DataBuffers buffers, TagValueValidator validator) {

View file

@ -24,7 +24,7 @@ public class OsmNogoPolygon extends OsmNodeNamed {
}
}
public final List<Point> points = new ArrayList<Point>();
public final List<Point> points = new ArrayList<>();
public final boolean isClosed;

View file

@ -53,14 +53,14 @@ public final class OsmTrack {
public Map<String, String> params;
public List<OsmNodeNamed> pois = new ArrayList<OsmNodeNamed>();
public List<OsmNodeNamed> pois = new ArrayList<>();
public static class OsmPathElementHolder {
public OsmPathElement node;
public OsmPathElementHolder nextHolder;
}
public List<OsmPathElement> nodes = new ArrayList<OsmPathElement>();
public List<OsmPathElement> nodes = new ArrayList<>();
private CompactLongMap<OsmPathElementHolder> nodesMap;
@ -82,7 +82,7 @@ public final class OsmTrack {
public void registerDetourForId(long id, OsmPathElement detour) {
if (detourMap == null) {
detourMap = new CompactLongMap<OsmPathElementHolder>();
detourMap = new CompactLongMap<>();
}
OsmPathElementHolder nh = new OsmPathElementHolder();
nh.node = detour;
@ -98,12 +98,12 @@ public final class OsmTrack {
}
public void copyDetours(OsmTrack source) {
detourMap = source.detourMap == null ? null : new FrozenLongMap<OsmPathElementHolder>(source.detourMap);
detourMap = source.detourMap == null ? null : new FrozenLongMap<>(source.detourMap);
}
public void addDetours(OsmTrack source) {
if (detourMap != null) {
CompactLongMap<OsmPathElementHolder> tmpDetourMap = new CompactLongMap<OsmPathElementHolder>();
CompactLongMap<OsmPathElementHolder> tmpDetourMap = new CompactLongMap<>();
List oldlist = ((FrozenLongMap) detourMap).getValueList();
long[] oldidlist = ((FrozenLongMap) detourMap).getKeyArray();
@ -124,7 +124,7 @@ public final class OsmTrack {
}
}
}
detourMap = new FrozenLongMap<OsmPathElementHolder>(tmpDetourMap);
detourMap = new FrozenLongMap<>(tmpDetourMap);
}
}
@ -132,7 +132,7 @@ public final class OsmTrack {
public void appendDetours(OsmTrack source) {
if (detourMap == null) {
detourMap = source.detourMap == null ? null : new CompactLongMap<OsmPathElementHolder>();
detourMap = source.detourMap == null ? null : new CompactLongMap<>();
}
if (source.detourMap != null) {
int pos = nodes.size() - source.nodes.size() + 1;
@ -160,7 +160,7 @@ public final class OsmTrack {
}
public void buildMap() {
nodesMap = new CompactLongMap<OsmPathElementHolder>();
nodesMap = new CompactLongMap<>();
for (OsmPathElement node : nodes) {
long id = node.getIdFromPos();
OsmPathElementHolder nh = new OsmPathElementHolder();
@ -175,11 +175,11 @@ public final class OsmTrack {
nodesMap.fastPut(id, nh);
}
}
nodesMap = new FrozenLongMap<OsmPathElementHolder>(nodesMap);
nodesMap = new FrozenLongMap<>(nodesMap);
}
private List<String> aggregateMessages() {
ArrayList<String> res = new ArrayList<String>();
ArrayList<String> res = new ArrayList<>();
MessageData current = null;
for (OsmPathElement n : nodes) {
if (n.message != null && n.message.wayKeyValues != null) {
@ -201,7 +201,7 @@ public final class OsmTrack {
}
private List<String> aggregateSpeedProfile() {
ArrayList<String> res = new ArrayList<String>();
ArrayList<String> res = new ArrayList<>();
int vmax = -1;
int vmaxe = -1;
int vmin = -1;
@ -1332,7 +1332,7 @@ public final class OsmTrack {
i = 0;
node = nodes.get(nodeNr);
List<VoiceHint> inputs = new ArrayList<VoiceHint>();
List<VoiceHint> inputs = new ArrayList<>();
while (node != null) {
if (node.origin != null) {
VoiceHint input = new VoiceHint();

View file

@ -274,7 +274,7 @@ public final class RoutingContext {
public void cleanNogoList(List<OsmNode> waypoints) {
nogopoints_all = nogopoints;
if (nogopoints == null) return;
List<OsmNodeNamed> nogos = new ArrayList<OsmNodeNamed>();
List<OsmNodeNamed> nogos = new ArrayList<>();
for (OsmNodeNamed nogo : nogopoints) {
boolean goodGuy = true;
for (OsmNode wp : waypoints) {
@ -386,7 +386,7 @@ public final class RoutingContext {
public void setWaypoint(OsmNodeNamed wp, OsmNodeNamed pendingEndpoint, boolean endpoint) {
keepnogopoints = nogopoints;
nogopoints = new ArrayList<OsmNodeNamed>();
nogopoints = new ArrayList<>();
nogopoints.add(wp);
if (keepnogopoints != null) nogopoints.addAll(keepnogopoints);
isEndpoint = endpoint;

View file

@ -31,7 +31,7 @@ public class RoutingEngine extends Thread {
public final static int BROUTER_ENGINEMODE_GETELEV = 2;
private NodesCache nodesCache;
private SortedHeap<OsmPath> openSet = new SortedHeap<OsmPath>();
private SortedHeap<OsmPath> openSet = new SortedHeap<>();
private boolean finished = false;
protected List<OsmNodeNamed> waypoints = null;
@ -179,7 +179,7 @@ public class RoutingEngine extends Thread {
OsmTrack[] refTracks = new OsmTrack[nsections]; // used ways for alternatives
OsmTrack[] lastTracks = new OsmTrack[nsections];
OsmTrack track = null;
ArrayList<String> messageList = new ArrayList<String>();
ArrayList<String> messageList = new ArrayList<>();
for (int i = 0; ; i++) {
track = findTrack(refTracks, lastTracks);
track.message = "track-length = " + track.distance + " filtered ascend = " + track.ascend
@ -433,7 +433,7 @@ public class RoutingEngine extends Thread {
try {
MatchedWaypoint seedPoint = new MatchedWaypoint();
seedPoint.waypoint = waypoints.get(0);
List<MatchedWaypoint> listOne = new ArrayList<MatchedWaypoint>();
List<MatchedWaypoint> listOne = new ArrayList<>();
listOne.add(seedPoint);
matchWaypointsToNodes(listOne);
@ -508,7 +508,7 @@ public class RoutingEngine extends Thread {
}
if (matchedWaypoints == null) { // could exist from the previous alternative level
matchedWaypoints = new ArrayList<MatchedWaypoint>();
matchedWaypoints = new ArrayList<>();
for (int i = 0; i < nUnmatched; i++) {
MatchedWaypoint mwp = new MatchedWaypoint();
mwp.waypoint = waypoints.get(i);
@ -1064,7 +1064,7 @@ public class RoutingEngine extends Thread {
private OsmTrack findTrack(String operationName, MatchedWaypoint startWp, MatchedWaypoint endWp, OsmTrack costCuttingTrack, OsmTrack refTrack, boolean fastPartialRecalc) {
try {
List<OsmNode> wpts2 = new ArrayList<OsmNode>();
List<OsmNode> wpts2 = new ArrayList<>();
if (startWp != null) wpts2.add(startWp.waypoint);
if (endWp != null) wpts2.add(endWp.waypoint);
routingContext.cleanNogoList(wpts2);
@ -1157,7 +1157,7 @@ public class RoutingEngine extends Thread {
addToOpenset(startPath1);
addToOpenset(startPath2);
}
ArrayList<OsmPath> openBorderList = new ArrayList<OsmPath>(4096);
ArrayList<OsmPath> openBorderList = new ArrayList<>(4096);
boolean memoryPanicMode = false;
boolean needNonPanicProcessing = false;

View file

@ -17,7 +17,7 @@ public class SuspectInfo {
public int triggers;
public static void addSuspect(Map<Long, SuspectInfo> map, long id, int prio, int trigger) {
Long iD = Long.valueOf(id);
Long iD = id;
SuspectInfo info = map.get(iD);
if (info == null) {
info = new SuspectInfo();

View file

@ -56,7 +56,7 @@ public class VoiceHint {
return;
}
if (badWays == null) {
badWays = new ArrayList<MessageData>();
badWays = new ArrayList<>();
}
badWays.add(badWay);
}

View file

@ -12,7 +12,7 @@ import java.util.List;
public class VoiceHintList {
private String transportMode;
int turnInstructionMode;
List<VoiceHint> list = new ArrayList<VoiceHint>();
List<VoiceHint> list = new ArrayList<>();
public void setTransportMode(boolean isCar, boolean isBike) {
transportMode = isCar ? "car" : (isBike ? "bike" : "foot");

View file

@ -55,7 +55,7 @@ public final class VoiceHintProcessor {
* @return voice hints, in forward order
*/
public List<VoiceHint> process(List<VoiceHint> inputs) {
List<VoiceHint> results = new ArrayList<VoiceHint>();
List<VoiceHint> results = new ArrayList<>();
double distance = 0.;
float roundAboutTurnAngle = 0.f; // sums up angles in roundabout
@ -202,7 +202,7 @@ public final class VoiceHintProcessor {
// go through the hint list again in reverse order (=travel direction)
// and filter out non-significant hints and hints too close to its predecessor
List<VoiceHint> results2 = new ArrayList<VoiceHint>();
List<VoiceHint> results2 = new ArrayList<>();
int i = results.size();
while (i > 0) {
VoiceHint hint = results.get(--i);
@ -241,7 +241,7 @@ public final class VoiceHintProcessor {
}
public List<VoiceHint> postProcess(List<VoiceHint> inputs, double catchingRange, double minRange) {
List<VoiceHint> results = new ArrayList<VoiceHint>();
List<VoiceHint> results = new ArrayList<>();
double distance = 0;
VoiceHint inputLast = null;
ArrayList<VoiceHint> tmpList = new ArrayList<>();

View file

@ -36,10 +36,10 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
public String _modelClass;
private Map<String, Integer> lookupNumbers = new HashMap<String, Integer>();
private List<BExpressionLookupValue[]> lookupValues = new ArrayList<BExpressionLookupValue[]>();
private List<String> lookupNames = new ArrayList<String>();
private List<int[]> lookupHistograms = new ArrayList<int[]>();
private Map<String, Integer> lookupNumbers = new HashMap<>();
private List<BExpressionLookupValue[]> lookupValues = new ArrayList<>();
private List<String> lookupNames = new ArrayList<>();
private List<int[]> lookupHistograms = new ArrayList<>();
private boolean[] lookupIdxUsed;
private boolean lookupDataFrozen = false;
@ -50,7 +50,7 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
private BitCoderContext ctxEndode = new BitCoderContext(abBuf);
private BitCoderContext ctxDecode = new BitCoderContext(new byte[0]);
private Map<String, Integer> variableNumbers = new HashMap<String, Integer>();
private Map<String, Integer> variableNumbers = new HashMap<>();
private float[] variableData;
@ -223,7 +223,7 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
}
public List<String> getKeyValueList(boolean inverseDirection, byte[] ab) {
ArrayList<String> res = new ArrayList<String>();
ArrayList<String> res = new ArrayList<>();
decode(lookupData, inverseDirection, ab);
for (int inum = 0; inum < lookupValues.size(); inum++) { // loop over lookup names
BExpressionLookupValue[] va = lookupValues.get(inum);
@ -429,7 +429,7 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
public void dumpStatistics() {
TreeMap<String, String> counts = new TreeMap<String, String>();
TreeMap<String, String> counts = new TreeMap<>();
// first count
for (String name : lookupNumbers.keySet()) {
int cnt = 0;
@ -528,7 +528,7 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
}
// unknown name, create
num = Integer.valueOf(lookupValues.size());
num = lookupValues.size();
lookupNumbers.put(name, num);
lookupNames.add(name);
lookupValues.add(new BExpressionLookupValue[]{new BExpressionLookupValue("")
@ -815,7 +815,7 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
private List<BExpression> _parseFile(File file) throws Exception {
_br = new BufferedReader(new FileReader(file));
_readerDone = false;
List<BExpression> result = new ArrayList<BExpression>();
List<BExpression> result = new ArrayList<>();
for (; ; ) {
BExpression exp = BExpression.parse(this, 0);
if (exp == null) break;
@ -855,7 +855,7 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
Integer num = variableNumbers.get(name);
if (num == null) {
if (create) {
num = Integer.valueOf(variableNumbers.size());
num = variableNumbers.size();
variableNumbers.put(name, num);
} else {
return -1;

View file

@ -26,7 +26,7 @@ final class BExpressionLookupValue {
}
public void addAlias(String alias) {
if (aliases == null) aliases = new ArrayList<String>();
if (aliases == null) aliases = new ArrayList<>();
aliases.add(alias);
}

View file

@ -24,7 +24,7 @@ public final class BExpressionMetaData {
public short lookupMinorVersion = -1;
public short minAppVersion = -1;
private Map<String, BExpressionContext> listeners = new HashMap<String, BExpressionContext>();
private Map<String, BExpressionContext> listeners = new HashMap<>();
public void registerListener(String context, BExpressionContext ctx) {
listeners.put(context, ctx);

View file

@ -2,11 +2,12 @@ plugins {
id 'java-library'
}
dependencies {
implementation project(':brouter-codec')
implementation project(':brouter-util')
implementation project(':brouter-expressions')
implementation group: 'org.openstreetmap.osmosis', name: 'osmosis-osm-binary', version: '0.48.3'
testImplementation('junit:junit:4.13.1')
}

View file

@ -5,14 +5,18 @@ import com.google.protobuf.InvalidProtocolBufferException;
import org.openstreetmap.osmosis.osmbinary.Fileformat;
import org.openstreetmap.osmosis.osmbinary.Osmformat;
import btools.util.LongList;
import java.io.IOException;
import java.util.*;
import java.util.logging.Level;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.zip.DataFormatException;
import java.util.zip.Inflater;
import btools.util.LongList;
/**
* Converts PBF block data into decoded entities ready to be passed into an Osmosis pipeline. This
* class is designed to be passed into a pool of worker threads to allow multi-threaded decoding.
@ -82,8 +86,8 @@ public class BPbfBlobDecoder {
// Build the list of active and unsupported features in the file.
List<String> supportedFeatures = Arrays.asList("OsmSchema-V0.6", "DenseNodes");
List<String> activeFeatures = new ArrayList<String>();
List<String> unsupportedFeatures = new ArrayList<String>();
List<String> activeFeatures = new ArrayList<>();
List<String> unsupportedFeatures = new ArrayList<>();
for (String feature : header.getRequiredFeaturesList()) {
if (supportedFeatures.contains(feature)) {
activeFeatures.add(feature);
@ -106,7 +110,7 @@ public class BPbfBlobDecoder {
Iterator<Integer> keyIterator = keys.iterator();
Iterator<Integer> valueIterator = values.iterator();
if (keyIterator.hasNext()) {
Map<String, String> tags = new HashMap<String, String>();
Map<String, String> tags = new HashMap<>();
while (keyIterator.hasNext()) {
String key = fieldDecoder.decodeString(keyIterator.next());
String value = fieldDecoder.decodeString(valueIterator.next());
@ -155,7 +159,7 @@ public class BPbfBlobDecoder {
int valueIndex = keysValuesIterator.next();
if (tags == null) {
tags = new HashMap<String, String>();
tags = new HashMap<>();
}
tags.put(fieldDecoder.decodeString(keyIndex), fieldDecoder.decodeString(valueIndex));

View file

@ -5,19 +5,27 @@ import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
public class ConvertLidarTile {
public static int NROWS;
public static int NCOLS;
private static int NROWS;
private static int NCOLS;
public static final short NODATA2 = -32767; // hgt-formats nodata
public static final short NODATA = Short.MIN_VALUE;
private static final String HGT_FILE_EXT = ".hgt";
private static final int HGT_BORDER_OVERLAP = 1;
private static final int HGT_3ASEC_ROWS = 1201; // 3 arc second resolution (90m)
private static final int HGT_3ASEC_FILE_SIZE = HGT_3ASEC_ROWS * HGT_3ASEC_ROWS * Short.BYTES;
private static final int HGT_1ASEC_ROWS = 3601; // 1 arc second resolution (30m)
static short[] imagePixels;
private static void readHgtZip(String filename, int rowOffset, int colOffset) throws Exception {
@ -25,8 +33,9 @@ public class ConvertLidarTile {
try {
for (; ; ) {
ZipEntry ze = zis.getNextEntry();
if (ze.getName().endsWith(".hgt")) {
readHgtFromStream(zis, rowOffset, colOffset);
if (ze == null) break;
if (ze.getName().toLowerCase().endsWith(HGT_FILE_EXT)) {
readHgtFromStream(zis, rowOffset, colOffset, HGT_3ASEC_ROWS);
return;
}
}
@ -35,20 +44,20 @@ public class ConvertLidarTile {
}
}
private static void readHgtFromStream(InputStream is, int rowOffset, int colOffset)
private static void readHgtFromStream(InputStream is, int rowOffset, int colOffset, int rowLength)
throws Exception {
DataInputStream dis = new DataInputStream(new BufferedInputStream(is));
for (int ir = 0; ir < 1201; ir++) {
for (int ir = 0; ir < rowLength; ir++) {
int row = rowOffset + ir;
for (int ic = 0; ic < 1201; ic++) {
for (int ic = 0; ic < rowLength; ic++) {
int col = colOffset + ic;
int i1 = dis.read(); // msb first!
int i0 = dis.read();
if (i0 == -1 || i1 == -1)
throw new RuntimeException("unexcepted end of file reading hgt entry!");
throw new RuntimeException("unexpected end of file reading hgt entry!");
short val = (short) ((i1 << 8) | i0);
@ -61,7 +70,6 @@ public class ConvertLidarTile {
}
}
private static void setPixel(int row, int col, short val) {
if (row >= 0 && row < NROWS && col >= 0 && col < NCOLS) {
imagePixels[row * NCOLS + col] = val;
@ -186,4 +194,57 @@ public class ConvertLidarTile {
doConvert(args[1], ilon_base, ilat_base, filename30);
}
public SrtmRaster getRaster(File f, double lon, double lat) throws Exception {
long fileSize;
InputStream inputStream;
if (f.getName().toLowerCase().endsWith(".zip")) {
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(new FileInputStream(f)));
for (; ; ) {
ZipEntry ze = zis.getNextEntry();
if (ze == null) {
throw new FileNotFoundException(f.getName() + " doesn't contain a " + HGT_FILE_EXT + " file.");
}
if (ze.getName().toLowerCase().endsWith(HGT_FILE_EXT)) {
fileSize = ze.getSize();
inputStream = zis;
break;
}
}
} else {
fileSize = f.length();
inputStream = new FileInputStream(f);
}
int rowLength;
if (fileSize > HGT_3ASEC_FILE_SIZE) {
rowLength = HGT_1ASEC_ROWS;
} else {
rowLength = HGT_3ASEC_ROWS;
}
// stay at 1 deg * 1 deg raster
NROWS = rowLength;
NCOLS = rowLength;
imagePixels = new short[NROWS * NCOLS];
// prefill as NODATA
Arrays.fill(imagePixels, NODATA);
readHgtFromStream(inputStream, 0, 0, rowLength);
inputStream.close();
SrtmRaster raster = new SrtmRaster();
raster.nrows = NROWS;
raster.ncols = NCOLS;
raster.halfcol = false; // assume full resolution
raster.noDataValue = NODATA;
raster.cellsize = 1. / (double) (rowLength - HGT_BORDER_OVERLAP);
raster.xllcorner = (int) (lon < 0 ? lon - 1 : lon); //onDegreeStart - raster.cellsize;
raster.yllcorner = (int) (lat < 0 ? lat - 1 : lat); //latDegreeStart - raster.cellsize;
raster.eval_array = imagePixels;
return raster;
}
}

View file

@ -25,7 +25,7 @@ public abstract class MapCreatorBase implements WayListener, NodeListener, Relat
protected Map<String, String> tags;
public void putTag(String key, String value) {
if (tags == null) tags = new HashMap<String, String>();
if (tags == null) tags = new HashMap<>();
tags.put(key, value);
}

View file

@ -105,7 +105,7 @@ public class OsmNodeP extends OsmLinkP {
}
public void checkDuplicateTargets() {
HashMap<OsmNodeP, OsmLinkP> targets = new HashMap<OsmNodeP, OsmLinkP>();
HashMap<OsmNodeP, OsmLinkP> targets = new HashMap<>();
for (OsmLinkP link0 = getFirstLink(); link0 != null; link0 = link0.getNext(this)) {
OsmLinkP link = link0;
@ -165,14 +165,14 @@ public class OsmNodeP extends OsmLinkP {
mc.writeVarBytes(getNodeDecsription());
// buffer internal reverse links
ArrayList<OsmNodeP> internalReverse = new ArrayList<OsmNodeP>();
ArrayList<OsmNodeP> internalReverse = new ArrayList<>();
for (OsmLinkP link0 = getFirstLink(); link0 != null; link0 = link0.getNext(this)) {
OsmLinkP link = link0;
OsmNodeP origin = this;
OsmNodeP target = null;
ArrayList<OsmNodeP> linkNodes = new ArrayList<OsmNodeP>();
ArrayList<OsmNodeP> linkNodes = new ArrayList<>();
linkNodes.add(this);
// first pass just to see if that link is consistent

View file

@ -1,10 +1,17 @@
package btools.mapcreator;
import org.openstreetmap.osmosis.osmbinary.Fileformat;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.zip.GZIPInputStream;
import java.util.HashMap;
import java.util.Map;
import btools.util.LongList;
/**
* Parser for OSM data
@ -22,179 +29,118 @@ public class OsmParser extends MapCreatorBase {
NodeListener nListener,
WayListener wListener,
RelationListener rListener) throws Exception {
this.nListener = nListener;
this.wListener = wListener;
this.rListener = rListener;
if (mapFile == null) {
_br = new BufferedReader(new InputStreamReader(System.in));
} else {
if (mapFile.getName().endsWith(".gz")) {
_br = new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream(mapFile))));
} else {
_br = new BufferedReader(new InputStreamReader(new FileInputStream(mapFile)));
System.out.println("*** PBF Parsing: " + mapFile);
// once more for testing
int rawBlobCount = 0;
long bytesRead = 0L;
Boolean avoidMapPolling = Boolean.getBoolean("avoidMapPolling");
if (!avoidMapPolling) {
// wait for file to become available
while (!mapFile.exists()) {
System.out.println("--- waiting for " + mapFile + " to become available");
Thread.sleep(10000);
}
}
long currentSize = mapFile.length();
long currentSizeTime = System.currentTimeMillis();
DataInputStream dis = new DataInputStream(new BufferedInputStream(new FileInputStream(mapFile)));
for (; ; ) {
String line = _br.readLine();
if (line == null) break;
if (checkNode(line)) continue;
if (checkWay(line)) continue;
if (checkRelation(line)) continue;
if (checkChangeset(line)) continue;
}
if (mapFile != null) {
_br.close();
}
}
private boolean checkNode(String line) throws Exception {
int idx0 = line.indexOf("<node id=\"");
if (idx0 < 0) return false;
idx0 += 10;
int idx1 = line.indexOf('"', idx0);
long nodeId = Long.parseLong(line.substring(idx0, idx1));
int idx2 = line.indexOf(" lat=\"");
if (idx2 < 0) return false;
idx2 += 6;
int idx3 = line.indexOf('"', idx2);
double lat = Double.parseDouble(line.substring(idx2, idx3));
int idx4 = line.indexOf(" lon=\"");
if (idx4 < 0) return false;
idx4 += 6;
int idx5 = line.indexOf('"', idx4);
double lon = Double.parseDouble(line.substring(idx4, idx5));
NodeData n = new NodeData(nodeId, lon, lat);
if (!line.endsWith("/>")) {
// read additional tags
for (; ; ) {
String l2 = _br.readLine();
if (l2 == null) return false;
int i2;
if ((i2 = l2.indexOf("<tag k=\"")) >= 0) { // property-tag
i2 += 8;
int ri2 = l2.indexOf('"', i2);
String key = l2.substring(i2, ri2);
i2 = l2.indexOf(" v=\"", ri2);
if (i2 >= 0) {
i2 += 4;
int ri3 = l2.indexOf('"', i2);
String value = l2.substring(i2, ri3);
n.putTag(key, value);
if (!avoidMapPolling) {
// continue reading if either more then a 100 MB unread, or the current-size is known for more than 2 Minutes
while (currentSize - bytesRead < 100000000L) {
long newSize = mapFile.length();
if (newSize != currentSize) {
currentSize = newSize;
currentSizeTime = System.currentTimeMillis();
} else if (System.currentTimeMillis() - currentSizeTime > 120000) {
break;
}
if (currentSize - bytesRead < 100000000L) {
System.out.println("--- waiting for more data, currentSize=" + currentSize + " bytesRead=" + bytesRead);
Thread.sleep(10000);
}
} else if (l2.indexOf("</node>") >= 0) { // end-tag
break;
}
}
}
nListener.nextNode(n);
return true;
}
private boolean checkWay(String line) throws Exception {
int idx0 = line.indexOf("<way id=\"");
if (idx0 < 0) return false;
idx0 += 9;
int idx1 = line.indexOf('"', idx0);
long id = Long.parseLong(line.substring(idx0, idx1));
WayData w = new WayData(id);
// read the nodes
for (; ; ) {
String l2 = _br.readLine();
if (l2 == null) return false;
int i2;
if ((i2 = l2.indexOf("<nd ref=\"")) >= 0) { // node reference
i2 += 9;
int ri2 = l2.indexOf('"', i2);
long nid = Long.parseLong(l2.substring(i2, ri2));
w.nodes.add(nid);
} else if ((i2 = l2.indexOf("<tag k=\"")) >= 0) { // property-tag
i2 += 8;
int ri2 = l2.indexOf('"', i2);
String key = l2.substring(i2, ri2);
i2 = l2.indexOf(" v=\"", ri2);
if (i2 >= 0) {
i2 += 4;
int ri3 = l2.indexOf('"', i2);
String value = l2.substring(i2, ri3);
w.putTag(key, value);
}
} else if (l2.indexOf("</way>") >= 0) { // end-tag
int headerLength;
try {
headerLength = dis.readInt();
bytesRead += 4;
} catch (EOFException e) {
break;
}
byte[] headerBuffer = new byte[headerLength];
dis.readFully(headerBuffer);
bytesRead += headerLength;
Fileformat.BlobHeader blobHeader = Fileformat.BlobHeader.parseFrom(headerBuffer);
byte[] blobData = new byte[blobHeader.getDatasize()];
dis.readFully(blobData);
bytesRead += blobData.length;
new BPbfBlobDecoder(blobHeader.getType(), blobData, this).process();
rawBlobCount++;
}
wListener.nextWay(w);
return true;
dis.close();
System.out.println("read raw blobs: " + rawBlobCount);
}
private boolean checkChangeset(String line) throws Exception {
int idx0 = line.indexOf("<changeset id=\"");
if (idx0 < 0) return false;
if (!line.endsWith("/>")) {
int loopcheck = 0;
for (; ; ) {
String l2 = _br.readLine();
if (l2.indexOf("</changeset>") >= 0 || ++loopcheck > 10000) break;
}
public void addNode(long nid, Map<String, String> tags, double lat, double lon) {
NodeData n = new NodeData(nid, lon, lat);
n.setTags((HashMap<String, String>) tags);
try {
nListener.nextNode(n);
} catch (Exception e) {
throw new RuntimeException("error writing node: " + e);
}
return true;
}
private boolean checkRelation(String line) throws Exception {
int idx0 = line.indexOf("<relation id=\"");
if (idx0 < 0) return false;
public void addWay(long wid, Map<String, String> tags, LongList nodes) {
WayData w = new WayData(wid, nodes);
w.setTags((HashMap<String, String>) tags);
idx0 += 14;
int idx1 = line.indexOf('"', idx0);
long rid = Long.parseLong(line.substring(idx0, idx1));
try {
wListener.nextWay(w);
} catch (Exception e) {
throw new RuntimeException("error writing way: " + e);
}
}
RelationData r = new RelationData(rid);
public void addRelation(long rid, Map<String, String> tags, LongList wayIds, LongList fromWid, LongList toWid, LongList viaNid) {
RelationData r = new RelationData(rid, wayIds);
r.setTags((HashMap<String, String>) tags);
// read the nodes
for (; ; ) {
String l2 = _br.readLine();
if (l2 == null) return false;
int i2;
if ((i2 = l2.indexOf("<member type=\"way\" ref=\"")) >= 0) { // node reference
i2 += 24;
int ri2 = l2.indexOf('"', i2);
long wid = Long.parseLong(l2.substring(i2, ri2));
r.ways.add(wid);
} else if ((i2 = l2.indexOf("<tag k=\"")) >= 0) { // property-tag
i2 += 8;
int ri2 = l2.indexOf('"', i2);
String key = l2.substring(i2, ri2);
i2 = l2.indexOf(" v=\"", ri2);
if (i2 >= 0) {
i2 += 4;
int ri3 = l2.indexOf('"', i2);
String value = l2.substring(i2, ri3);
r.putTag(key, value);
try {
rListener.nextRelation(r);
if (fromWid == null || toWid == null || viaNid == null || viaNid.size() != 1) {
// dummy-TR for each viaNid
for (int vi = 0; vi < (viaNid == null ? 0 : viaNid.size()); vi++) {
rListener.nextRestriction(r, 0L, 0L, viaNid.get(vi));
}
} else if (l2.indexOf("</relation>") >= 0) { // end-tag
break;
return;
}
for (int fi = 0; fi < fromWid.size(); fi++) {
for (int ti = 0; ti < toWid.size(); ti++) {
rListener.nextRestriction(r, fromWid.get(fi), toWid.get(ti), viaNid.get(0));
}
}
} catch (Exception e) {
throw new RuntimeException("error writing relation", e);
}
rListener.nextRelation(r);
return true;
}
}

View file

@ -52,7 +52,7 @@ public class OsmTrafficMap {
public OsmTrafficElement next;
}
private CompactLongMap<OsmTrafficElement> map = new CompactLongMap<OsmTrafficElement>();
private CompactLongMap<OsmTrafficElement> map = new CompactLongMap<>();
public void loadAll(File file, int minLon, int minLat, int maxLon, int maxLat, boolean includeMotorways) throws Exception {
load(file, minLon, minLat, maxLon, maxLat, includeMotorways);
@ -107,7 +107,7 @@ public class OsmTrafficMap {
is.close();
}
map = new FrozenLongMap<OsmTrafficElement>(map);
map = new FrozenLongMap<>(map);
System.out.println("read traffic-elements: " + trafficElements);
}

View file

@ -7,6 +7,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import btools.util.CompactLongSet;
@ -37,7 +38,24 @@ public class PosUnifier extends MapCreatorBase {
public static void main(String[] args) throws Exception {
System.out.println("*** PosUnifier: Unify position values and enhance elevation");
if (args.length != 5) {
if (args.length == 3) {
PosUnifier posu = new PosUnifier();
posu.srtmdir = (args[0]);
posu.srtmmap = new HashMap<>();
double lon = Double.parseDouble(args[1]);
double lat = Double.parseDouble(args[2]);
NodeData n = new NodeData(1, lon, lat);
SrtmRaster srtm = posu.hgtForNode(n.ilon, n.ilat);
short selev = Short.MIN_VALUE;
if (srtm == null) {
srtm = posu.srtmForNode(n.ilon, n.ilat);
}
if (srtm != null) selev = srtm.getElevation(n.ilon, n.ilat);
posu.resetSrtm();
System.out.println("-----> selv for " + lat + ", " + lon + " = " + selev + " = " + (selev / 4.));
return;
} else if (args.length != 5) {
System.out.println("usage: java PosUnifier <node-tiles-in> <node-tiles-out> <bordernids-in> <bordernodes-out> <srtm-data-dir>");
return;
}
@ -79,9 +97,13 @@ public class PosUnifier extends MapCreatorBase {
@Override
public void nextNode(NodeData n) throws Exception {
SrtmRaster srtm = srtmForNode(n.ilon, n.ilat);
n.selev = srtm == null ? Short.MIN_VALUE : srtm.getElevation(n.ilon, n.ilat);
n.selev = Short.MIN_VALUE;
SrtmRaster srtm = hgtForNode(n.ilon, n.ilat);
if (srtm == null) {
srtm = srtmForNode(n.ilon, n.ilat);
}
if (srtm != null) n.selev = srtm.getElevation(n.ilon, n.ilat);
findUniquePos(n);
n.writeTo(nodesOutStream);
@ -93,6 +115,7 @@ public class PosUnifier extends MapCreatorBase {
@Override
public void nodeFileEnd(File nodeFile) throws Exception {
nodesOutStream.close();
resetSrtm();
}
private boolean checkAdd(int lon, int lat) {
@ -157,7 +180,6 @@ public class PosUnifier extends MapCreatorBase {
lastSrtmRaster = srtmmap.get(filename);
if (lastSrtmRaster == null && !srtmmap.containsKey(filename)) {
File f = new File(new File(srtmdir), filename + ".bef");
System.out.println("checking: " + f + " ilon=" + ilon + " ilat=" + ilat);
if (f.exists()) {
System.out.println("*** reading: " + f);
try {
@ -172,10 +194,12 @@ public class PosUnifier extends MapCreatorBase {
}
f = new File(new File(srtmdir), filename + ".zip");
System.out.println("reading: " + f + " ilon=" + ilon + " ilat=" + ilat);
// System.out.println("reading: " + f + " ilon=" + ilon + " ilat=" + ilat);
if (f.exists()) {
try {
lastSrtmRaster = new SrtmData(f).getRaster();
srtmmap.put(filename, lastSrtmRaster);
return lastSrtmRaster;
} catch (Exception e) {
System.out.println("**** ERROR reading " + f + " ****");
}
@ -185,8 +209,49 @@ public class PosUnifier extends MapCreatorBase {
return lastSrtmRaster;
}
private SrtmRaster hgtForNode(int ilon, int ilat) throws Exception {
double lon = (ilon - 180000000) / 1000000.;
double lat = (ilat - 90000000) / 1000000.;
String filename = buildHgtFilename(lat, lon);
lastSrtmRaster = srtmmap.get(filename);
if (lastSrtmRaster == null) {
File f = new File(new File(srtmdir), filename + ".hgt");
if (f.exists()) {
lastSrtmRaster = new ConvertLidarTile().getRaster(f, lon, lat);
srtmmap.put(filename, lastSrtmRaster);
return lastSrtmRaster;
}
f = new File(new File(srtmdir), filename + ".zip");
if (f.exists()) {
lastSrtmRaster = new ConvertLidarTile().getRaster(f, lon, lat);
srtmmap.put(filename, lastSrtmRaster);
return lastSrtmRaster;
}
}
return lastSrtmRaster;
}
private String buildHgtFilename(double llat, double llon) {
int lat = (int) llat;
int lon = (int) llon;
String latPref = "N";
if (lat < 0) {
latPref = "S";
lat = -lat + 1;
}
String lonPref = "E";
if (lon < 0) {
lonPref = "W";
lon = -lon + 1;
}
return String.format(Locale.US, "%s%02d%s%03d", latPref, lat, lonPref, lon);
}
private void resetSrtm() {
srtmmap = new HashMap<String, SrtmRaster>();
srtmmap = new HashMap<>();
lastSrtmLonIdx = -1;
lastSrtmLatIdx = -1;
lastSrtmRaster = null;

View file

@ -53,7 +53,7 @@ public class RelationMerger extends MapCreatorBase {
// expctxStat = new BExpressionContext("way");
// *** read the relation file into sets for each processed tag
routesets = new HashMap<String, CompactLongSet>();
routesets = new HashMap<>();
routesetall = new CompactLongSet();
DataInputStream dis = createInStream(relationFileIn);
try {
@ -130,7 +130,7 @@ public class RelationMerger extends MapCreatorBase {
if (routeset.contains(data.wid)) {
int sepIdx = key.lastIndexOf('_');
String tagname = key.substring(0, sepIdx);
int val = Integer.valueOf(key.substring(sepIdx + 1));
int val = Integer.parseInt(key.substring(sepIdx + 1));
expctxReport.addSmallestLookupValue(tagname, val);
}
}

View file

@ -25,7 +25,7 @@ public class RelationStatistics extends MapCreatorBase {
}
public void process(File relationFileIn) throws Exception {
HashMap<String, long[]> relstats = new HashMap<String, long[]>();
HashMap<String, long[]> relstats = new HashMap<>();
DataInputStream dis = createInStream(relationFileIn);
try {

View file

@ -108,7 +108,7 @@ public class WayLinker extends MapCreatorBase implements Runnable {
private void reset() {
minLon = -1;
minLat = -1;
nodesMap = new CompactLongMap<OsmNodeP>();
nodesMap = new CompactLongMap<>();
borderSet = new CompactLongSet();
}
@ -231,7 +231,7 @@ public class WayLinker extends MapCreatorBase implements Runnable {
new NodeIterator(this, true).processFile(nodeFile);
// freeze the nodes-map
FrozenLongMap<OsmNodeP> nodesMapFrozen = new FrozenLongMap<OsmNodeP>(nodesMap);
FrozenLongMap<OsmNodeP> nodesMapFrozen = new FrozenLongMap<>(nodesMap);
nodesMap = nodesMapFrozen;
File restrictionFile = fileFromTemplate(wayfile, new File(nodeTilesIn.getParentFile(), "restrictions55"), "rt5");
@ -415,7 +415,7 @@ public class WayLinker extends MapCreatorBase implements Runnable {
int nLatSegs = (maxLat - minLat) / 1000000;
// sort the nodes into segments
LazyArrayOfLists<OsmNodeP> seglists = new LazyArrayOfLists<OsmNodeP>(nLonSegs * nLatSegs);
LazyArrayOfLists<OsmNodeP> seglists = new LazyArrayOfLists<>(nLonSegs * nLatSegs);
for (OsmNodeP n : nodesList) {
if (n == null || n.getFirstLink() == null || n.isTransferNode())
continue;
@ -450,7 +450,7 @@ public class WayLinker extends MapCreatorBase implements Runnable {
if (seglists.getSize(tileIndex) > 0) {
List<OsmNodeP> nlist = seglists.getList(tileIndex);
LazyArrayOfLists<OsmNodeP> subs = new LazyArrayOfLists<OsmNodeP>(ncaches);
LazyArrayOfLists<OsmNodeP> subs = new LazyArrayOfLists<>(ncaches);
byte[][] subByteArrays = new byte[ncaches][];
for (int ni = 0; ni < nlist.size(); ni++) {
OsmNodeP n = nlist.get(ni);
@ -473,14 +473,14 @@ public class WayLinker extends MapCreatorBase implements Runnable {
MicroCache mc = new MicroCache2(size, abBuf2, lonIdxDiv, latIdxDiv, divisor);
// sort via treemap
TreeMap<Integer, OsmNodeP> sortedList = new TreeMap<Integer, OsmNodeP>();
TreeMap<Integer, OsmNodeP> sortedList = new TreeMap<>();
for (OsmNodeP n : subList) {
long longId = n.getIdFromPos();
int shrinkid = mc.shrinkId(longId);
if (mc.expandId(shrinkid) != longId) {
throw new IllegalArgumentException("inconstistent shrinking: " + longId);
}
sortedList.put(Integer.valueOf(shrinkid), n);
sortedList.put(shrinkid, n);
}
for (OsmNodeP n : sortedList.values()) {

View file

@ -9,8 +9,10 @@ import java.net.URL;
public class MapcreatorTest {
@Test
public void mapcreatorTest() throws Exception {
URL mapurl = this.getClass().getResource("/dreieich.osm.gz");
Assert.assertNotNull("test-osm-map dreieich.osm not found", mapurl);
System.setProperty("avoidMapPolling", "true");
URL mapurl = this.getClass().getResource("/dreieich.pbf");
Assert.assertNotNull("test-osm-map dreieich.pbf not found", mapurl);
File mapFile = new File(mapurl.getFile());
File workingDir = mapFile.getParentFile();
File profileDir = new File(workingDir, "/../../../../misc/profiles2");

Binary file not shown.

View file

@ -95,7 +95,7 @@ public final class NodesCache {
fileRows = new OsmFile[180][];
}
} else {
fileCache = new HashMap<String, PhysicalFile>(4);
fileCache = new HashMap<>(4);
fileRows = new OsmFile[180][];
dataBuffers = new DataBuffers();
secondarySegmentsDir = StorageConfigHelper.getSecondarySegmentDir(segmentDir);

View file

@ -50,7 +50,7 @@ public class OsmNodePairSet {
private void addPair(long n1, long n2) {
if (map == null) {
map = new CompactLongMap<OsmNodePair>();
map = new CompactLongMap<>();
}
npairs++;

View file

@ -13,7 +13,7 @@ import java.util.Map;
import btools.util.ByteArrayUnifier;
public final class OsmNodesMap {
private Map<OsmNode, OsmNode> hmap = new HashMap<OsmNode, OsmNode>(4096);
private Map<OsmNode, OsmNode> hmap = new HashMap<>(4096);
private ByteArrayUnifier abUnifier = new ByteArrayUnifier(16384, false);
@ -176,7 +176,7 @@ public final class OsmNodesMap {
}
public void collectOutreachers() {
nodes2check = new ArrayList<OsmNode>(nodesCreated);
nodes2check = new ArrayList<>(nodesCreated);
nodesCreated = 0;
for (OsmNode n : hmap.values()) {
addActiveNode(nodes2check, n);

View file

@ -51,7 +51,7 @@ public final class WaypointMatcherImpl implements WaypointMatcher {
}
// sort result list
comparator = new Comparator<MatchedWaypoint>() {
comparator = new Comparator<>() {
@Override
public int compare(MatchedWaypoint mw1, MatchedWaypoint mw2) {
int cmpDist = Double.compare(mw1.radius, mw2.radius);

View file

@ -488,11 +488,11 @@ public class BInstallerActivity extends AppCompatActivity {
}
private void downloadDiffVersionTiles() {
downloadAll(new ArrayList<Integer>(), DownloadWorker.VALUE_SEGMENT_DIFFS);
downloadAll(new ArrayList<>(), DownloadWorker.VALUE_SEGMENT_DIFFS);
}
private void dropDiffVersionTiles() {
downloadAll(new ArrayList<Integer>(), DownloadWorker.VALUE_SEGMENT_DROPDIFFS);
downloadAll(new ArrayList<>(), DownloadWorker.VALUE_SEGMENT_DROPDIFFS);
}
private boolean isDownloadRunning(Class<?> serviceClass) {

View file

@ -211,8 +211,8 @@ public class BRouterService extends Service {
private void readNogos(BRouterWorker worker, String baseDir) throws Exception {
// add nogos from waypoint database
CoordinateReader cor = CoordinateReader.obtainValidReader(baseDir, true);
worker.nogoList = new ArrayList<OsmNodeNamed>(cor.nogopoints);
worker.nogoPolygonsList = new ArrayList<OsmNodeNamed>();
worker.nogoList = new ArrayList<>(cor.nogopoints);
worker.nogoPolygonsList = new ArrayList<>();
}
private boolean fileEqual(byte[] fileBytes, File file) throws Exception {

View file

@ -113,7 +113,7 @@ public class BRouterWorker {
String straight = params.getString("straight");
String[] sa = straight.split(",");
for (int i = 0; i < sa.length; i++) {
int v = Integer.valueOf(sa[i]);
int v = Integer.parseInt(sa[i]);
if (waypoints.size() > v) waypoints.get(v).direct = true;
}
} catch (NumberFormatException e) {
@ -132,7 +132,7 @@ public class BRouterWorker {
}
if (params.containsKey("extraParams")) { // add user params
if (rc.keyValues == null) rc.keyValues = new HashMap<String, String>();
if (rc.keyValues == null) rc.keyValues = new HashMap<>();
StringTokenizer tk = new StringTokenizer(extraParams, "?&");
while (tk.hasMoreTokens()) {
String t = tk.nextToken();
@ -224,7 +224,7 @@ public class BRouterWorker {
}
private List<OsmNodeNamed> readPositions(Bundle params) {
List<OsmNodeNamed> wplist = new ArrayList<OsmNodeNamed>();
List<OsmNodeNamed> wplist = new ArrayList<>();
double[] lats = params.getDoubleArray("lats");
double[] lons = params.getDoubleArray("lons");
@ -334,7 +334,7 @@ public class BRouterWorker {
String[] lonLatRadList = nogos.split("\\|");
List<OsmNodeNamed> nogoList = new ArrayList<OsmNodeNamed>();
List<OsmNodeNamed> nogoList = new ArrayList<>();
for (int i = 0; i < lonLatRadList.length; i++) {
String[] lonLatRad = lonLatRadList[i].split(",");
String nogoWeight = "NaN";
@ -363,7 +363,7 @@ public class BRouterWorker {
}
private List<OsmNodeNamed> readNogoPolygons(Bundle params) {
List<OsmNodeNamed> result = new ArrayList<OsmNodeNamed>();
List<OsmNodeNamed> result = new ArrayList<>();
parseNogoPolygons(params.getString("polylines"), result, false);
parseNogoPolygons(params.getString("polygons"), result, true);
return result.size() > 0 ? result : null;
@ -408,7 +408,7 @@ public class BRouterWorker {
String[] lonLatNameList = pois.split("\\|");
List<OsmNodeNamed> poisList = new ArrayList<OsmNodeNamed>();
List<OsmNodeNamed> poisList = new ArrayList<>();
for (int i = 0; i < lonLatNameList.length; i++) {
String[] lonLatName = lonLatNameList[i].split(",");

View file

@ -33,7 +33,7 @@ public class ConfigMigration {
}
br.close();
List<String> lines = new ArrayList<String>();
List<String> lines = new ArrayList<>();
br = new BufferedReader(new FileReader(dstFile));
for (; ; ) {
String line = br.readLine();
@ -76,7 +76,7 @@ public class ConfigMigration {
BufferedReader br = null;
BufferedWriter bw = null;
File configFile = new File(segmentDir, "storageconfig.txt");
List<String> lines = new ArrayList<String>();
List<String> lines = new ArrayList<>();
try {
br = new BufferedReader(new FileReader(configFile));
for (; ; ) {

View file

@ -19,7 +19,7 @@ public class ServiceModeConfig {
profile = tk.nextToken();
if (tk.hasMoreTokens()) params = tk.nextToken();
else params = "noparams";
nogoVetos = new TreeSet<String>();
nogoVetos = new TreeSet<>();
while (tk.hasMoreTokens()) {
nogoVetos.add(tk.nextToken());
}
@ -29,7 +29,7 @@ public class ServiceModeConfig {
this.mode = mode;
this.profile = profile;
this.params = params;
nogoVetos = new TreeSet<String>();
nogoVetos = new TreeSet<>();
}
public String toLine() {

View file

@ -8,8 +8,8 @@ import java.util.ArrayList;
import java.util.List;
public class Area {
private List<Polygon> poslist = new ArrayList<Polygon>();
private List<Polygon> neglist = new ArrayList<Polygon>();
private List<Polygon> poslist = new ArrayList<>();
private List<Polygon> neglist = new ArrayList<>();
public static void main(String[] args) throws IOException {
Area a = new Area(new File(args[0]));

View file

@ -63,7 +63,7 @@ public class BRouter {
maxRunningTime = Integer.parseInt(sMaxRunningTime) * 1000;
}
List<OsmNodeNamed> wplist = new ArrayList<OsmNodeNamed>();
List<OsmNodeNamed> wplist = new ArrayList<>();
wplist.add(from);
wplist.add(to);
@ -83,7 +83,7 @@ public class BRouter {
System.out.println("usage: java -jar brouter.jar <segmentdir> <lon-from> <lat-from> <lon-to> <lat-to> <profile>");
return;
}
List<OsmNodeNamed> wplist = new ArrayList<OsmNodeNamed>();
List<OsmNodeNamed> wplist = new ArrayList<>();
wplist.add(readPosition(args, 1, "from"));
RoutingEngine re = null;
if ("seed".equals(args[3])) {

View file

@ -5,7 +5,7 @@ import java.util.Map;
public class IpAccessMonitor {
private static Object sync = new Object();
private static Map<String, Long> ipAccess = new HashMap<String, Long>();
private static Map<String, Long> ipAccess = new HashMap<>();
private static long MAX_IDLE = 900000; // 15 minutes
private static long CLEANUP_INTERVAL = 10000; // 10 seconds
private static long lastCleanup;
@ -14,7 +14,7 @@ public class IpAccessMonitor {
long t = System.currentTimeMillis();
synchronized (sync) {
Long lastTime = ipAccess.get(ip);
ipAccess.put(ip, Long.valueOf(t));
ipAccess.put(ip, t);
return lastTime == null || t - lastTime.longValue() > MAX_IDLE;
}
}
@ -31,7 +31,7 @@ public class IpAccessMonitor {
}
private static void cleanup(long t) {
HashMap<String, Long> newMap = new HashMap<String, Long>(ipAccess.size());
HashMap<String, Long> newMap = new HashMap<>(ipAccess.size());
for (Map.Entry<String, Long> e : ipAccess.entrySet()) {
if (t - e.getValue().longValue() <= MAX_IDLE) {
newMap.put(e.getKey(), e.getValue());

View file

@ -15,7 +15,7 @@ public class Polygon {
private int maxy = Integer.MIN_VALUE;
public Polygon(BufferedReader br) throws IOException {
ArrayList<String> lines = new ArrayList<String>();
ArrayList<String> lines = new ArrayList<>();
for (; ; ) {
String line = br.readLine();

View file

@ -198,17 +198,17 @@ public class RouteServer extends Thread implements Comparable<RouteServer> {
} else if ("timode".equals(e.getKey())) {
rc.turnInstructionMode = Integer.parseInt(e.getValue());
} else if ("heading".equals(e.getKey())) {
rc.startDirection = Integer.valueOf(Integer.parseInt(e.getValue()));
rc.startDirection = Integer.parseInt(e.getValue());
rc.forceUseStartDirection = true;
} else if (e.getKey().startsWith("profile:")) {
if (rc.keyValues == null) {
rc.keyValues = new HashMap<String, String>();
rc.keyValues = new HashMap<>();
}
rc.keyValues.put(e.getKey().substring(8), e.getValue());
} else if (e.getKey().equals("straight")) {
String[] sa = e.getValue().split(",");
for (int i = 0; i < sa.length; i++) {
int v = Integer.valueOf(sa[i]);
int v = Integer.parseInt(sa[i]);
if (wplist.size() > v) wplist.get(v).direct = true;
}
}
@ -297,7 +297,7 @@ public class RouteServer extends Thread implements Comparable<RouteServer> {
ProfileCache.setSize(2 * maxthreads);
PriorityQueue<RouteServer> threadQueue = new PriorityQueue<RouteServer>();
PriorityQueue<RouteServer> threadQueue = new PriorityQueue<>();
ServerSocket serverSocket = args.length > 5 ? new ServerSocket(Integer.parseInt(args[3]), 100, InetAddress.getByName(args[5])) : new ServerSocket(Integer.parseInt(args[3]));
@ -362,7 +362,7 @@ public class RouteServer extends Thread implements Comparable<RouteServer> {
private static Map<String, String> getUrlParams(String url) throws UnsupportedEncodingException {
HashMap<String, String> params = new HashMap<String, String>();
HashMap<String, String> params = new HashMap<>();
String decoded = URLDecoder.decode(url, "UTF-8");
StringTokenizer tk = new StringTokenizer(decoded, "?&");
while (tk.hasMoreTokens()) {

View file

@ -244,7 +244,7 @@ public class SuspectManager extends Thread {
bw.write("<table>\n");
File countryParent = new File("worldpolys" + country);
File[] files = countryParent.listFiles();
TreeSet<String> names = new TreeSet<String>();
TreeSet<String> names = new TreeSet<>();
for (File f : files) {
String name = f.getName();
if (name.endsWith(".poly")) {
@ -580,7 +580,7 @@ public class SuspectManager extends Thread {
}
}
private static Map<String, SuspectList> allSuspectsMap = new HashMap<String, SuspectList>();
private static Map<String, SuspectList> allSuspectsMap = new HashMap<>();
private static SuspectList getDailySuspectsIfLoaded() throws IOException {
synchronized (allSuspectsMap) {

View file

@ -51,7 +51,7 @@ public class ProfileUploadHandler {
fileWriter.flush();
//System.out.println("data: |" + sw.toString() + "|");
Map<String, String> responseData = new HashMap<String, String>();
Map<String, String> responseData = new HashMap<>();
responseData.put("profileid", CUSTOM_PREFIX + id);
validateProfile(id, responseData);

View file

@ -94,7 +94,7 @@ public class ServerHandler extends RequestHandler {
if (coords.length < 2)
throw new IllegalArgumentException("we need two lat/lon points at least!");
List<OsmNodeNamed> wplist = new ArrayList<OsmNodeNamed>();
List<OsmNodeNamed> wplist = new ArrayList<>();
for (int i = 0; i < coords.length; i++) {
String[] lonLat = coords[i].split(",");
if (lonLat.length < 2)
@ -213,7 +213,7 @@ public class ServerHandler extends RequestHandler {
String[] lonLatNameList = pois.split("\\|");
List<OsmNodeNamed> poisList = new ArrayList<OsmNodeNamed>();
List<OsmNodeNamed> poisList = new ArrayList<>();
for (int i = 0; i < lonLatNameList.length; i++) {
String[] lonLatName = lonLatNameList[i].split(",");
@ -237,7 +237,7 @@ public class ServerHandler extends RequestHandler {
String[] lonLatRadList = nogos.split("\\|");
List<OsmNodeNamed> nogoList = new ArrayList<OsmNodeNamed>();
List<OsmNodeNamed> nogoList = new ArrayList<>();
for (int i = 0; i < lonLatRadList.length; i++) {
String[] lonLatRad = lonLatRadList[i].split(",");
String nogoWeight = "NaN";
@ -266,7 +266,7 @@ public class ServerHandler extends RequestHandler {
}
private List<OsmNodeNamed> readNogoPolygons() {
List<OsmNodeNamed> result = new ArrayList<OsmNodeNamed>();
List<OsmNodeNamed> result = new ArrayList<>();
parseNogoPolygons(params.get("polylines"), result, false);
parseNogoPolygons(params.get("polygons"), result, true);
return result.size() > 0 ? result : null;

View file

@ -17,7 +17,7 @@ import java.util.List;
* @author ab
*/
public class DenseLongMap {
private List<byte[]> blocklist = new ArrayList<byte[]>(4096);
private List<byte[]> blocklist = new ArrayList<>(4096);
private int blocksize; // bytes per bitplane in one block
private int blocksizeBits;

View file

@ -20,7 +20,7 @@ public class FrozenLongMap<V> extends CompactLongMap<V> {
size = map.size();
faid = new long[size];
flv = new ArrayList<V>(size);
flv = new ArrayList<>(size);
map.moveToFrozenArrays(faid, flv);

View file

@ -13,7 +13,7 @@ public class LazyArrayOfLists<E> {
private List<ArrayList<E>> lists;
public LazyArrayOfLists(int size) {
lists = new ArrayList<ArrayList<E>>(size);
lists = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
lists.add(null);
}
@ -22,7 +22,7 @@ public class LazyArrayOfLists<E> {
public List<E> getList(int idx) {
ArrayList<E> list = lists.get(idx);
if (list == null) {
list = new ArrayList<E>();
list = new ArrayList<>();
lists.set(idx, list);
}
return list;

View file

@ -22,14 +22,14 @@ public class CompactMapTest {
private void hashMapComparison(int mapsize, int trycount) {
Random rand = new Random(12345);
HashMap<Long, String> hmap = new HashMap<Long, String>();
CompactLongMap<String> cmap_slow = new CompactLongMap<String>();
CompactLongMap<String> cmap_fast = new CompactLongMap<String>();
HashMap<Long, String> hmap = new HashMap<>();
CompactLongMap<String> cmap_slow = new CompactLongMap<>();
CompactLongMap<String> cmap_fast = new CompactLongMap<>();
for (int i = 0; i < mapsize; i++) {
String s = "" + i;
long k = mapsize < 10 ? i : rand.nextInt(20000);
Long KK = new Long(k);
Long KK = k;
if (!hmap.containsKey(KK)) {
hmap.put(KK, s);
@ -40,11 +40,11 @@ public class CompactMapTest {
for (int i = 0; i < trycount * 2; i++) {
if (i == trycount) {
cmap_slow = new FrozenLongMap<String>(cmap_slow);
cmap_fast = new FrozenLongMap<String>(cmap_fast);
cmap_slow = new FrozenLongMap<>(cmap_slow);
cmap_fast = new FrozenLongMap<>(cmap_fast);
}
long k = mapsize < 10 ? i : rand.nextInt(20000);
Long KK = new Long(k);
Long KK = k;
String s = hmap.get(KK);
boolean contained = hmap.containsKey(KK);

View file

@ -22,13 +22,13 @@ public class CompactSetTest {
private void hashSetComparison(int setsize, int trycount) {
Random rand = new Random(12345);
HashSet<Long> hset = new HashSet<Long>();
HashSet<Long> hset = new HashSet<>();
CompactLongSet cset_slow = new CompactLongSet();
CompactLongSet cset_fast = new CompactLongSet();
for (int i = 0; i < setsize; i++) {
long k = setsize < 10 ? i : rand.nextInt(20000);
Long KK = new Long(k);
Long KK = k;
if (!hset.contains(KK)) {
hset.add(KK);
@ -43,7 +43,7 @@ public class CompactSetTest {
cset_fast = new FrozenLongSet(cset_fast);
}
long k = setsize < 10 ? i : rand.nextInt(20000);
Long KK = new Long(k);
Long KK = k;
boolean contained = hset.contains(KK);
Assert.assertEquals("contains missmatch (slow)", contained, cset_slow.contains(k));

View file

@ -16,21 +16,21 @@ public class DenseLongMapTest {
private void hashMapComparison(int mapsize, int trycount, long keyrange) {
Random rand = new Random(12345);
HashMap<Long, Integer> hmap = new HashMap<Long, Integer>();
HashMap<Long, Integer> hmap = new HashMap<>();
DenseLongMap dmap = new DenseLongMap(512);
for (int i = 0; i < mapsize; i++) {
int value = i % 255;
long k = (long) (rand.nextDouble() * keyrange);
Long KK = new Long(k);
Long KK = k;
hmap.put(KK, new Integer(value));
hmap.put(KK, value);
dmap.put(k, value); // duplicate puts allowed!
}
for (int i = 0; i < trycount; i++) {
long k = (long) (rand.nextDouble() * keyrange);
Long KK = new Long(k);
Long KK = k;
Integer VV = hmap.get(KK);
int hvalue = VV == null ? -1 : VV.intValue();
int dvalue = dmap.getInt(k);
@ -48,17 +48,17 @@ public class DenseLongMapTest {
int trycount = 100000;
Random rand = new Random(12345);
HashSet<Long> hset = new HashSet<Long>();
HashSet<Long> hset = new HashSet<>();
DenseLongMap dmap = new DenseLongMap(512);
for (int i = 0; i < mapputs; i++) {
long k = (long) (rand.nextDouble() * keyrange);
hset.add(new Long(k));
hset.add(k);
dmap.put(k, 0);
}
for (int i = 0; i < trycount; i++) {
long k = (long) (rand.nextDouble() * keyrange);
boolean hcontains = hset.contains(new Long(k));
boolean hcontains = hset.contains(k);
boolean dcontains = dmap.getInt(k) == 0;
if (hcontains != dcontains) {

View file

@ -8,7 +8,7 @@ import java.util.Random;
public class SortedHeapTest {
@Test
public void sortedHeapTest1() {
SortedHeap<String> sh = new SortedHeap<String>();
SortedHeap<String> sh = new SortedHeap<>();
Random rnd = new Random();
for (int i = 0; i < 100000; i++) {
int val = rnd.nextInt(1000000);
@ -34,7 +34,7 @@ public class SortedHeapTest {
@Test
public void sortedHeapTest2() {
SortedHeap<String> sh = new SortedHeap<String>();
SortedHeap<String> sh = new SortedHeap<>();
Random rnd = new Random();
for (int i = 0; i < 100000; i++) {
sh.add(i, "" + i);

View file

@ -28,7 +28,6 @@
<exclude name="OneDeclarationPerLine" />
<exclude name="OverrideBothEqualsAndHashcode" />
<exclude name="PreserveStackTrace" />
<exclude name="PrimitiveWrapperInstantiation" />
<exclude name="ReturnEmptyCollectionRatherThanNull" />
<exclude name="UncommentedEmptyConstructor" />
<exclude name="UncommentedEmptyMethodBody" />
@ -48,4 +47,11 @@
<exclude name="MethodNamingConventions" />
</rule>
<!-- Rules similar to Android Studio code inspection default settings -->
<!-- <rule ref="category/java/bestpractices.xml/UnusedAssignment" /> -->
<rule ref="category/java/codestyle.xml/UseDiamondOperator" />
<!-- <rule ref="category/java/design.xml/ImmutableField" /> -->
<!-- Will be added in PMD 7 -->
<!-- <rule ref="category/java/codestyle.xml/UnnecessaryBoxing" /> -->
</ruleset>

View file

@ -86,7 +86,7 @@ GEM
activesupport (>= 2)
nokogiri (>= 1.4)
http_parser.rb (0.8.0)
i18n (1.12.0)
i18n (1.13.0)
concurrent-ruby (~> 1.0)
jekyll (3.9.3)
addressable (~> 2.4)
@ -210,7 +210,7 @@ GEM
jekyll-feed (~> 0.9)
jekyll-seo-tag (~> 2.1)
minitest (5.18.0)
nokogiri (1.14.3-x86_64-linux)
nokogiri (1.15.0-x86_64-linux)
racc (~> 1.4)
octokit (4.25.1)
faraday (>= 1, < 3)
@ -258,4 +258,4 @@ DEPENDENCIES
wdm (~> 0.1.1)
BUNDLED WITH
2.2.32
2.4.12

View file

@ -13,43 +13,6 @@ also build them yourself from an OSM dump (e.g. planet or [GeoFabrik
extract](https://download.geofabrik.de/))
## Build the pbfparser
First, there are two file formats available to download OSM data: `bzip`-ed
XML files (very large) and `.pbf`
([Protobuf](https://github.com/protocolbuffers/protobuf) format) which is much
more efficient. If you want to use the latter one, you will have to build the
`pbfparser` (located in `misc/pbfparser` first):
* Download [the latest
version](https://github.com/openstreetmap/osmosis/releases)
of [Osmosis](https://wiki.openstreetmap.org/wiki/Osmosis) and unzip it
somewhere.
* Copy the `lib/default/protobuf-java-*.jar` and
`lib/default/osmosis-osm-binary-*.jar` files from the unzipped Osmosis
archive to `misc/pbfparser/protobuf.jar` and `misc/pbfparser/osmosis.jar`.
* Build BRouter and copy
`brouter-server/build/libs/brouter-*-all.jar` to
`misc/pbfparser/brouter.jar`.
* You can build the `pbfparser` using, in the `misc/pbfparser/`
folder,
```
javac -d . -cp "brouter.jar:protobuf.jar:osmosis.jar" *.java
```
* Finally, you can build a `jar` file from these files using
```
jar cf pbfparser.jar btools/**/*.class
```
_Note:_ If the `jar` file is not properly created, everything else will seem
to work normally but there will not be any data extracted from the OSM data
dump. You can check what is actually inside the built `jar` file using
`jar tf pbfparser.jar`.
## Run the map creation script
If you want to have elevation information in the generated segments files, you

View file

@ -1,3 +0,0 @@
*.jar
*.BAK
btools/

View file

@ -1,136 +0,0 @@
package btools.mapcreator;
import java.io.*;
import java.util.*;
import java.util.zip.*;
import btools.util.*;
import org.openstreetmap.osmosis.osmbinary.Fileformat;
/**
* Parser for OSM data
*
* @author ab
*/
public class OsmParser extends MapCreatorBase {
private BufferedReader _br;
private NodeListener nListener;
private WayListener wListener;
private RelationListener rListener;
public void readMap(File mapFile,
NodeListener nListener,
WayListener wListener,
RelationListener rListener) throws Exception {
this.nListener = nListener;
this.wListener = wListener;
this.rListener = rListener;
System.out.println("*** PBF Parsing: " + mapFile);
// once more for testing
int rawBlobCount = 0;
long bytesRead = 0L;
// wait for file to become available
while (!mapFile.exists()) {
System.out.println("--- waiting for " + mapFile + " to become available");
Thread.sleep(10000);
}
long currentSize = mapFile.length();
long currentSizeTime = System.currentTimeMillis();
DataInputStream dis = new DataInputStream(new BufferedInputStream(new FileInputStream(mapFile)));
for (; ; ) {
// continue reading if either more then a 100 MB unread, or the current-size is known for more then 2 Minutes
while (currentSize - bytesRead < 100000000L) {
long newSize = mapFile.length();
if (newSize != currentSize) {
currentSize = newSize;
currentSizeTime = System.currentTimeMillis();
} else if (System.currentTimeMillis() - currentSizeTime > 120000) {
break;
}
if (currentSize - bytesRead < 100000000L) {
System.out.println("--- waiting for more data, currentSize=" + currentSize + " bytesRead=" + bytesRead);
Thread.sleep(10000);
}
}
int headerLength;
try {
headerLength = dis.readInt();
bytesRead += 4;
} catch (EOFException e) {
break;
}
byte[] headerBuffer = new byte[headerLength];
dis.readFully(headerBuffer);
bytesRead += headerLength;
Fileformat.BlobHeader blobHeader = Fileformat.BlobHeader.parseFrom(headerBuffer);
byte[] blobData = new byte[blobHeader.getDatasize()];
dis.readFully(blobData);
bytesRead += blobData.length;
new BPbfBlobDecoder(blobHeader.getType(), blobData, this).process();
rawBlobCount++;
}
dis.close();
System.out.println("read raw blobs: " + rawBlobCount);
}
public void addNode(long nid, Map<String, String> tags, double lat, double lon) {
NodeData n = new NodeData(nid, lon, lat);
n.setTags(tags);
try {
nListener.nextNode(n);
} catch (Exception e) {
throw new RuntimeException("error writing node: " + e);
}
}
public void addWay(long wid, Map<String, String> tags, LongList nodes) {
WayData w = new WayData(wid, nodes);
w.setTags((HashMap<String, String>) tags);
try {
wListener.nextWay(w);
} catch (Exception e) {
throw new RuntimeException("error writing way: " + e);
}
}
public void addRelation(long rid, Map<String, String> tags, LongList wayIds, LongList fromWid, LongList toWid, LongList viaNid) {
RelationData r = new RelationData(rid, wayIds);
r.setTags((HashMap<String, String>) tags);
try {
rListener.nextRelation(r);
if (fromWid == null || toWid == null || viaNid == null || viaNid.size() != 1) {
// dummy-TR for each viaNid
for (int vi = 0; vi < (viaNid == null ? 0 : viaNid.size()); vi++) {
rListener.nextRestriction(r, 0L, 0L, viaNid.get(vi));
}
return;
}
for (int fi = 0; fi < fromWid.size(); fi++) {
for (int ti = 0; ti < toWid.size(); ti++) {
rListener.nextRestriction(r, fromWid.get(fi), toWid.get(ti), viaNid.get(0));
}
}
} catch (Exception e) {
throw new RuntimeException("error writing relation", e);
}
}
}

View file

@ -1,23 +0,0 @@
The pbf-parse is not included in the regular source tree
to avoid the library dependencies to "osmosis" and "protobuf"
In order to run the mapcreator from a pbf-file (as it is
done in the process_pbf_planet.sh script included in
the git-repo), you have to build yourself the "pbfparser.jar"
by doing the following:
-> get osmosis from https://bretth.dev.openstreetmap.org/osmosis-build/osmosis-latest.zip
-> copy lib/default/osmosis-osm-binary-*.jar in the archive to osmosis.jar in
this folder
-> copy lib/default/protobuf-java-*.jar in the archive to protobuf.jar in this
folder
-> copy the brouter-server/build/libs/brouter-...-all.jar to
brouter.jar in this folder
-> compile the PBF-Parser using:
javac -d . -cp protobuf.jar:osmosis.jar:brouter.jar *.java
-> pack all the compiled class files together in a jar
"pbfparser.jar" with "jar cf pbfparser.jar btools/**/*.class"
Alternatively, just for testing you can run the Mapcreator against a *xml.bz2 Database-Extract,
then you don't need the pbf-parser. However, the XML-Parser does not (yet) parse
Turn-Restrictions, so really just for testing...

View file

@ -1 +0,0 @@
javac -d . -cp pbfparser.jar;brouter.jar BPbfFieldDecoder.java BPbfBlobDecoder.java OsmParser.java

View file

@ -24,14 +24,11 @@ touch lastmaprun.date
rm -rf /var/www/brouter/segments4_lastrun
JAVA='/java/bin/java -Xmx2600m -Xms2600m -Xmn32m'
JAVA='java -Xmx2600m -Xms2600m -Xmn32m'
BROUTER_PROFILES=$(realpath "../../profiles2")
BROUTER_JAR=$(realpath $(ls ../../../brouter-server/build/libs/brouter-*-all.jar))
OSMOSIS_JAR=$(realpath "../../pbfparser/osmosis.jar")
PROTOBUF_JAR=$(realpath "../../pbfparser/protobuf.jar")
PBFPARSER_JAR=$(realpath "../../pbfparser/pbfparser.jar")
PLANET_FILE=${PLANET_FILE:-$(realpath "./planet-latest.osm.pbf")}
# Download SRTM zip files from
@ -43,7 +40,7 @@ SRTM_PATH="/private-backup/srtm"
mkdir tmp
cd tmp
mkdir nodetiles
${JAVA} -cp "${OSMOSIS_JAR}:${PROTOBUF_JAR}:${PBFPARSER_JAR}:${BROUTER_JAR}" btools.mapcreator.OsmCutter ${BROUTER_PROFILES}/lookups.dat nodetiles ways.dat relations.dat restrictions.dat ${BROUTER_PROFILES}/all.brf ${PLANET_FILE}
${JAVA} -cp ${BROUTER_JAR} -DavoidMapPolling=true btools.mapcreator.OsmCutter ${BROUTER_PROFILES}/lookups.dat nodetiles ways.dat relations.dat restrictions.dat ${BROUTER_PROFILES}/all.brf ${PLANET_FILE}
mkdir ftiles
${JAVA} -cp ${BROUTER_JAR} -Ddeletetmpfiles=true -DuseDenseMaps=true btools.mapcreator.NodeFilter nodetiles ways.dat ftiles

View file

@ -15,7 +15,7 @@ mkdir waytiles
mkdir waytiles55
mkdir nodes55
../../jdk8/bin/java -Xmx6144M -Xms6144M -Xmn256M -cp ../pbfparser.jar:../brouter_fc.jar -Ddeletetmpfiles=true -DuseDenseMaps=true btools.util.StackSampler btools.mapcreator.OsmFastCutter ../lookups.dat nodetiles waytiles nodes55 waytiles55 bordernids.dat relations.dat restrictions.dat ../all.brf ../trekking.brf ../softaccess.brf ../planet-new.osm.pbf
../../jdk8/bin/java -Xmx6144M -Xms6144M -Xmn256M -cp ../brouter_fc.jar -Ddeletetmpfiles=true -DuseDenseMaps=true btools.util.StackSampler btools.mapcreator.OsmFastCutter ../lookups.dat nodetiles waytiles nodes55 waytiles55 bordernids.dat relations.dat restrictions.dat ../all.brf ../trekking.brf ../softaccess.brf ../planet-new.osm.pbf
mv ../planet-latest.osm.pbf ../planet-old.osm.pbf
mv ../planet-new.osm.pbf ../planet-latest.osm.pbf