Skip to content

Commit

Permalink
Merge branch 'master' into drtEstim
Browse files Browse the repository at this point in the history
  • Loading branch information
luchengqi7 authored Mar 12, 2024
2 parents a91270f + d36e5f8 commit 9d5e32b
Showing 1 changed file with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -159,10 +153,12 @@ private Map<String, DescriptiveStatistics> createZonalStats() {
public void notifyShutdown(ShutdownEvent event) {
String crs = event.getServices().getConfig().global().getCoordinateSystem();
Collection<SimpleFeature> 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<SimpleFeature> convertGeometriesToSimpleFeatures(String targetCoordinateSystem) {
Expand All @@ -172,9 +168,10 @@ private Collection<SimpleFeature> 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");
Expand Down

0 comments on commit 9d5e32b

Please sign in to comment.