pnmmercator
Convert image to or from Mercator projection
TLDR
Convert a rectangular projection worldmap to Mercator projection
Convert a Mercator projection worldmap to rectangular projection
SYNOPSIS
pnmmercator [-lon0 longitude] [-lat0 latitude] [-scale scale] [-width width] [-height height] [-north] [-south] [pnmfile]
PARAMETERS
-lon0 longitude
Sets the longitude (in degrees) that maps to the horizontal center of the output image. Default is 0.
-lat0 latitude
Sets the latitude (in degrees) that maps to the vertical center of the output image. Default is 0.
-scale scale
Specifies the scale factor for the output image. Default is 1. The scale is the ratio of output pixels per degree at the equator.
-width width
Defines the width of the output image in pixels. Default is the input image's width.
-height height
Defines the height of the output image in pixels. Default is calculated to show the maximum possible vertical range without distortion for the given width and scale.
-north
Limits the output to the Northern Hemisphere only (0 to 90 degrees latitude). This option overrides both -lat0 and -height.
-south
Limits the output to the Southern Hemisphere only (-90 to 0 degrees latitude). This option also overrides -lat0 and -height.
pnmfile
Optional. The input PNM file to process. If omitted, pnmmercator
reads from standard input.
DESCRIPTION
pnmmercator
reads a PNM image, interpreting it as a cylindrical projection (a standard latitude/longitude map). It then applies the Mercator projection to this image. The input is assumed to cover the full Earth, from -180 to +180 degrees longitude and -90 to +90 degrees latitude. The command allows for centering the projection at specific longitudes and latitudes, scaling the output, and defining its dimensions. Due to the nature of the Mercator projection, which extends infinitely towards the poles, the output image is practically limited to a latitude range of approximately -85.05 to +85.05 degrees. This tool is particularly useful for reprojecting geographic imagery into a common web mapping projection.
CAVEATS
The input image is strictly assumed to be in a cylindrical projection (equirectangular).
The Mercator projection mathematically extends infinitely towards the poles; therefore, the output image is cropped to a practical latitude range (approximately -85.05 to +85.05 degrees).
Important: pnmmercator
is considered deprecated in the Netpbm suite. Users are encouraged to use the more general and powerful pnmremap
command for image remapping and projection tasks.
HISTORY
pnmmercator
is part of the extensive Netpbm suite of graphics utilities, which provides a comprehensive set of tools for manipulating graphic images in various formats. It was developed to address the specific need for reprojecting cylindrical maps into the Mercator projection.
Over time, with the introduction of more flexible and generic image remapping tools, pnmmercator
has been superseded. Its functionality is now largely absorbed and improved upon by the pnmremap
command, making pnmmercator
a legacy tool within the Netpbm collection.