/** * Creates a new reader for MATSim facilities files. * Converts the coordinates to the target CRS, given the CRS information in the container attributes, or, if absent, * from the config. * * @param targetCRS the CRS the coordinates should be expressed in * @param scenario The scenario containing the Facilities-object to store the facilities in. */ public MatsimFacilitiesReader( final String targetCRS, final Scenario scenario) { this(scenario.getConfig().facilities().getInputCRS(), targetCRS, scenario.getActivityFacilities()); }
private void dumpFacilities() { // dump facilities try { final String inputCRS = config.facilities().getInputCRS(); final String internalCRS = config.global().getCoordinateSystem(); new FacilitiesWriter(activityFacilities).write(controlerIO.getOutputFilename(Controler.OUTPUT_PREFIX + Controler.FILENAME_FACILITIES)); } catch ( Exception ee ) { log.error("Exception writing facilities.", ee); } }
private void loadActivityFacilities() { if ((this.config.facilities() != null) && (this.config.facilities().getInputFile() != null)) { URL facilitiesFileName = this.config.facilities().getInputFileURL(config.getContext()); log.info("loading facilities from " + facilitiesFileName); final String inputCRS = config.facilities().getInputCRS(); final String internalCRS = config.global().getCoordinateSystem(); MatsimFacilitiesReader reader = new MatsimFacilitiesReader(inputCRS, internalCRS, this.scenario.getActivityFacilities()); reader.putAttributeConverters(attributeConverters); reader.parse(facilitiesFileName); log.info("loaded " + this.scenario.getActivityFacilities().getFacilities().size() + " facilities from " + facilitiesFileName); } else { log.info("no facilities file set in config, therefore not loading any facilities. This is not a problem except if you are using facilities"); } if ((this.config.facilities() != null) && (this.config.facilities().getInputFacilitiesAttributesFile() != null)) { URL facilitiesAttributesURL = ConfigGroup.getInputFileURL(this.config.getContext(), this.config.facilities().getInputFacilitiesAttributesFile()); log.info("loading facility attributes from " + facilitiesAttributesURL); ObjectAttributesXmlReader reader = new ObjectAttributesXmlReader(this.scenario.getActivityFacilities().getFacilityAttributes()); reader.putAttributeConverters( attributeConverters ); reader.parse(facilitiesAttributesURL); } else { log.info("no facility-attributes file set in config, not loading any facility attributes"); } }