Skip to content
Snippets Groups Projects
Commit 56f9d22d authored by lazarog98's avatar lazarog98
Browse files

Merge branch 'create_central_config_for_bounding_box' into 'main'

Central config

See merge request !27
parents 8a4b6435 22277384
Branches
No related tags found
1 merge request!27Central config
FROM eclipse-temurin:19-jdk-alpine FROM eclipse-temurin:19-jdk-alpine
ADD target/*-jar-with-dependencies.jar app.jar ADD target/*-jar-with-dependencies.jar app.jar
COPY src/main/resources/config.properties /data/configuration/config.properties
# Add the cron job # Add the cron job
# Calculate the map each day at 00:00 # Calculate the map each day at 00:00
......
...@@ -86,10 +86,10 @@ ...@@ -86,10 +86,10 @@
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.google.protobuf</groupId> <groupId>com.google.protobuf</groupId>
......
...@@ -16,6 +16,11 @@ import map.builder.utilities.Config; ...@@ -16,6 +16,11 @@ import map.builder.utilities.Config;
import map.builder.utilities.ConnectedComponentGraph; import map.builder.utilities.ConnectedComponentGraph;
import map.builder.utilities.FileHandler; import map.builder.utilities.FileHandler;
import java.io.IOException;
import java.util.List;
import static map.builder.utilities.Config.*;
public class App { public class App {
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
System.out.println("Map builder started!"); System.out.println("Map builder started!");
...@@ -24,29 +29,7 @@ public class App { ...@@ -24,29 +29,7 @@ public class App {
RoadNetwork.Builder roadNetworkBuilder = RoadNetwork.newBuilder(); RoadNetwork.Builder roadNetworkBuilder = RoadNetwork.newBuilder();
OSMParser parser = new OSMParser(); OSMParser parser = new OSMParser();
// A small BBox inside Cottbus BoundingBox bbox = new BoundingBox(BOUNDING_BOX_MIN_LAT, BOUNDING_BOX_MIN_LON, BOUNDING_BOX_MAX_LAT, BOUNDING_BOX_MAX_LON);
/*
* float minLat = 51.765120241998865f;
* float minLon = 14.32669617537409f;
* float maxLat = 51.77116774623326f;
* float maxLon = 14.330334220133722f;
*/
// smaller BBox inside Cottbus, better for the debug tool
float minLat = 51.754092326645475f;
float minLon = 14.300615062713623f;
float maxLat = 51.766591637718435f;
float maxLon = 14.314413070678711f;
// BBox around Cottbus
/*
* float minLat = 51.714692361306376f;
* float minLon = 14.26197052001953f;
* float maxLat = 51.79290380494767f;
* float maxLon = 14.415779113769531f;
*/
BoundingBox bbox = new BoundingBox(minLat, minLon, maxLat, maxLon);
List<OSMJsonDto> restrictions = OSMFetcher.fetchTurnRestrictions(bbox); List<OSMJsonDto> restrictions = OSMFetcher.fetchTurnRestrictions(bbox);
List<OSMJsonDto> roads = OSMFetcher.fetchNodesAndWays(bbox); List<OSMJsonDto> roads = OSMFetcher.fetchNodesAndWays(bbox);
......
...@@ -14,6 +14,14 @@ public class Config { ...@@ -14,6 +14,14 @@ public class Config {
public static String ROAD_NETWORK_OUTPUT_PATH = "roadnetwork.proto"; public static String ROAD_NETWORK_OUTPUT_PATH = "roadnetwork.proto";
/**
* Bounding box, default small box inside Cottbus
*/
public static float BOUNDING_BOX_MIN_LAT = 51.765120241998865f;
public static float BOUNDING_BOX_MIN_LON = 14.32669617537409f;
public static float BOUNDING_BOX_MAX_LAT = 51.77116774623326f;
public static float BOUNDING_BOX_MAX_LON = 14.330334220133722f;
public static void load() { public static void load() {
//The config is used for running the application in a Docker container //The config is used for running the application in a Docker container
String configFilePath = "/data/configuration/config.properties"; String configFilePath = "/data/configuration/config.properties";
...@@ -21,7 +29,12 @@ public class Config { ...@@ -21,7 +29,12 @@ public class Config {
try (FileInputStream is = new FileInputStream(configFilePath)){ try (FileInputStream is = new FileInputStream(configFilePath)){
props.load(is); props.load(is);
ROAD_NETWORK_OUTPUT_PATH = props.getProperty("ROAD_NETWORK_OUTPUT_PATH", ROAD_NETWORK_OUTPUT_PATH); ROAD_NETWORK_OUTPUT_PATH = props.getProperty("MAP_BUILDER_ROAD_NETWORK_OUTPUT_PATH", ROAD_NETWORK_OUTPUT_PATH);
BOUNDING_BOX_MIN_LAT = Float.parseFloat(props.getProperty("BOUNDING_BOX_MIN_LAT", String.valueOf(BOUNDING_BOX_MIN_LAT)));
BOUNDING_BOX_MIN_LON = Float.parseFloat(props.getProperty("BOUNDING_BOX_MIN_LON", String.valueOf(BOUNDING_BOX_MIN_LON)));
BOUNDING_BOX_MAX_LAT = Float.parseFloat(props.getProperty("BOUNDING_BOX_MAX_LAT", String.valueOf(BOUNDING_BOX_MAX_LAT)));
BOUNDING_BOX_MAX_LON = Float.parseFloat(props.getProperty("BOUNDING_BOX_MAX_LON", String.valueOf(BOUNDING_BOX_MAX_LON)));
System.out.println("Config loaded."); System.out.println("Config loaded.");
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
// Either way the Docker image was build wrong or this is not // Either way the Docker image was build wrong or this is not
......
# Standard config for Docker
ROAD_NETWORK_OUTPUT_PATH = /data/road_network/roadnetwork.proto
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment