org.matsim.core.utils.geometry.transformations.IdentityTransformation Java Examples

The following examples show how to use org.matsim.core.utils.geometry.transformations.IdentityTransformation. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OsmMultimodalNetworkConverter.java    From pt2matsim with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Converts the OSM data according to the parameters defined in config.
 */
public void convert(OsmConverterConfigGroup config) {
	this.config = config;
	this.geometryExporter = new LinkGeometryExporter();
	CoordinateTransformation transformation = (config.getOutputCoordinateSystem() == null ?
			new IdentityTransformation() :
			TransformationFactory.getCoordinateTransformation(TransformationFactory.WGS84, config.getOutputCoordinateSystem()));

	initPT();
	readWayParams();
	convertToNetwork(transformation);
	cleanNetwork();
	if(config.getKeepTagsAsAttributes()) addAttributes();

	if (this.config.getOutputDetailedLinkGeometryFile() != null) {
		try {
			geometryExporter.onlyKeepGeometryForTheseLinks(network.getLinks().keySet());
			geometryExporter.writeToFile(Paths.get(this.config.getOutputDetailedLinkGeometryFile()));
		} catch (IOException e) {
			log.warn("Error while writing network geometry", e);
			e.printStackTrace();
		}
	}
}
 
Example #2
Source File: Osm2TransitSchedule.java    From pt2matsim with GNU General Public License v2.0 5 votes vote down vote up
public static void run(String osmFile, String outputScheduleFile, String outputCoordinateSystem) {
	TransitSchedule schedule = ScheduleTools.createSchedule();
	CoordinateTransformation ct = outputCoordinateSystem != null ? TransformationFactory.getCoordinateTransformation("WGS84", outputCoordinateSystem) : new IdentityTransformation();

	// load osm file
	OsmData osmData = new OsmDataImpl();
	new OsmFileReader(osmData).readFile(osmFile);

	// convert osm data
	new OsmTransitScheduleConverter(osmData).convert(schedule, ct);

	// write file
	ScheduleTools.writeTransitSchedule(schedule, outputScheduleFile);
}
 
Example #3
Source File: Network2Geojson.java    From pt2matsim with GNU General Public License v2.0 5 votes vote down vote up
public Network2Geojson(String networkCoordSystem, Network network) {
	this.ct = networkCoordSystem == null ? new IdentityTransformation() : TransformationFactory.getCoordinateTransformation(networkCoordSystem, TransformationFactory.WGS84);
	this.network = network;
	convertLinks();
	convertNodes();
	combineFeatures();
}
 
Example #4
Source File: Schedule2Geojson.java    From pt2matsim with GNU General Public License v2.0 5 votes vote down vote up
public Schedule2Geojson(String originalCoordRefSys, final TransitSchedule schedule) {
	this.ct = originalCoordRefSys == null ? new IdentityTransformation() : TransformationFactory.getCoordinateTransformation(originalCoordRefSys, TransformationFactory.WGS84);
	this.schedule = schedule;
	this.network = null;

	convertTransitRoutes(false);
	convertStopFacilities();
	combineFeatures();
}
 
Example #5
Source File: Schedule2Geojson.java    From pt2matsim with GNU General Public License v2.0 5 votes vote down vote up
public Schedule2Geojson(String originalCoordRefSys, final TransitSchedule schedule, final Network network) {
	this.ct = originalCoordRefSys == null ? new IdentityTransformation() : TransformationFactory.getCoordinateTransformation(originalCoordRefSys, TransformationFactory.WGS84);
	this.schedule = schedule;
	this.network = network;

	convertTransitRoutes(network != null);
	convertStopFacilities();
	combineFeatures();
}
 
Example #6
Source File: Hafas2TransitSchedule.java    From pt2matsim with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Converts all files in <tt>hafasFolder</tt> and writes the output schedule and vehicles to the respective
 * files. Stop Facility coordinates are transformed from WGS84 to <tt>outputCoordinateSystem</tt>.
 */
public static void run(String hafasFolder, String outputCoordinateSystem, String outputScheduleFile, String outputVehicleFile, String chosenDateString) throws IOException {
	TransitSchedule schedule = ScheduleTools.createSchedule();
	Vehicles vehicles = VehicleUtils.createVehiclesContainer();
	CoordinateTransformation transformation = !outputCoordinateSystem.equals("null") ?
			TransformationFactory.getCoordinateTransformation("WGS84", outputCoordinateSystem) : new IdentityTransformation();

	HafasConverter.run(hafasFolder, schedule, transformation, vehicles, chosenDateString);

	ScheduleTools.writeTransitSchedule(schedule, outputScheduleFile);
	ScheduleTools.writeVehicles(vehicles, outputVehicleFile);
}