diff --git a/contribs/application/src/main/java/org/matsim/application/prepare/network/CreateAvroNetwork.java b/contribs/application/src/main/java/org/matsim/application/prepare/network/CreateAvroNetwork.java index 435bd602ea5..6c9d7f1b59c 100644 --- a/contribs/application/src/main/java/org/matsim/application/prepare/network/CreateAvroNetwork.java +++ b/contribs/application/src/main/java/org/matsim/application/prepare/network/CreateAvroNetwork.java @@ -12,8 +12,6 @@ import org.apache.avro.file.DataFileWriter; import org.apache.avro.generic.GenericData; import org.apache.avro.generic.GenericDatumWriter; -import org.apache.avro.io.DatumWriter; -import org.apache.avro.specific.SpecificDatumWriter; import org.apache.commons.lang3.mutable.MutableObject; import org.locationtech.jts.geom.Geometry; import org.matsim.api.core.v01.Coord; diff --git a/contribs/application/src/main/java/org/matsim/application/prepare/network/CreateGeoJsonNetwork.java b/contribs/application/src/main/java/org/matsim/application/prepare/network/CreateGeoJsonNetwork.java index 42eb4408fe9..526cd8d36be 100644 --- a/contribs/application/src/main/java/org/matsim/application/prepare/network/CreateGeoJsonNetwork.java +++ b/contribs/application/src/main/java/org/matsim/application/prepare/network/CreateGeoJsonNetwork.java @@ -29,6 +29,9 @@ import java.util.regex.Pattern; +/** + * Note that {@link CreateAvroNetwork} offers a more efficient way to store network data, which also loads much faster in the browser. + */ @CommandLine.Command(name = "network-geojson", description = "Create geojson representation of a network.") @CommandSpec(requireNetwork = true, produces = "network.geojson") public class CreateGeoJsonNetwork implements MATSimAppCommand { diff --git a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/EmissionsDashboard.java b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/EmissionsDashboard.java index 47cd26183e4..ccc565a5ddc 100644 --- a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/EmissionsDashboard.java +++ b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/EmissionsDashboard.java @@ -39,6 +39,8 @@ public void configure(Header header, Layout layout) { viz.height = 12.; // viz.datasets.csvFile = data.compute(AirPollutionAnalysis.class, "emissions_per_link_per_m.csv"); viz.datasets.csvFile = data.computeWithPlaceholder(AirPollutionAnalysis.class, "emissions_per_link_per_m.%s", "csv"); + + // TODO: switch this class to use map plot and avro network viz.network = data.compute(CreateGeoJsonNetwork.class, "network.geojson"); viz.display.color.columnName = "CO2_TOTAL [g/m]"; viz.display.color.dataset = "csvFile"; diff --git a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/NoiseDashboard.java b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/NoiseDashboard.java index 2d2f3a5070b..dc934e6c2e2 100644 --- a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/NoiseDashboard.java +++ b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/NoiseDashboard.java @@ -1,7 +1,7 @@ package org.matsim.simwrapper.dashboard; import org.matsim.application.analysis.noise.NoiseAnalysis; -import org.matsim.application.prepare.network.CreateGeoJsonNetwork; +import org.matsim.application.prepare.network.CreateAvroNetwork; import org.matsim.simwrapper.Dashboard; import org.matsim.simwrapper.Header; import org.matsim.simwrapper.Layout; @@ -53,7 +53,7 @@ public void configure(Header header, Layout layout) { viz.zoom = data.context().mapZoomLevel; viz.minValue = minDb; viz.maxValue = maxDb; - viz.setShape(data.compute(CreateGeoJsonNetwork.class, "network.geojson", "--with-properties"), "id"); + viz.setShape(data.compute(CreateAvroNetwork.class, "network.avro", "--with-properties"), "id"); viz.addDataset("noise", data.compute(NoiseAnalysis.class, "emission_per_day.csv")); viz.display.lineColor.dataset = "noise"; viz.display.lineColor.columnName = "value"; diff --git a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/OverviewDashboard.java b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/OverviewDashboard.java index 4c0f2187c1a..6bf9d4c2ae6 100644 --- a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/OverviewDashboard.java +++ b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/OverviewDashboard.java @@ -3,7 +3,6 @@ import org.matsim.application.analysis.LogFileAnalysis; import org.matsim.application.analysis.traffic.TrafficAnalysis; import org.matsim.application.prepare.network.CreateAvroNetwork; -import org.matsim.application.prepare.network.CreateGeoJsonNetwork; import org.matsim.simwrapper.Dashboard; import org.matsim.simwrapper.Header; import org.matsim.simwrapper.Layout; @@ -36,8 +35,7 @@ public void configure(Header header, Layout layout) { viz.height = 7.5; viz.width = 2.0; -// viz.setShape(data.compute(CreateAvroNetwork.class, "network.avro", "--with-properties"), "id"); - viz.setShape(data.compute(CreateGeoJsonNetwork.class, "network.geojson", "--with-properties"), "id"); + viz.setShape(data.compute(CreateAvroNetwork.class, "network.avro", "--with-properties"), "id"); viz.addDataset("traffic", data.compute(TrafficAnalysis.class, "traffic_stats_by_link_daily.csv")); viz.display.lineColor.dataset = "traffic"; diff --git a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/TrafficCountsDashboard.java b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/TrafficCountsDashboard.java index 644f8fab8f4..2bd83f1baba 100644 --- a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/TrafficCountsDashboard.java +++ b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/TrafficCountsDashboard.java @@ -2,7 +2,7 @@ import org.apache.commons.lang.StringUtils; import org.matsim.application.analysis.traffic.CountComparisonAnalysis; -import org.matsim.application.prepare.network.CreateGeoJsonNetwork; +import org.matsim.application.prepare.network.CreateAvroNetwork; import org.matsim.simwrapper.Dashboard; import org.matsim.simwrapper.Header; import org.matsim.simwrapper.Layout; @@ -212,7 +212,7 @@ private void createTab(Layout layout, List argList, String tabName, Set< viz.title = "Relative traffic volumes"; viz.height = 8.0; - viz.setShape(data.withDefaultContext().compute(CreateGeoJsonNetwork.class, "network.geojson", "--with-properties"), "id"); + viz.setShape(data.withDefaultContext().compute(CreateAvroNetwork.class, "network.avro", "--with-properties"), "id"); viz.addDataset("counts", data.compute(CountComparisonAnalysis.class, "count_comparison_daily.csv", args)); viz.center = data.withDefaultContext().context().getCenter(); diff --git a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/TrafficDashboard.java b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/TrafficDashboard.java index 746c3e033ed..1c56e998229 100644 --- a/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/TrafficDashboard.java +++ b/contribs/simwrapper/src/main/java/org/matsim/simwrapper/dashboard/TrafficDashboard.java @@ -2,7 +2,7 @@ import org.matsim.api.core.v01.TransportMode; import org.matsim.application.analysis.traffic.TrafficAnalysis; -import org.matsim.application.prepare.network.CreateGeoJsonNetwork; +import org.matsim.application.prepare.network.CreateAvroNetwork; import org.matsim.simwrapper.Dashboard; import org.matsim.simwrapper.Header; import org.matsim.simwrapper.Layout; @@ -76,7 +76,7 @@ public void configure(Header header, Layout layout) { viz.center = data.context().getCenter(); viz.zoom = data.context().mapZoomLevel; - viz.setShape(data.compute(CreateGeoJsonNetwork.class, "network.geojson"), "id"); + viz.setShape(data.compute(CreateAvroNetwork.class, "network.avro"), "id"); viz.addDataset("traffic", data.compute(TrafficAnalysis.class, "traffic_stats_by_link_daily.csv"));