API · C++ CLASSES · GCP

GCP

A ground-control point: a pixel/line in an image tied to a world coordinate. Collect several, fit a geotransform, and attach them to a dataset to georeference a raw image.

Usage

read a dataset's GCPs
const gcps = await Module.toArray(await ds.getGCPs());
for (const gcp of gcps) {
  console.log(
    await gcp.getPixel(), await gcp.getLine(),
    "maps to", await gcp.getX(), await gcp.getY(),
  );
}

Constructor

new GCP
// x, y, z = world coords; pixel, line = image coords; info, id optional
const gcp = new GCP(28.85, 41.12, 0, 0, 0, "", "");

new GCP(x, y, z, pixel, line, info, id), where info and id default to "".

Fields

ACCESSOR DESCRIPTION
getX() · getY() · getZ()double World coordinate; setters setX/setY/setZ(value).
getPixel() · getLine()double Image coordinate; setters setPixel/setLine(value).
getInfo() · getId()string Free-text info and id; setters setInfo/setId(value).

Fit a geotransform

Pass an array of GCPs to Gdal.gcpsToGeoTransform(gcps, geoTransform, approxOK), or attach them with ds.setGCPs(gcps, projection). The examples have a full georeferencing recipe.