GXF (.gxf)

Background & Context

    • Raster format, also known as Grid eXchange File.
    • Standard ASCII file format for exchanging gridded data among different software systems.
    • Commonly used to represent gravity and geomagnetic data.
    • Grid point locations are related to a Grid Coordinate System (GCS), which can be related to a geographic reference system.
    • It saves raster data in the form of ASCII values.
    • Developed by Geosoft.


  • Import["file.gxf"] imports a GXF file and returns it as an image.
  • Import["file.gxf",elem] imports the specified element from a GXF file.
  • Import["file.gxf",{{elem1,elem2,}}] imports multiple elements.
  • The import format can be specified with Import["file","GXF"] or Import["file",{"GXF",elem,}].
  • See the following reference pages for full general information:
  • Importimport from a file
    CloudImportimport from a cloud object
    ImportStringimport from a string
    ImportByteArrayimport from a byte array

Import Elements

  • General Import elements:
  • "Elements"list of elements and options available in this file
    "Summary"summary of the file
    "Rules"list of rules for all available elements
  • Data representation elements for image formats:
  • "Data"array of color or elevation values
    "Graphics"image represented as a Graphics object
    "Image"image object
    "BitDepth"number of bits used to encode a color channel in the file
    "Channels"the number of color channels used in the file
    "Summary"summary of the file
  • Import by default uses the "Image" element for the GXF format.
  • Metadata elements:
  • "ColorSpace"color encoding used in the file
    "DataFormat"type used to represent elevation or color values
    "ElevationRange"range of elevation data in meters
    "MetaInformation"combination of all formatted metadata present in the file
    "RasterSize" size of the terrain grid
    "SpatialRange"range of geographic coordinates, given in coordinate system units
    "SpatialResolution"grid spacing in arc seconds
  • Elements representing the geodetic datum and reference ellipsoid used in the file:
  • "CoordinateSystem"name of the coordinate system used in the file
    "Datum"geodetic datum
    "SemimajorAxis"semimajor axis of the reference ellipsoid
    "SemiminorAxis"semiminor axis of the reference ellipsoid
    "InverseFlattening"inverse flattening of the ellipsoid
    "LinearUnits"coordinate system units
  • Elements specifying the cartographic projection and its parameters:
  • "Projection"projection name and parameters
    "Centering"latitude and longitude defining the origin of the projection
    "StandardParallels"standard parallels
    "CentralScaleFactor"scale factor at the central meridian or center of projection
    "GridOrigin"grid coordinates {n,e} of the central parallel and meridian
    "ProjectionName"Wolfram Language standard name of the projection used
    "ReferenceModel"what reference sphere or ellipsoid to use
  • Accessing low-level metainformation from the file:
  • "CoordinateSystemInformation"raw parameters of the coordinate system as stored in the file
  • See the reference page for GeoProjectionData for full information on cartographic projections.



open allclose all

Basic Examples  (2)

Import a GXF file as an image:

Summary of an image:

Import Elements  (29)

Available Elements  (1)

List of available elements:

Data Representation  (7)

"Data"  (1)

Get the raw image data:

Show some data values:

Use the image data to create the image:

"Graphics"  (1)

Import as a Graphics object:

"Image"  (2)

Import as an Image object:

The default element is also "Image":

Import only the specified rows:

Import specified rows and columns:

"BitDepth"  (1)

Get the bit count for the representation of each color channel:

"Channels"  (1)

Get the number of image channels used:

"Summary"  (1)

Get the image summary:

Metadata  (7)

"ColorSpace"  (1)

Get the color encoding used:

"DataFormat"  (1)

Raster format corresponding to the imported data:

"ElevationRange"  (1)

Minimal and maximal elevation in meters of raster data, assuming it represents a digital elevation model:

"MetaInformation"  (1)

Get all the metadata:

"RasterSize"  (1)

Get the pixel dimensions of the raster:

"SpatialRange"  (1)

Get the coordinates of the corner points of each raster band in projected coordinates if there is a cartographic projection available or as longitude-latitude if there is not:

"SpatialAffineTransform"  (1)

Get an affine transformation transforming coordinates in the pixel space to coordinates in the cartographic reference system:

The origin of coordinates lies in the upper-left corner of the raster image, as can be explicitly checked:

Datum and Reference Ellipsoid  (6)

"CoordinateSystem"  (1)

Name of the cartographic coordinate system including the datum:

"Datum"  (1)

Name of the datum:

"SemimajorAxis"  (1)

Length of the semimajor axis of the datum's reference ellipsoid:

"SemiminorAxis"  (1)

Length of the semiminor axis of the datum's reference ellipsoid:

"InverseFlattening"  (1)

Inverse flattening of the datum's reference ellipsoid:

"LinearUnits"  (1)

Units of the cartographic coordinates:

Cartographic Projection  (7)

"Projection"  (1)

Name and parameters of the cartographic projection (if any):

"Centering"  (1)

Centering of the cartographic projection:

"StandardParallels"  (1)

Standard parallels of the cartographic projection, if any:

"CentralScaleFactor"  (1)

Central scale factor of the cartographic projection:

"GridOrigin"  (1)

Grid origin of the cartographic projection:

"ProjectionName"  (1)

Name of the cartographic projection:

"ReferenceModel"  (1)

Reference model of the cartographic projection:

Low-Level Metainformation  (1)

"CoordinateSystemInformation"  (1)

Information about the cartographic reference system using the WKT specification:

Import Options  (2)

"RasterBands"  (1)

GXF files usually have only one raster band:

Import the first raster band:

RasterSize  (1)

By default, the image is imported in its full resolution:

Specify the raster size of the imported GXF raster image: