From 44eb25b42be8230d97c21a30cd8bc585ed4c7616 Mon Sep 17 00:00:00 2001 From: nkuehnel Date: Tue, 12 Mar 2024 11:08:01 +0100 Subject: [PATCH] change drt wait stats to gpkg --- .../zonal/DrtZonalWaitTimesAnalyzer.java | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/contribs/drt/src/main/java/org/matsim/contrib/drt/analysis/zonal/DrtZonalWaitTimesAnalyzer.java b/contribs/drt/src/main/java/org/matsim/contrib/drt/analysis/zonal/DrtZonalWaitTimesAnalyzer.java index fd0fb66d20f..129c952ec09 100644 --- a/contribs/drt/src/main/java/org/matsim/contrib/drt/analysis/zonal/DrtZonalWaitTimesAnalyzer.java +++ b/contribs/drt/src/main/java/org/matsim/contrib/drt/analysis/zonal/DrtZonalWaitTimesAnalyzer.java @@ -24,13 +24,7 @@ import java.io.IOException; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Locale; -import java.util.Map; -import java.util.SortedSet; -import java.util.TreeSet; +import java.util.*; import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; import org.apache.logging.log4j.LogManager; @@ -159,10 +153,12 @@ private Map createZonalStats() { public void notifyShutdown(ShutdownEvent event) { String crs = event.getServices().getConfig().global().getCoordinateSystem(); Collection features = convertGeometriesToSimpleFeatures(crs); - String fileName = event.getServices() + if(!features.isEmpty()) { + String fileName = event.getServices() .getControlerIO() - .getOutputFilename("drt_waitStats" + "_" + drtCfg.getMode() + "_zonal.shp"); - GeoFileWriter.writeGeometries(features, fileName); + .getOutputFilename("drt_waitStats" + "_" + drtCfg.getMode() + "_zonal.gpkg"); + GeoFileWriter.writeGeometries(features, fileName); + } } private Collection convertGeometriesToSimpleFeatures(String targetCoordinateSystem) { @@ -172,9 +168,10 @@ private Collection convertGeometriesToSimpleFeatures(String targe } catch (IllegalArgumentException e) { log.warn("Coordinate reference system \"" + targetCoordinateSystem - + "\" is unknown. Please set a crs in config global. Will try to create drt_waitStats_" + + "\" is unknown. Please set a crs in config global. Will not create drt_waitStats_" + drtCfg.getMode() - + "_zonal.shp anyway."); + + "_zonal.gpkg."); + return Collections.emptyList(); } simpleFeatureBuilder.setName("drtZoneFeature");