Skip to content

Commit

Permalink
test: add borders csv file and processed HD graph
Browse files Browse the repository at this point in the history
  • Loading branch information
aoles committed Apr 9, 2024
1 parent c6e9c08 commit 341dcd2
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 11 deletions.
5 changes: 5 additions & 0 deletions ors-api/src/test/files/borders/borders.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
iso;name_en;geom
XC;Area 3 English;MULTIPOLYGON(((8.686269562020373 49.404812487369142,8.686034209438265 49.403748108474431,8.68550466612848 49.40093773101411,8.694024429601255 49.399995797403818,8.695024678075269 49.403617931054903,8.686269562020373 49.404812487369142)))
XD;Area 4 English;MULTIPOLYGON(((8.686269562020376 49.404812487369142,8.687116831316011 49.407446534490731,8.696119067582131 49.406627238463642,8.695024678075269 49.403617931054896,8.686269562020376 49.404812487369142)))
XA;Area 1 English;MULTIPOLYGON(((8.68603420943826 49.403748108474424,8.680209233030766 49.404582767258027,8.681739024814549 49.407913603676974,8.687116831316008 49.407446534490731,8.686269562020374 49.404812487369142,8.68603420943826 49.403748108474424)))
XB;Area 2 English;MULTIPOLYGON(((8.680209233030766 49.404582767258027,8.679091308265694 49.401680543964602,8.685504666128484 49.400937731014132,8.686034209438256 49.403748108474439,8.680209233030766 49.404582767258027)))
8 changes: 4 additions & 4 deletions ors-api/src/test/files/borders/ids.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"country_id","name","name:en","iso_code_cca2","iso_code_cca3"
"1","Area 1","Area 1 English","AT","AUT"
"2","Area 2","Area 2 English","CH","CHE"
"3","Area 3","Area 3 English","FR","FRA"
"4","Area 4","Area 4 English","DE","DEU"
"1","Area 1","Area 1 English","XA","XXA"
"2","Area 2","Area 2 English","XB","XXB"
"3","Area 3","Area 3 English","XC","XXC"
"4","Area 4","Area 4 English","XD","XXD"
Binary file added ors-api/src/test/files/heidelberg.ors.pbf
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -1866,7 +1866,7 @@ void testCountryExclusion() {
.statusCode(200);

// Test avoid_countries with ISO 3166-1 Alpha-2 parameters
options.put("avoid_countries", constructFromPipedList("AT|FR"));
options.put("avoid_countries", constructFromPipedList("XA|XC"));
given()
.config(JSON_CONFIG_DOUBLE_NUMBERS)
.headers(CommonHeaders.jsonContent)
Expand All @@ -1881,7 +1881,7 @@ void testCountryExclusion() {
.statusCode(200);

// Test avoid_countries with ISO 3166-1 Alpha-3 parameters
options.put("avoid_countries", constructFromPipedList("AUT|FRA"));
options.put("avoid_countries", constructFromPipedList("XXA|XXC"));
given()
.config(JSON_CONFIG_DOUBLE_NUMBERS)
.headers(CommonHeaders.jsonContent)
Expand Down
4 changes: 3 additions & 1 deletion ors-api/src/test/resources/application-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ors:
maximum_intervals: 10

engine:
source_file: ./src/test/files/heidelberg.osm.gz
source_file: ./src/test/files/heidelberg.ors.pbf
graphs_root_path: graphs-apitests
elevation:
cache_path: ./src/test/files/elevation
Expand Down Expand Up @@ -68,6 +68,7 @@ ors:
WaySurfaceType:
Tollways:
Borders:
preprocessed: true
boundaries: ./src/test/files/borders/borders.geojson
ids: ./src/test/files/borders/ids.csv
openborders: ./src/test/files/borders/openborders.csv
Expand Down Expand Up @@ -124,6 +125,7 @@ ors:
WaySurfaceType:
Tollways:
Borders:
preprocessed: true
boundaries: ./src/test/files/borders/borders.geojson
ids: ./src/test/files/borders/ids.csv
openborders: ./src/test/files/borders/openborders.csv
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public void processEdge(ReaderWay way, EdgeIteratorState edge) {
short type = BordersGraphStorage.NO_BORDER;
short start = 0;
short end = 0;
if (!preprocessed) {
//if (!preprocessed) {
// First get the start and end countries - if they are equal, then there is no crossing
String startVal = way.getTag(TAG_KEY_COUNTRY1);
String endVal = way.getTag(TAG_KEY_COUNTRY2);
Expand All @@ -203,9 +203,10 @@ public void processEdge(ReaderWay way, EdgeIteratorState edge) {
if (start != end) {
type = (cbReader.isOpen(cbReader.getEngName(startVal), cbReader.getEngName(endVal))) ? (short) 2 : (short) 1;
}
System.out.println("Old: isOpen(" + cbReader.getEngName(startVal) + " " + cbReader.getEngName(endVal) + ") = " + type);
storage.setEdgeValue(edge.getEdge(), type, start, end);
}
} else {
//} else {
int egdeId1 = edge.getBaseNode();
int edgeId2 = edge.getAdjNode();
String countryCode1 = wayNodeTags.getOrDefault(egdeId1, "");
Expand All @@ -219,9 +220,11 @@ public void processEdge(ReaderWay way, EdgeIteratorState edge) {
if (start != end) {
type = cbReader.isOpen(cbReader.getName(start), cbReader.getName(end)) ? (short) 2 : (short) 1;
}
System.out.println("Old: isOpen(" + cbReader.getName(start) + " " + cbReader.getName(end) + ") = " + type);

storage.setEdgeValue(edge.getEdge(), type, start, end);
}
}
//}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,8 @@ public void processPathEdge(EdgeIteratorState edge, PointList geom) {
coordinate.y = geom.getLat(0);
CountryBordersPolygon[] countries = countryBordersReader.getCountry(coordinate);
if (countries.length >= 1) {
country1 = Short.parseShort(countryBordersReader.getId(countryBordersReader.getCountry(coordinate)[0].getName()));
short country0 = Short.parseShort(countryBordersReader.getId(countryBordersReader.getCountry(coordinate)[0].getName()));
country1 = country0;
}
}
if (countryTraversalInfoBuilder != null && country1 != 0) {
Expand Down

0 comments on commit 341dcd2

Please sign in to comment.