parseWorldFile static method

List<double>? parseWorldFile(
  1. String imagePath,
  2. int width,
  3. int height
)

Implementation

static List<double>? parseWorldFile(String imagePath, int width, int height) {
  var worldFile = getWorldFile(imagePath);
  if (worldFile == null) {
    return null;
  }
  var tfwList = readFileToList(worldFile);
  var xRes = double.parse(tfwList[0]);
  var yRes = -double.parse(tfwList[3]);
  var xExtent = width * xRes;
  var yExtent = height * yRes;

  var west = double.parse(tfwList[4]) - xRes / 2.0;
  var north = double.parse(tfwList[5]) + yRes / 2.0;
  var east = west + xExtent;
  var south = north - yExtent;
  return <double>[west, east, south, north, xRes, yRes];
}