From 3f8d9d1ca2b0efa7952c4c158549b925a4255fcf Mon Sep 17 00:00:00 2001 From: Kevin Webb Date: Fri, 3 Aug 2018 13:43:13 -0400 Subject: [PATCH] update ingester to 1.1 --- ingest/build.gradle | 2 +- .../matcher/ingest/Ingester.java | 84 +++++++------------ 2 files changed, 31 insertions(+), 55 deletions(-) diff --git a/ingest/build.gradle b/ingest/build.gradle index 08ca2bc..9fc160d 100644 --- a/ingest/build.gradle +++ b/ingest/build.gradle @@ -1,7 +1,7 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar group 'io.sharedstreets' -version '1.0' +version '1.1' apply plugin: 'java' diff --git a/ingest/src/main/java/io/sharedstreets/matcher/ingest/Ingester.java b/ingest/src/main/java/io/sharedstreets/matcher/ingest/Ingester.java index 800063b..116abb1 100644 --- a/ingest/src/main/java/io/sharedstreets/matcher/ingest/Ingester.java +++ b/ingest/src/main/java/io/sharedstreets/matcher/ingest/Ingester.java @@ -51,17 +51,7 @@ public static void main(String[] args) throws Exception { .withArgName("OUTPUT-DIR") .create() ); - options.addOption( OptionBuilder.withLongOpt( "tileUrl" ) - .withDescription( "url for map tiles " ) - .hasArg() - .withArgName("TILE-URL") - .create() ); - options.addOption( OptionBuilder.withLongOpt( "tileLevel" ) - .withDescription( "" ) - .hasArg() - .withArgName("TILE-LEVEL") - .create() ); options.addOption("speeds", "track GPS speed when available"); options.addOption("verbose", "verbose error output" ); @@ -72,11 +62,9 @@ public static void main(String[] args) throws Exception { String inputType = ""; - String tileLevel = "6"; boolean verbose = false; - String tileUrl = "https://tiles.sharedstreets.io/osm/planet-180312/"; boolean gpsSpeeds = false; @@ -105,16 +93,6 @@ public static void main(String[] args) throws Exception { verbose = true; } - if( line.hasOption( "tileUrl" ) ) { - // print the value of block-size - tileUrl = line.getOptionValue( "tileUrl" ).trim();; - } - - if( line.hasOption( "tileLevel" ) ) { - // print the value of block-size - tileLevel = line.getOptionValue( "tileLevel" ).trim();; - } - if( line.hasOption( "type" ) ) { // print the value of block-size inputType = line.getOptionValue( "type" ).trim().toUpperCase(); @@ -141,8 +119,6 @@ else if(fileParts[fileParts.length-1].toLowerCase().equals("dcfhv")) } final String finalInputType = inputType; - final String finalTileUrl = tileUrl; - final String finalTileLevel = tileLevel; final boolean finalVerbose = verbose; // let's go... @@ -195,39 +171,39 @@ public void flatMap(String value, Collector out) throws Exception { }); } - // create list of map tiles for input traces - DataSet tileIds = inputEvents.map(new MapFunction(){ - - @Override - public TileId map(InputEvent value) throws Exception { - return TileId.lonLatToTileId(12, value.point.lon, value.point.lat); - } - - }).distinct(); - - // map IDs to tile URLs - DataSet tileUrls = tileIds.map(new MapFunction() { - @Override - public String map(TileId value) throws Exception { - // TODO allow selection of tile build -- defaulting to current build for moment - return finalTileUrl + value.toString() + ".geometry." + finalTileLevel + ".pbf"; - } - }); - - Path mapTilePath = Paths.get(outputPath, "tile_set.txt").toAbsolutePath(); - - if(mapTilePath.toFile().exists()) { - System.out.print("File already exists: " + mapTilePath.toString()); - return; - } - - // write tile URLs to disk (can be read by curl "xargs -n 1 curl -O < tile_set.txt") - tileUrls.writeAsText(mapTilePath.toString()).setParallelism(1); - +// // create list of map tiles for input traces +// DataSet tileIds = inputEvents.map(new MapFunction(){ +// +// @Override +// public TileId map(InputEvent value) throws Exception { +// return TileId.lonLatToTileId(12, value.point.lon, value.point.lat); +// } +// +// }).distinct(); +// +// // map IDs to tile URLs +// DataSet tileUrls = tileIds.map(new MapFunction() { +// @Override +// public String map(TileId value) throws Exception { +// // TODO allow selection of tile build -- defaulting to current build for moment +// return finalTileUrl + value.toString() + ".geometry." + finalTileLevel + ".pbf"; +// } +// }); +// +// Path mapTilePath = Paths.get(outputPath, "tile_set.txt").toAbsolutePath(); +// +// if(mapTilePath.toFile().exists()) { +// System.out.print("File already exists: " + mapTilePath.toString()); +// return; +// } +// +// // write tile URLs to disk (can be read by curl "xargs -n 1 curl -O < tile_set.txt") +// tileUrls.writeAsText(mapTilePath.toString()).setParallelism(1); +// Path dataPath = Paths.get(outputPath, "event_data").toAbsolutePath(); if(dataPath.toFile().exists()) { - System.out.print("File already exists: " + mapTilePath.toString()); + System.out.print("File already exists: " + outputPath.toString()); return; }