use of uk.me.parabola.mkgmap.general.LoadableMapDataSource in project mkgmap by openstreetmap.
the class MapMaker method makeMap.
public String makeMap(CommandArgs args, String filename) {
try {
LoadableMapDataSource src = loadFromFile(args, filename);
sort = args.getSort();
if (createOverviewFiles) {
if (src.overviewMapLevels() != null) {
makeMap(args, src, OverviewBuilder.OVERVIEW_PREFIX);
} else {
String fname = OverviewBuilder.getOverviewImgName(args.getMapname());
File f = new File(fname);
if (f.exists()) {
if (f.isFile())
f.delete();
else {
// TODO: error message ?
}
}
}
}
return makeMap(args, src, "");
} catch (FormatException e) {
System.err.println("Bad file format: " + filename);
System.err.println(e.getMessage());
return filename;
} catch (FileNotFoundException e) {
System.err.println("Could not open file: " + filename);
return filename;
}
}
use of uk.me.parabola.mkgmap.general.LoadableMapDataSource in project mkgmap by openstreetmap.
the class MapMaker method loadFromFile.
/**
* Load up from the file. It is not necessary for the map reader to completely
* read the whole file in at once, it could pull in map-features as needed.
*
* @param args The user supplied parameters.
* @param name The filename or resource name to be read.
* @return A LoadableMapDataSource that will be used to construct the map.
* @throws FileNotFoundException For non existing files.
* @throws FormatException When the file format is not valid.
*/
private LoadableMapDataSource loadFromFile(CommandArgs args, String name) throws FileNotFoundException, FormatException {
LoadableMapDataSource src = MapReader.createMapReader(name);
src.config(args.getProperties());
log.info("Started loading", name);
src.load(name, args.getProperties().getProperty("transparent", false) == false);
log.info("Finished loading", name);
return src;
}
Aggregations