network and access checks on cycle relations
This commit is contained in:
parent
2b70d8a862
commit
1b8c3ccea8
10 changed files with 409 additions and 10 deletions
|
|
@ -0,0 +1,74 @@
|
|||
package btools.mapcreator;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.EOFException;
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
|
||||
import btools.util.DenseLongMap;
|
||||
import btools.util.TinyDenseLongMap;
|
||||
|
||||
/**
|
||||
* WayCutter does 2 step in map-processing:
|
||||
*
|
||||
* - cut the way file into 45*30 - pieces
|
||||
* - enrich ways with relation information
|
||||
*
|
||||
* @author ab
|
||||
*/
|
||||
public class RelationStatistics extends MapCreatorBase
|
||||
{
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
System.out.println("*** RelationStatistics: count relation networks");
|
||||
if (args.length != 1)
|
||||
{
|
||||
System.out.println("usage: java WayCutter <relation-file>" );
|
||||
|
||||
return;
|
||||
}
|
||||
new RelationStatistics().process( new File( args[0] ) );
|
||||
}
|
||||
|
||||
public void process( File relationFileIn ) throws Exception
|
||||
{
|
||||
HashMap<String,long[]> relstats = new HashMap<String,long[]>();
|
||||
|
||||
DataInputStream dis = createInStream( relationFileIn );
|
||||
try
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
long rid = readId( dis );
|
||||
String network = dis.readUTF();
|
||||
int waycount = 0;
|
||||
for(;;)
|
||||
{
|
||||
long wid = readId( dis );
|
||||
if ( wid == -1 ) break;
|
||||
waycount++;
|
||||
}
|
||||
|
||||
long[] stat = relstats.get( network );
|
||||
if ( stat == null )
|
||||
{
|
||||
stat = new long[2];
|
||||
relstats.put( network, stat );
|
||||
}
|
||||
stat[0]++;
|
||||
stat[1] += waycount;
|
||||
}
|
||||
}
|
||||
catch( EOFException eof )
|
||||
{
|
||||
dis.close();
|
||||
}
|
||||
for( String network : relstats.keySet() )
|
||||
{
|
||||
long[] stat = relstats.get( network );
|
||||
System.out.println( "network: " + network + " has " + stat[0] + " relations with " + stat[1] + " ways" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue