variable length tag descriptions (minor lookup versions, bugfixes)

This commit is contained in:
Arndt 2014-06-01 19:38:47 +02:00
parent f0b1889afd
commit eba5737739
9 changed files with 90 additions and 48 deletions

View file

@ -58,11 +58,11 @@ public class OsmCutter extends MapCreatorBase
_expctxWay = new BExpressionContext("way");
_expctxWay.readMetaData( lookupFile );
_expctxWayStat = new BExpressionContext("way");
// _expctxWayStat = new BExpressionContext("way");
_expctxNode = new BExpressionContext("node");
_expctxNode.readMetaData( lookupFile );
_expctxNodeStat = new BExpressionContext("node");
// _expctxNodeStat = new BExpressionContext("node");
this.outTileDir = outTileDir;
if ( !outTileDir.isDirectory() ) throw new RuntimeException( "out tile directory " + outTileDir + " does not exist" );
@ -82,10 +82,10 @@ public class OsmCutter extends MapCreatorBase
wayDos.close();
cyclewayDos.close();
System.out.println( "-------- way-statistics -------- " );
_expctxWayStat.dumpStatistics();
System.out.println( "-------- node-statistics -------- " );
_expctxNodeStat.dumpStatistics();
// System.out.println( "-------- way-statistics -------- " );
// _expctxWayStat.dumpStatistics();
// System.out.println( "-------- node-statistics -------- " );
// _expctxNodeStat.dumpStatistics();
System.out.println( statsLine() );
}
@ -114,7 +114,7 @@ public class OsmCutter extends MapCreatorBase
{
String value = n.getTag( key );
_expctxNode.addLookupValue( key, value, lookupData );
_expctxNodeStat.addLookupValue( key, value, null );
// _expctxNodeStat.addLookupValue( key, value, null );
}
n.description = _expctxNode.encode(lookupData);
}
@ -161,7 +161,7 @@ public class OsmCutter extends MapCreatorBase
{
String value = w.getTag( key );
_expctxWay.addLookupValue( key, value, lookupData );
_expctxWayStat.addLookupValue( key, value, null );
// _expctxWayStat.addLookupValue( key, value, null );
}
w.description = _expctxWay.encode(lookupData);
}

View file

@ -23,7 +23,7 @@ public class RelationMerger extends MapCreatorBase
private CompactLongSet routesetall;
private BExpressionContext expctxReport;
private BExpressionContext expctxCheck;
private BExpressionContext expctxStat;
// private BExpressionContext expctxStat;
private DataOutputStream wayOutStream;
@ -48,7 +48,7 @@ public class RelationMerger extends MapCreatorBase
expctxCheck = new BExpressionContext("way");
expctxCheck.readMetaData( lookupFile );
expctxCheck.parseFile( checkProfile, "global" );
expctxStat = new BExpressionContext("way");
// expctxStat = new BExpressionContext("way");
// *** read the relation file into sets for each processed tag
routesets = new HashMap<String,CompactLongSet>();
@ -78,7 +78,7 @@ public class RelationMerger extends MapCreatorBase
{
long wid = readId( dis );
if ( wid == -1 ) break;
expctxStat.addLookupValue( tagname, "yes", null );
// expctxStat.addLookupValue( tagname, "yes", null );
if ( routeset != null && !routeset.contains( wid ) )
{
routeset.add( wid );
@ -103,8 +103,8 @@ public class RelationMerger extends MapCreatorBase
new WayIterator( this, true ).processFile( wayFileIn );
wayOutStream.close();
System.out.println( "-------- route-statistics -------- " );
expctxStat.dumpStatistics();
// System.out.println( "-------- route-statistics -------- " );
// expctxStat.dumpStatistics();
}
@Override

View file

@ -39,6 +39,7 @@ public class WayLinker extends MapCreatorBase
private List<OsmNodeP> nodesList;
private CompactLongSet borderSet;
private short lookupVersion;
private short lookupMinorVersion;
private long creationTimeStamp;
@ -59,7 +60,7 @@ public class WayLinker extends MapCreatorBase
public static void main(String[] args) throws Exception
{
System.out.println("*** WayLinker: Format a regionof an OSM map for routing");
System.out.println("*** WayLinker: Format a region of an OSM map for routing");
if (args.length != 7)
{
System.out.println("usage: java WayLinker <node-tiles-in> <way-tiles-in> <bordernodes> <lookup-file> <profile-file> <data-tiles-out> <data-tiles-suffix> ");
@ -79,6 +80,7 @@ public class WayLinker extends MapCreatorBase
expctxWay = new BExpressionContext("way");
expctxWay.readMetaData( lookupFile );
lookupVersion = expctxWay.lookupVersion;
lookupMinorVersion = expctxWay.lookupMinorVersion;
expctxWay.parseFile( profileFile, "global" );
creationTimeStamp = System.currentTimeMillis();
@ -152,13 +154,13 @@ public class WayLinker extends MapCreatorBase
boolean ok = expctxWay.getCostfactor() < 10000.;
expctxWay.evaluate( true, description, null );
ok |= expctxWay.getCostfactor() < 10000.;
if ( !ok ) return;
byte bridgeTunnel = 0;
expctxWay.decode( description );
if ( expctxWay.getBooleanLookupValue( "bridge" ) ) bridgeTunnel |= OsmNodeP.BRIDGE_AND_BIT;
if ( expctxWay.getBooleanLookupValue( "tunnel" ) ) bridgeTunnel |= OsmNodeP.TUNNEL_AND_BIT;
if ( !ok ) return;
OsmNodeP n1 = null;
OsmNodeP n2 = null;
for (int i=0; i<way.nodes.size(); i++)
@ -182,7 +184,6 @@ public class WayLinker extends MapCreatorBase
if ( n2 != null )
{
n2.wayAndBits &= bridgeTunnel;
// if ( n2 instanceof OsmNodePT ) ((OsmNodePT)n2).wayOrBits |= lowbyte;
}
}
}
@ -298,7 +299,7 @@ public class WayLinker extends MapCreatorBase
}
}
byte[] abFileIndex = compileFileIndex( fileIndex, lookupVersion );
byte[] abFileIndex = compileFileIndex( fileIndex, lookupVersion, lookupMinorVersion );
// write extra data: timestamp + index-checksums
os.writeLong( creationTimeStamp );
@ -317,14 +318,14 @@ public class WayLinker extends MapCreatorBase
}
}
private byte[] compileFileIndex( long[] fileIndex, short lookupVersion ) throws Exception
private byte[] compileFileIndex( long[] fileIndex, short lookupVersion, short lookupMinorVersion ) throws Exception
{
ByteArrayOutputStream bos = new ByteArrayOutputStream( );
DataOutputStream dos = new DataOutputStream( bos );
long versionPrefix = lookupVersion;
versionPrefix <<= 48;
for( int i55=0; i55<25; i55++)
{
long versionPrefix = i55 == 1 ? lookupMinorVersion : lookupVersion;
versionPrefix <<= 48;
dos.writeLong( fileIndex[i55] | versionPrefix );
}
dos.close();