local globeIdentifier = asset.require("scene/solarsystem//planets/mars/mars").Mars.Identifier

local layer = {
  Identifier = "mola128_mola64_merge_90Nto90S_SimpleC_clon0",
  Name = [[MGS MOLA, Global DEM]],
  FilePath = asset.localResource("mola128_mola64_merge_90Nto90S_SimpleC_clon0.vrt"),
  Description = [[This data was acquired using the Mars Orbiter Laser Altimeter instrument aboard NASA’s Mars Global Surveyor spacecraft (MGS). MGS was launched on November 7, 1996 and arrived at Mars on September 11, 1997. It maintained a circular polar orbit, completing an orbital revolution every 117.65 minutes at an average altitude of 378 km (235 mi). Until November 2, 2006, MGS characterized and mapped Mars’ surface features, properties, topography, composition, and processes, as well as studied Mars’ weather and atmospheric structure. 

The DEM represents more than 600 million measurements gathered between 1999 and 2001, adjusted for consistency and converted to planetary radii. These have been converted to elevations above the areoid as determined from a Martian gravity field solution GMM-2B, truncated to degree and order 50, and oriented according to current standards. The average accuracy of each point is originally ~100 meters in horizontal position and ~1 meter in radius. However, the total elevation uncertainty is at least ±3 m due to the global error in the areoid (±1.8 meters) and regional uncertainties in its shape. This DEM is a blend of data obtained with a resolution of 128 pixels per degree and 64 pixels per degree. The majority of the surface is covered at the higher resolution 128 pixels per degree. In projection, these pixels are 463 meters in size at the equator. However, these higher resolution data are very sparse near the two poles (above 87° north and below 87° south latitude) because these areas were sampled by only a few off-nadir altimetry tracks. Gaps between tracks of 1–2 km are common, and some gaps of up to 12 km occur near the equator.This data was acquired using the Mars Orbiter Laser Altimeter instrument aboard NASA’s Mars Global Surveyor spacecraft (MGS). MGS was launched on November 7, 1996 and arrived at Mars on September 11, 1997. It maintained a circular polar orbit, completing an orbital revolution every 117.65 minutes at an average altitude of 378 km (235 mi). Until November 2, 2006, MGS characterized and mapped Mars’ surface features, properties, topography, composition, and processes, as well as studied Mars’ weather and atmospheric structure. 

The DEM represents more than 600 million measurements gathered between 1999 and 2001, adjusted for consistency and converted to planetary radii. These have been converted to elevations above the areoid as determined from a Martian gravity field solution GMM-2B, truncated to degree and order 50, and oriented according to current standards. The average accuracy of each point is originally ~100 meters in horizontal position and ~1 meter in radius. However, the total elevation uncertainty is at least ±3 m due to the global error in the areoid (±1.8 meters) and regional uncertainties in its shape. This DEM is a blend of data obtained with a resolution of 128 pixels per degree and 64 pixels per degree. The majority of the surface is covered at the higher resolution 128 pixels per degree. In projection, these pixels are 463 meters in size at the equator. However, these higher resolution data are very sparse near the two poles (above 87° north and below 87° south latitude) because these areas were sampled by only a few off-nadir altimetry tracks. Gaps between tracks of 1–2 km are common, and some gaps of up to 12 km occur near the equator.]]
}
  
asset.onInitialize(function()
  openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer)
end)
  
asset.onDeinitialize(function()
  openspace.globebrowsing.deleteLayer(globeIdentifier, "ColorLayers", layer.Identifier)
end)
  
asset.export("layer", layer)


asset.meta = {
  Name = [[MGS MOLA, Global DEM]],
  Version = "1.0",
  Author = "NASA/Treks",
  URL = "https://trek.nasa.gov/mars/#v=0.1&x=0&y=0&z=1&p=urn:ogc:def:crs:EPSG::104905&d=&l=mola128_mola64_merge_90Nto90S_SimpleC_clon0%2Ctrue%2C1&b=mars&e=-180.0%2C-90.0%2C180.0%2C90.0&sfv=&w=",
  License = "NASA/Treks",
  Description = [[MGS MOLA, Global DEM layer from NASA/Treks for Mars]]
}
