Use the brush to select extent coordinates interactively.
The gdalwarp utility can crop the warped output image using the -te
argument, which specifies a geographic extent as xmin ymin xmax ymax coordinates in the target projection. For example, the extent -2030000 -1250000 -1300000 -40400 shown above encompasses California when using EPSG:2163, the U.S. National Atlas projection.
The trick to computing these coordinates is to know the scale of the underlying Lambert azimuthal equal-area projection: 6,370,997 meters, as shown in the human-readable projection definition. From there, it is possible to translate between pixel space and EPSG:2163 coordinates.
function te(projection) {
var radius = 6370997,
scale = projection.scale(),
rotate = projection.rotate(),
translate = projection.translate(),
offset = projection.rotate([0, 0]).translate([0, 0])([0, 0]);
projection.rotate(rotate).translate(translate);
return [
Math.round((-offset[0] - translate[0]) / scale * radius),
Math.round((offset[1] + translate[1] - height) / scale * radius),
Math.round((-offset[0] - translate[0] + width) / scale * radius),
Math.round((offset[1] + translate[1]) / scale * radius)
];
}