Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docker/docker-compose.custom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ services:
file: docker-compose.base.yml
service: jore4-mapmatchingdb-base
container_name: mapmatchingdb
image: "hsldevcom/jore4-postgres:mapmatching-main--20250425-c07c8632baab554dfbbbb64177ed930282094232"
environment:
DIGIROAD_ROUTING_DUMP_URL: "https://stjore4dev001.blob.core.windows.net/jore4-digiroad/2025-08-29_create_routing_schema_digiroad_r_2025_02_fixup.sql"
50 changes: 50 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<!-- Library versions -->
<arrow-core.version>2.1.2</arrow-core.version>
<geolatte.version>1.10</geolatte.version>
<geotools.version>34.0</geotools.version>
<kotlin-logging-jvm.version>7.0.13</kotlin-logging-jvm.version>
<quicktheories.version>0.26</quicktheories.version>

Expand All @@ -46,6 +47,20 @@
<flyway.cleanDisabled>false</flyway.cleanDisabled>
</properties>

<repositories>
<repository>
<id>osgeo</id>
<name>OSGeo Release Repository</name>
<url>https://repo.osgeo.org/repository/release/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>

<profiles>
<profile>
<id>prod</id>
Expand Down Expand Up @@ -570,6 +585,41 @@
<version>${geolatte.version}</version>
</dependency>

<!-- GeoTools for transformation between coordinate systems. -->
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-main</artifactId>
<version>${geotools.version}</version>
<exclusions>
<exclusion>
<groupId>org.geotools</groupId>
<artifactId>gt-http</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-epsg-hsql</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-geopkg</artifactId>
<version>${geotools.version}</version>
</dependency>

<dependency>
<groupId>com.github.doyaaaaaken</groupId>
<artifactId>kotlin-csv-jvm</artifactId>
<version>1.5.1</version>
</dependency>

<dependency>
<groupId>org.nield</groupId>
<artifactId>kotlin-statistics</artifactId>
<version>1.2.1</version>
</dependency>

<dependency>
<groupId>io.arrow-kt</groupId>
<artifactId>arrow-core</artifactId>
Expand Down
8 changes: 8 additions & 0 deletions profiles/dev/config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,11 @@ spring.thymeleaf.cache=false
# NOTE! Leave this blank and just populate it in the user-specific .properties
# file, which is git-ignored.
digitransit.subscription.key=

# In the jore4-jore3-importer repository (https://github.com/HSLdevcom/jore4-jore3-importer), there
# exists a "create-bulk-map-matching-input" branch containing a script that can be used to generate
# the CSV file.
test.routes.csvfile=

# The output directory to which the resulting GeoJSON and GeoPackage files are written.
test.output.dir=
8 changes: 8 additions & 0 deletions profiles/prod/config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,11 @@ spring.thymeleaf.cache=true
# NOTE! Leave this blank and just populate it in the user-specific .properties
# file, which is git-ignored.
digitransit.subscription.key=

# In the jore4-jore3-importer repository (https://github.com/HSLdevcom/jore4-jore3-importer), there
# exists a "create-bulk-map-matching-input" branch containing a script that can be used to generate
# the CSV file.
test.routes.csvfile=

# The output directory to which the resulting GeoJSON and GeoPackage files are written.
test.output.dir=
3 changes: 3 additions & 0 deletions run-bulk-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

mvn -Pprod -DDB_URL=jdbc:postgresql://localhost:6433/jore4mapmatching?stringtype=unspecified -DDB_USERNAME=mapmatching -DDB_PASSWORD=password clean spring-boot:run
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ class MatchRouteViaPointsOnLinksServiceImpl(
targetRoutePointSequenceCandidates: List<List<PgRoutingPoint>>,
bufferRadiusInMeters: Double
): List<RouteLink>? =
targetRoutePointSequenceCandidates.firstNotNullOfOrNull { targetRoutePoints ->
targetRoutePointSequenceCandidates.withIndex().firstNotNullOfOrNull { (index, targetRoutePoints) ->

val round = index + 1

val bufferAreaRestriction =
BufferAreaRestriction.from(
Expand All @@ -201,8 +203,19 @@ class MatchRouteViaPointsOnLinksServiceImpl(
targetRoutePoints.last()
)

routingService
.findRouteViaPointsOnLinks(targetRoutePoints, vehicleType, true, bufferAreaRestriction)
.ifEmpty { null }
val routeLinks: List<RouteLink> =
routingService.findRouteViaPointsOnLinks(
targetRoutePoints,
vehicleType,
true,
bufferAreaRestriction
)

if (routeLinks.isNotEmpty()) {
if (round > 1) LOGGER.info { "Matched route on attempt #$round." }
routeLinks
} else {
null
}
}
}
Loading
Loading