Skip to content

Commit

Permalink
update geotools import statements
Browse files Browse the repository at this point in the history
  • Loading branch information
nkuehnel committed May 16, 2024
1 parent 6fdb72b commit 10bacf5
Show file tree
Hide file tree
Showing 74 changed files with 152 additions and 158 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

package org.matsim.contrib.emissions;

import org.geotools.metadata.iso.quality.TemporalAccuracyImpl;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.params.ParameterizedTest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.apache.commons.math3.analysis.interpolation.PiecewiseBicubicSplineInterpolatingFunction;
import org.apache.commons.math3.analysis.interpolation.PiecewiseBicubicSplineInterpolator;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.matsim.api.core.v01.network.Link;
import org.matsim.contrib.ev.EvUnits;
import org.matsim.contrib.ev.fleet.ElectricVehicle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.geotools.api.feature.simple.SimpleFeature;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.GeometryFactory;
Expand All @@ -49,7 +50,6 @@
import org.matsim.pt.transitSchedule.TransitScheduleFactoryImpl;
import org.matsim.pt.transitSchedule.api.TransitSchedule;
import org.matsim.pt.transitSchedule.api.TransitStopFacility;
import org.opengis.feature.simple.SimpleFeature;

/**
* Create one TransitStopFacility for each car mode link of the network
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.geotools.api.feature.simple.SimpleFeature;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.GeometryFactory;
Expand Down Expand Up @@ -60,7 +61,6 @@
import org.matsim.pt.transitSchedule.TransitScheduleFactoryImpl;
import org.matsim.pt.transitSchedule.api.TransitSchedule;
import org.matsim.pt.transitSchedule.api.TransitStopFacility;
import org.opengis.feature.simple.SimpleFeature;

/**
* Create one TransitStopFacility for each car mode link of the network
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package org.matsim.contrib.noise;

import org.opengis.geometry.DirectPosition;

import org.geotools.api.geometry.Position;

public interface DEMContext {

/**
* Returns the elevation at the given position.
*/
float getElevation(DirectPosition position);
float getElevation(Position position);

}
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package org.matsim.contrib.noise;

import org.geotools.api.geometry.Position;
import org.geotools.coverage.grid.GridCoverage2D;
import org.geotools.gce.geotiff.GeoTiffReader;
import org.geotools.util.factory.Hints;
import org.locationtech.jts.geom.Point;
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
import org.opengis.geometry.DirectPosition;

import jakarta.inject.Inject;
import java.io.File;
Expand Down Expand Up @@ -33,8 +34,8 @@ public class DEMContextImpl implements DEMContext {
}

@Override
public float getElevation(DirectPosition position) {
float[] sample = (float[])coverage.evaluate(position);
public float getElevation(Position point) {
float[] sample = (float[])coverage.evaluate(point);
return sample[0];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.geotools.api.feature.simple.SimpleFeature;
import org.geotools.api.referencing.FactoryException;
import org.geotools.api.referencing.crs.CoordinateReferenceSystem;
import org.geotools.api.referencing.operation.MathTransform;
import org.geotools.api.referencing.operation.TransformException;
import org.geotools.feature.FeatureCollection;
import org.geotools.feature.FeatureIterator;
import org.geotools.geojson.GeoJSONUtil;
Expand All @@ -16,11 +21,6 @@
import org.locationtech.jts.geom.*;
import org.matsim.api.core.v01.Id;
import org.matsim.core.utils.misc.Counter;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.referencing.FactoryException;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.TransformException;

/**
* @author nkuehnel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

import com.google.common.collect.Range;
import com.google.inject.Inject;
import org.geotools.geometry.DirectPosition2D;
import org.geotools.api.geometry.Position;
import org.geotools.api.referencing.FactoryException;
import org.geotools.api.referencing.crs.CoordinateReferenceSystem;
import org.geotools.geometry.Position2D;
import org.geotools.referencing.CRS;
import org.matsim.api.core.v01.Coord;
import org.matsim.api.core.v01.Scenario;
import org.matsim.api.core.v01.network.Link;
import org.matsim.api.core.v01.network.Network;
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
import org.opengis.geometry.DirectPosition;
import org.opengis.referencing.FactoryException;
import org.opengis.referencing.crs.CoordinateReferenceSystem;

import static org.matsim.contrib.noise.RLS19VehicleType.*;

Expand Down Expand Up @@ -164,8 +164,8 @@ public double calculateSingleVehicleLevel(NoiseVehicleType type, NoiseLink noise
Coord to = matsimLink.getToNode().getCoord();

//MATSim coord's x/y are inversed to geotools/jts
DirectPosition positionFrom = new DirectPosition2D(crs, from.getY(), from.getX());
DirectPosition positionTo = new DirectPosition2D(crs, to.getY(), to.getX());
Position positionFrom = new Position2D(crs, from.getY(), from.getX());
Position positionTo = new Position2D(crs, to.getY(), to.getX());

float elevationFrom = demContext.getElevation(positionFrom);
float elevationTo = demContext.getElevation(positionTo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
import java.util.ArrayList;
import java.util.List;

import org.geotools.api.data.SimpleFeatureSource;
import org.geotools.api.feature.simple.SimpleFeature;
import org.geotools.data.simple.SimpleFeatureIterator;
import org.geotools.data.simple.SimpleFeatureSource;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.GeometryFactory;
Expand All @@ -34,7 +35,6 @@
import org.locationtech.jts.geom.MultiPolygon;
import org.locationtech.jts.geom.Point;
import org.locationtech.jts.geom.Polygon;
import org.opengis.feature.simple.SimpleFeature;

import com.jogamp.opengl.GL;
import com.jogamp.opengl.GL2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
import java.util.List;
import java.util.Map;

import org.geotools.api.feature.simple.SimpleFeature;
import org.locationtech.jts.geom.Geometry;
import org.matsim.api.core.v01.population.Activity;
import org.matsim.api.core.v01.population.Leg;
import org.matsim.api.core.v01.population.Person;
import org.matsim.api.core.v01.population.PlanElement;
import org.matsim.core.population.algorithms.AbstractPersonAlgorithm;
import org.matsim.core.utils.geometry.geotools.MGC;
import org.opengis.feature.simple.SimpleFeature;

import gnu.trove.map.TObjectIntMap;
import gnu.trove.map.hash.TObjectIntHashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
import java.nio.file.Paths;
import java.util.Collection;

import org.geotools.api.feature.simple.SimpleFeature;
import org.matsim.contrib.parking.parkingproxy.analysis.RegionModeshareAnalyzer;
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.population.io.StreamingPopulationReader;
import org.matsim.core.scenario.ScenarioUtils;
import org.matsim.core.utils.gis.GeoFileReader;
import org.opengis.feature.simple.SimpleFeature;

public class RunAreaAnalysis {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import java.util.function.ToDoubleFunction;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.geotools.api.feature.simple.SimpleFeature;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Envelope;
import org.locationtech.jts.geom.Geometry;
Expand Down Expand Up @@ -80,7 +81,6 @@
import org.matsim.pt.transitSchedule.api.TransitLine;
import org.matsim.pt.transitSchedule.api.TransitRoute;
import org.matsim.pt.transitSchedule.api.TransitScheduleReader;
import org.opengis.feature.simple.SimpleFeature;

/**
* Main class to calculate skim matrices. Provides a main-method to be directly started from the command line, but the main-method also acts as a template for custom code using the skims calculation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
import java.util.Map;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.geotools.api.feature.simple.SimpleFeature;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.Point;
import org.matsim.core.utils.gis.GeoFileReader;
import org.matsim.core.utils.io.IOUtils;
import org.opengis.feature.simple.SimpleFeature;

/**
* Creates a huge csv file with the data of all the matrices combined. Zones are identified by their identifier as well as one random coordinate per zone. Given the from-/to-coordinates for each
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import java.util.ArrayList;
import java.util.Collection;

import org.geotools.api.feature.simple.SimpleFeature;
import org.geotools.api.referencing.crs.CoordinateReferenceSystem;
import org.locationtech.jts.geom.Coordinate;
import org.matsim.api.core.v01.network.Link;
import org.matsim.api.core.v01.network.Network;
Expand All @@ -17,8 +19,6 @@
import org.matsim.core.utils.geometry.geotools.MGC;
import org.matsim.core.utils.gis.PointFeatureFactory;
import org.matsim.core.utils.gis.GeoFileWriter;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.referencing.crs.CoordinateReferenceSystem;

public class WriteStationShapefile {
static public void main(String[] args) throws ConfigurationException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.geotools.api.feature.simple.SimpleFeature;
import org.matsim.api.core.v01.Scenario;
import org.matsim.core.api.experimental.events.EventsManager;
import org.matsim.core.events.EventsReaderXMLv1;
import org.matsim.core.events.EventsUtils;
import org.matsim.core.events.handler.EventHandler;
import org.matsim.core.gbl.Gbl;
import org.opengis.feature.simple.SimpleFeature;

import playground.vsp.analysis.modules.AbstractAnalysisModule;
import playground.vsp.analysis.modules.legModeDistanceDistribution.LegModeDistanceDistribution;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.geotools.api.feature.simple.SimpleFeature;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.GeometryFactory;
import org.matsim.api.core.v01.Id;
Expand All @@ -36,7 +37,6 @@
import org.matsim.core.utils.geometry.geotools.MGC;
import org.matsim.core.utils.gis.PointFeatureFactory;
import org.matsim.core.utils.gis.GeoFileWriter;
import org.opengis.feature.simple.SimpleFeature;

import playground.vsp.analysis.modules.AbstractAnalysisModule;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.geotools.api.feature.simple.SimpleFeature;
import org.geotools.feature.simple.SimpleFeatureBuilder;
import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
import org.locationtech.jts.geom.Coordinate;
Expand Down Expand Up @@ -44,7 +45,6 @@
import org.matsim.core.scenario.ScenarioUtils;
import org.matsim.core.utils.geometry.geotools.MGC;
import org.matsim.core.utils.gis.GeoFileWriter;
import org.opengis.feature.simple.SimpleFeature;

import playground.vsp.analysis.modules.AbstractAnalysisModule;
import playground.vsp.analysis.modules.networkAnalysis.utils.AccessibilityCalc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.geotools.api.feature.simple.SimpleFeature;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.MultiPolygon;
import org.matsim.api.core.v01.Coord;
import org.matsim.core.utils.geometry.geotools.MGC;
import org.matsim.core.utils.gis.PointFeatureFactory;
import org.matsim.core.utils.gis.PolygonFeatureFactory;
import org.matsim.core.utils.gis.GeoFileWriter;
import org.opengis.feature.simple.SimpleFeature;

import playground.vsp.analysis.modules.ptAccessibility.activity.ActivityLocation;
import playground.vsp.analysis.modules.ptAccessibility.activity.LocationMap;
Expand All @@ -59,7 +59,7 @@ public static void writeMultiPolygons(Map<String, MultiPolygon> mps, String file
setName(name).
addAttribute("name", String.class).
create();
Collection<SimpleFeature> features = new ArrayList<SimpleFeature>();
Collection<SimpleFeature> features = new ArrayList<>();

Object[] featureAttribs;
for(Entry<String, MultiPolygon> e: mps.entrySet()){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
import java.util.Map.Entry;
import java.util.ServiceConfigurationError;

import org.geotools.api.feature.simple.SimpleFeature;
import org.geotools.feature.simple.SimpleFeatureBuilder;
import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.MultiPolygon;
import org.matsim.core.utils.geometry.geotools.MGC;
import org.matsim.core.utils.gis.GeoFileWriter;
import org.opengis.feature.simple.SimpleFeature;

import playground.vsp.analysis.modules.ptAccessibility.stops.PtStopMap;

Expand Down Expand Up @@ -135,7 +135,7 @@ private static void writeGeometries(String outputFolderAndFileName, HashMap<Inte
Object[] bufferFeatureAttribs;

for (Entry<Integer, HashMap<String, Geometry>> distance2mode2bufferEntry : distance2mode2buffer.entrySet()) {
bufferFeatures = new ArrayList<SimpleFeature>();
bufferFeatures = new ArrayList<>();
HashMap<String, Geometry> mode2buffer = distance2mode2bufferEntry.getValue();
for (Entry<String, Geometry> mode2BufferEntry : mode2buffer.entrySet()) {
bufferFeatureAttribs = new Object[2];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.Map.Entry;
import java.util.ServiceConfigurationError;

import org.geotools.api.feature.simple.SimpleFeature;
import org.geotools.feature.simple.SimpleFeatureBuilder;
import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
import org.locationtech.jts.geom.Coordinate;
Expand All @@ -39,7 +40,6 @@
import org.matsim.core.utils.geometry.geotools.MGC;
import org.matsim.core.utils.gis.GeoFileWriter;
import org.matsim.pt.transitSchedule.api.TransitLine;
import org.opengis.feature.simple.SimpleFeature;

import playground.vsp.analysis.modules.AbstractAnalysisModule;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.geotools.api.feature.simple.SimpleFeature;
import org.geotools.feature.simple.SimpleFeatureBuilder;
import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
import org.locationtech.jts.geom.Coordinate;
Expand All @@ -43,7 +44,6 @@
import org.matsim.pt.transitSchedule.api.TransitLine;
import org.matsim.pt.transitSchedule.api.TransitRoute;
import org.matsim.pt.transitSchedule.api.TransitSchedule;
import org.opengis.feature.simple.SimpleFeature;

import playground.vsp.analysis.modules.AbstractAnalysisModule;

Expand Down Expand Up @@ -82,7 +82,7 @@ public void postProcessData() {

@Override
public void writeResults(String outputFolder) {
Collection<SimpleFeature> features = new ArrayList<SimpleFeature>();
Collection<SimpleFeature> features = new ArrayList<>();
// write a shape per line
for(TransitLine transitLine: this.schedule.getTransitLines().values()){
if(transitLine.getRoutes().isEmpty()){
Expand Down
Loading

0 comments on commit 10bacf5

Please sign in to comment.