A launch site’s elevation
Get a launch site’s elevation above sea level from Open-Meteo or a GeoTIFF of your own, so a flight starts in the right air.
This page covers two ways to get a launch site’s elevation, its altitude above sea level (the field elevation a club lists). The first looks it up from Open-Meteo, a free weather and terrain service. The answer is saved, so the same lookup works later with no network, on a field with no signal. The second reads it from an elevation file you have, a GeoTIFF (below).
The page is for anyone who needs a site’s height to start a flight at the right air pressure and
density. There’s no hpr command for either way yet: a Rust program calls the
library.
The example below shows the air 12.8% thinner over 1,400 m (4,593 ft). The recorded heights are whole meters; Open-Meteo doesn’t document its rounding. The tests replay two saved answers and never contact Open-Meteo. The live service was contacted by hand, over an encrypted (HTTPS) connection, to record them. So a change in Open-Meteo’s answers would show only when a program runs, as a refused answer.
Code:
- The online lookup is
hpr_net::elevation(API reference), written for the second launch-site increment. It needs thehprcrate’snetfeature. The choices are in the decision record on Open-Meteo’s elevation through the cache. - The file reader is
hpr_io::geotiff(API reference), written for the GeoTIFF increment. Thehprcrate re-exports it ashpr::hpr_io::geotiff, with no feature needed. The choices are in the decision record on a site’s height from a user’s GeoTIFF.
The weather over a site is on Launch-day weather, and the compass’s offset from true north on The magnetic field and declination.
What the simulator asks for
Open-Meteo’s elevation service (its documentation) takes a list of places, each a latitude and longitude in degrees. It answers one height for each, in the same order. The simulator asks for one place or up to 100 in one request, the service’s limit. Here’s a request recorded for the tests, for Spaceport America, the Dead Sea and a point in the open Atlantic:
| what | value |
|---|---|
| address | https://api.open-meteo.com/v1/elevation |
| the request’s places | ?latitude=32.99,31.5,0&longitude=-106.97,35.5,-30 |
| its answer | {"elevation":[1400.0, -427.0, 0.0]} |
| a saved answer stays fresh for | a year |
A request can name another server instead (ElevationRequest::endpoint), for a copy of
Open-Meteo you run yourself.
The simulator writes each coordinate to 5 decimal places, about 1 m (3.3 ft) on the ground. Your program keeps a place in radians and turns it back into degrees, which can change its last digits. The rounding allows for that: a place given to 8 decimals or fewer still finds its saved answer.
A saved answer is found again only by the same request: the same places, in the same order. If you look up three club fields in one request at home, a later lookup of one of them alone is a new request. Offline, that lookup fails. To use a site offline, look it up alone, or repeat the exact list you used before.
The terrain model
The heights come from the Copernicus DEM GLO-90, a digital elevation model (DEM): a grid of heights over the whole Earth. The European Union’s Copernicus program made it from radar satellites.
Its points are 3 seconds of arc apart north to south, about 93 m (305 ft). East to west they’re 93 m (305 ft) apart at the equator and 60 m (197 ft) at 50° of latitude. Further north and south the spacing widens in steps (product handbook, issue 5.0, Table 3, page 15). The model is a digital surface model: its heights include buildings and vegetation (the dataset’s readme).
Its stated accuracy is under 4 m (13 ft) for 90% of points (handbook, Table 1, page 10). That’s a mean over the world outside Antarctica and Greenland, and the makers warn it varies from place to place. Of the 16,363 tiles there, each about a degree across, 184 (1.1%) are worse than 10 m (33 ft). The handbook’s Table 12, page 31, prints 0.9%, but as a share of all tiles, Antarctica and Greenland included.
The ground doesn’t move, so a saved answer stays fresh for a year. Open-Meteo’s forecast for Spaceport America (Launch-day weather) gives the same ground height, 1,400 m (4,593 ft).
What the simulator refuses
The simulator refuses an answer with another number of heights than places asked for, or with a height that isn’t a number. It also refuses a height outside −1,000 m (−3,281 ft) to 9,000 m (29,528 ft). The lowest land, by the Dead Sea, lies a little over 400 m (1,312 ft) below sea level. The highest, Everest’s summit, is 8,849 m (29,032 ft) above it. So a height outside the simulator’s range is a broken answer, such as the value −32,768 that some terrain files use for “no data”.
An answer the simulator refuses is never saved, as on Online data and the cache. When Open-Meteo itself refuses a request, it answers with HTTP status 400 and a reason. The HTTP transport reports a failed fetch naming the status, without Open-Meteo’s reason. The simulator checks each place’s latitude and longitude before asking, so that’s rare.
What the height means
The height is above mean sea level. The model’s heights are measured from EGM2008, a worldwide model of the geoid. That’s the shape the sea’s surface would take if it were still, extended under the land (product handbook, section 1.2.1, page 13). A height above EGM2008 is the height above sea level the atmosphere is looked up by (Atmosphere: the height datum).
The sea has no tiles in the model and reads 0 m (0 ft), so a height of 0 can also mean “no data”. The Dead Sea reads −427 m (−1,401 ft): its surface when the radar satellites measured it, between December 2010 and January 2015 (handbook, page 30). The lake has fallen since.
A flight’s launch site takes its height above the WGS 84 ellipsoid instead (its ellipsoidal height). The two differ by the geoid undulation , the height of sea level above the ellipsoid there. Around the world, runs between about −107 m (−351 ft) and +86 m (+282 ft).
A geoid calculator gives for a place: GeographicLib’s GeoidEval gives EGM2008’s −23.85 m (−78.2 ft) at Spaceport America (32.99° N, 106.97° W). Then:
-
If you know , place the site with
Geodetic::from_degrees(latitude, longitude, H + N), where is the height from this page. Then give the flight’s environment withEnvironment::standard(site)?.with_geoid_undulation_m(N). At Spaceport America, = 1,400 m (4,593 ft) and = −23.85 m (−78.2 ft), so the site’s ellipsoidal height is 1,376.15 m (4,514.9 ft). -
If you don’t, place the site at and leave at 0, as the example below does. The atmosphere still sees the right height above sea level, so the air, the drag and the flight are right. The site’s place in space is off by . That offset moves gravity by about 3×10⁻⁴ m/s² per 100 m (328 ft), 0.003% (normal gravity’s height term).
A flight exported as KML keeps its heights above sea level, which stay right. The GeoJSON export’s heights are above the ellipsoid, and are off by .
An example
crates/hpr/examples/site_elevation.rs
looks up the three places above in one request. It makes these calls:
Client::new(transport, Cache::new(folder), Mode::Online)sets up the fetching. The transport is what fetches (Online data and the cache). A real program passeshpr_net::Http::new(), and keeps its saved answers inCache::platform_dir(), the system’s usual folder for them. This one never uses the network: a stand-in transport gives the answer recorded for the tests.ElevationRequest::new(places)says what to ask for. Thenelevation::fetch(&client, &request, now)fetches the heights and saves them;nowis the time, in seconds since 1 January 1970. Each height comes back with its place, asheight_msl_m, the height above mean sea level.- The same
elevation::fetcha day later, through a client inMode::Offlinewhose transport has no network, answers from the saved copy. Ussa76::standard().air(height)gives the standard atmosphere (the 1976 US Standard Atmosphere) at each height.Environment::standard(site)puts a flight’s start on the first place, Spaceport America.
Run it from a copy of the repository with
cargo run --example site_elevation -p fusionspace-hpr --features net. It prints:
Elevation data by Open-Meteo.com (CC BY 4.0), from the Copernicus DEM GLO-90. © DLR e.V. 2010-2014 and © Airbus Defence and Space GmbH 2014-2018 provided under COPERNICUS by the European Union and ESA; all rights reserved
first lookup: Fetched; offline a day later: Cached, the same heights: true
place lat (°) height (m) pressure (hPa) density / sea
Spaceport America, New Mexico 32.99 1400 856.02 0.872
the Dead Sea (its surface) 31.50 -427 1065.61 1.042
the open Atlantic 0.00 0 1013.25 1.000
A flight from Spaceport America, New Mexico starts 1400 m above sea level, at 856.02 hPa.
The first line is the credit Open-Meteo’s license and the terrain model’s ask for.
Show it wherever the height is shown. The column density / sea is the air’s density as a
fraction of sea level’s. Fetched and Cached say where an answer came from
(how long a copy stays fresh).
At Spaceport America’s 1,400 m (4,593 ft), the standard air is about 13% thinner than at sea level. So the drag at the same speed and drag coefficient is about 13% lower.
How it is checked
The tests in crates/hpr-net/tests/elevation.rs
replay two answers recorded from the service on 1 October 2026 (UTC). One is for Spaceport America
alone and one for the three places above. The tests read the expected heights from the recordings
themselves, not through the code being tested, and check that:
- a lookup gives each recorded height exactly, in order, each with the place asked for, and with the credit line;
- a second lookup online, inside the year, is answered from the saved copy without a fetch;
- offline, with a transport that fails the test if it’s ever called, the same lookup gives the same heights;
- that offline copy is still fresh an hour later and marked stale a year later;
- offline, a place never looked up is an error naming its address;
- an answer with no heights is refused and not saved, and a later good answer is saved;
- when an answer that isn’t JSON arrives after the year, that good copy comes back, marked stale with the reason;
- a saved copy the simulator would refuse, with a height of −32,768 m (−107,507 ft), is an error offline, naming the height;
- online, that copy is fetched again and replaced;
- a place turned into radians and back, which changes its last digits, finds its saved answer offline.
The code’s own tests check the address the simulator builds, for one place and three. They check that the address is the same after a trip through radians, for every longitude in steps of 0.01°. It’s the same, too, for 720,000 values given to 6 or 8 decimals, the 6-decimal ones all sitting on a rounding half step.
They check that the simulator refuses a request with no places, with 101, or with a bad server address. They check that it refuses a latitude or longitude out of range or not a number, and names the place, counting from 0. They also check the reader takes negative heights and the range’s edges, and refuses each kind of broken answer above.
What it leaves out
- A damaged answer or GeoTIFF gets an error, or a value from what was left, on the damage the tests try: each reader is tried on cut, changed and arbitrary bytes. Damaged files says what the tests cover and leave out.
- The command line has no elevation command yet, and
hpr simdoesn’t look a site up. A program calls the library and passes the height on. - There’s no geoid model. The height is above sea level, and turning it into a height above the ellipsoid needs the undulation , which you give (above).
- Nothing compares the model’s heights with surveyed ones. The 4 m (13 ft) is the makers’ statement.
- The height is a surface’s, not the ground’s. Over a tree line or buildings it can sit meters above the pad. For a pad cut out of forest, use a surveyed height.
- Each place gets one number: the model’s height there, at about 90 m (295 ft) spacing. A pad on a hill or beside a cliff can sit meters off it.
From an elevation file of your own
Most DEMs are published as GeoTIFF files: an image whose pixels are heights. Tags in the file say where on Earth each pixel lies (the OGC GeoTIFF Standard 1.1). The USGS publishes the United States this way, free and in the public domain, through its 3D Elevation Program:
- Its 1-arc-second tiles, with heights about 30 m (98 ft) apart, are what the simulator is tested on. Its 1/3- and 1/9-arc-second tiles use the same latitude and longitude grid, but none has been tried.
- Its 1 m (3.3 ft) files are on a map projection (UTM) and are refused. GDAL’s free
gdalwarptool converts them first. - Copernicus and NASA publish the world as GeoTIFFs too; no file of theirs has been tried.
Reading your own file
- Bring the reader in:
use hpr::hpr_io::geotiff::ElevationRaster;. - Read the whole file into memory:
let bytes = std::fs::read(path)?;. ElevationRaster::parse(&bytes)reads its tags.info()holds what they say: the size, the corner and pixel size in degrees, the CRS and the sample type. It also holds the scale and offset, the unit and whether the file states it (vertical_unit_stated), the vertical datum’s code (vertical_crs_epsg) and the nodata value.height_at(latitude_deg, longitude_deg), in degrees, givesResult<Option<f64>, GeoTiffError>:Ok(Some(height))in meters,Ok(None)where the file has no data, or an error from the table below.- For many places,
values_at(&[(lat, lon), …])reads them in one pass. It gives aVecwith oneResult<Option<f64>, GeoTiffError>per place, in order. Each is the raw stored value, not meters:info().meters(value)applies the scale, offset and unit.
The API reference shows the same steps as a short program that CI compiles and runs. The height is the value of the pixel the place falls in, as GDAL gives it. There’s no smoothing between pixels, so on a 1-arc-second grid it’s the ground within about 20 m (66 ft) of the site. A lookup decodes only the tile or strip of the file that holds the place, so it adds about one tile’s memory to the file’s.
| error | from | means |
|---|---|---|
Outside | a lookup | the place is off the file; the message names the file’s edges |
Location | a lookup | the latitude is past ±90° or a number is not finite |
Unsupported | parse | the file uses something HPR Sim doesn’t read (the table below); the message names it and, where there is one, the GDAL command that converts it |
Missing, Malformed | parse; rarely a lookup | the file lacks a tag a GeoTIFF needs, or holds one the standard doesn’t allow |
TooLarge | parse, values | a tile is larger than 256 MiB decoded; for values, which reads every pixel, the whole raster is past 2²⁸ pixels |
Tiff | any | the image itself can’t be decoded |
What it reads
You rarely need this table: a USGS 1-arc-second tile reads as it comes. It’s for checking an odd file.
| what | read | refused |
|---|---|---|
| the grid | latitude and longitude in degrees from Greenwich, on a datum within a few meters of WGS 84: WGS 84 itself, NAD83 and its updates, ETRS89, GDA94, GDA2020, NZGD2000, JGD2011, SIRGAS 2000 and CGCS2000 (the EPSG codes are NEAR_WGS84 in the API) | a map projection such as UTM, or an older datum such as NAD27, tens to hundreds of meters from WGS 84: the error names the code, and gdalwarp -t_srs EPSG:4326 in.tif out.tif converts the file |
| the pixels | one band of 8-, 16- or 32-bit integers, or 32- or 64-bit floats; tiles or strips; uncompressed, LZW, Deflate or PackBits; either byte order; BigTIFF | several bands; zstd, JPEG and other compression (gdal_translate -co COMPRESS=DEFLATE rewrites the file); a separate mask of missing pixels |
| where the pixels lie | one tiepoint (a pixel tied to a longitude and latitude) with a pixel size, or a matrix without rotation; pixel is area or pixel is point (whether the tiepoint names a pixel’s corner or its center); longitudes 0° to 360° as well as −180° to 180° | a rotated grid; several tiepoints (ground control points); a south-up pixel size, which GDAL and the standard read differently |
| the heights | a scale and offset as GDAL applies them (from the file’s pixel scale, or from GDAL’s own metadata tag); meters, feet or US survey feet as the file states (in its keys or in GDAL’s metadata tag), or as its vertical datum implies; meters if it says nothing, with vertical_unit_stated then false | a vertical datum outside a short list HPR Sim knows (VERTICAL_CRS_UNITS in the API: EGM2008, EGM96, NAVD88 and a few more), since its unit could be feet; forms GDAL may read differently (below); a unit other than these, or two that disagree |
| no data | the file’s nodata value, and NaN, read as None |
Also refused in the heights row, as GDAL may read them differently:
- a height scale in the pixel-scale tag when the file names a vertical datum in a way GDAL may not apply (HPR Sim can’t tell what GDAL would do);
- vertical keys GDAL ignores, unit and all, or reads by rules of its own (a private code, keys beside WGS 84 3D, datum 6030 beside WGS 84 with a model type, or keys with no model type and no unit);
- a scale, offset or unit in GDAL’s metadata tag with a namespace, capitals in an attribute’s name, a sample that isn’t plain digits, a value that isn’t plain text, a blank written as a character reference, or the
IMAGE_STRUCTUREdomain, which GDAL reads with quirks of its own.
Which height it is. The height is above the file’s own vertical datum. The reader reports the
datum’s EPSG code (vertical_crs_epsg) when the file names one, and doesn’t change the height.
Check two things in info(), the first one first:
- If
vertical_unit_statedisfalse, the file states no unit, and the simulator took meters. A file in feet read as meters gives heights 3.28 times too high. - If
vertical_crs_epsgisNone, the file names no datum. The USGS tile in the example below names none. The USGS’s own description of its data says its heights are above NAVD88, the North American vertical datum. Check your publisher’s description.
EGM2008 is a model of the geoid. NAVD88 was defined by leveling. The US National Geodetic Survey puts it about half a meter off the best geoid models. NAVD88 is tilted, too, by about a meter from coast to coast (NGS, new datums). Together, the offset and the tilt come to a meter or two at most.
The simulator takes a height above either as the of What the height means. A meter’s difference in changes the air’s density by about 0.01%.
An example with a file
crates/hpr/examples/site_geotiff.rs
reads two small files cut from the USGS tile around Spaceport America. Both have some pixels
blanked out as nodata. One is in meters, the other in whole US survey feet. It makes these calls:
ElevationRaster::parse(bytes)reads the tags;info()holds what they say.height_at(lat, lon)gives the height at three places: the runway and a place in a blanked-out hole (None). The third is Albuquerque, off the file (an error naming the file’s edges).value_atgives the feet file’s raw value, andheight_atthe same in meters.Ussa76::standard().air(height)gives the standard atmosphere at the runway’s height.
Run it from a copy of the repository with cargo run --example site_geotiff -p fusionspace-hpr. It prints:
70 by 50 pixels of 1.000" by 1.000", PixelIsArea, CRS EPSG:4269, values F32 in Meter (stated: false)
latitudes 32.98333 to 32.99722, longitudes -106.98500 to -106.96556
place lat (°) lon (°) height
Spaceport America, New Mexico 32.9900 -106.9700 1400.691 m
a hole in the data 32.9960 -106.9832 no data
Albuquerque, New Mexico 35.0844 -106.6504 refused: latitude 35.0844° and longitude -106.6504° are outside the raster, which spans latitudes 32.983333° to 32.997222° and longitudes -106.985000° to -106.965556°
in feet: 4595 UsSurveyFoot (vertical CRS EPSG:6360) = 1400.559 m, -0.132 m from the meters file
at 1400.7 m: 855.95 hPa, density 0.872 of sea level's
1.000"is one arc-second,PixelIsAreasays the tiepoint is a pixel’s corner, andEPSG:4269is NAD83.F32is 32-bit floating point, andMeter (stated: false)says the file states no unit.- In the feet file,
EPSG:6360is NAVD88 in US survey feet, which the file states.
The runway reads 1,400.691 m (4,595.44 ft). Open-Meteo’s answer for the same place, above, is 1,400 m (4,593 ft). That answer comes from a different terrain model whose cells are 90 m (295 ft) across, above EGM2008. The feet file stores 4,595 US survey feet, which is 1,400.559 m (4,595.01 ft), 0.132 m (0.43 ft) from the meters file. Rounding to whole feet moves a height by up to 0.152 m (0.50 ft).
How the file reader is checked
The oracle, the outside program HPR Sim is held to, is GDAL 3.12.2, run
through rasterio 1.5.2, its Python interface. A script,
validation/oracles/geotiff/dem.py,
cut 70 by 50 pixels around Spaceport America from the USGS’s 1-arc-second tile n33w107 and wrote
them in seven encodings:
| file | pixels | layout | georeferencing and heights |
|---|---|---|---|
usgs-f32-lzw-fp-tiles.tif | 32-bit floats, LZW, floating-point predictor | 16-pixel tiles | NAD83, pixel is area, nodata holes |
usgs-i16-deflate-strips-be.tif | 16-bit integers, Deflate, horizontal predictor | 7-row strips, big-endian | WGS 84 |
usgs-f64-raw-bigtiff-point.tif | 64-bit floats, uncompressed | BigTIFF | WGS 84, pixel is point |
usgs-u16-packbits-ftus-nodata.tif | 16-bit unsigned, PackBits | strips | NAD83 with NAVD88 in US survey feet, nodata holes |
usgs-u32-cm-scaled-egm2008.tif | 32-bit unsigned, Deflate | strips | WGS 84 with EGM2008; centimeters above 1,000 m (3,281 ft) by the pixel scale |
usgs-u8-metadata-scaled.tif | 8-bit unsigned, LZW | strips | WGS 84; quarter feet above 4,585 ft, scale, offset and unit all by GDAL’s metadata |
usgs-i32-lzw-tiles-lon360.tif | 32-bit integers, LZW, horizontal predictor | 32-pixel tiles | WGS 84, longitudes past 180° |
The script recorded what rasterio reads from each, and from the whole 3,612 by 3,612 tile:
- the corner, the pixel size, the CRS, the vertical datum and unit, the scale and offset, and the nodata value;
- the exactly rounded sum of every value, and of each value times its index (row × width + column), so a swapped pair of pixels would show;
- at 400 places in each small file and 2,000 in the tile, which pixel rasterio puts the place in, and its value. Some of those places are off the edge.
The tests in
crates/hpr-io/tests/geotiff_rasterio.rs
hold HPR Sim to all of it exactly:
| check | result |
|---|---|
| corner and pixel size | the same to the last bit, in all eight files |
| the two sums over every pixel | exact, 13 million pixels in the tile |
| places in the seven files | 2,800: the same pixel and value at all 2,368 on a file (9 of them nodata), and “outside” at the other 432 |
| places in the tile | 2,000: the same pixel and value at all 1,696 on it, and “outside” at the other 304 |
| unit | GDAL’s wherever GDAL reports one, and vertical_unit_stated false wherever it reports none |
| heights | at every 97th place, HPR Sim’s height is GDAL’s scale and offset applied to the value, in the file’s unit |
CI checks the seven small files. The whole tile (45 MB, fetched by cargo xtask refs fetch) is
checked where it’s been downloaded.
The code’s own tests build files to check each refusal in the table above. They also check the half-pixel move of pixel is point, the units, the scale and offset, and nodata. Property tests check, on random strip and tile layouts, that every place reads the pixel it’s placed in. They check, too, that a file with bytes changed is read or refused without a crash.
The places are random, so none sits exactly on a pixel’s edge. Rounding can put a place on either side of an edge, in HPR Sim and in GDAL. That happens only for a place closer to the edge than about 10⁻¹³ of a pixel’s width. A coordinate typed to a few decimals never comes that close.
What the file reader leaves out
- Map projections aren’t read: a UTM file, or one on an older datum, needs
gdalwarpfirst. - There’s no smoothing. A place reads its pixel’s value, and on a slope the next pixel can be meters higher.
- Datums aren’t converted. A datum within a few meters of WGS 84 is taken as WGS 84, and the vertical datum is reported. Near the rupture of a large earthquake since a datum was fixed, the ground has moved further, by several meters. Chile’s earthquake in 2010, for SIRGAS 2000, is an example.
- The file’s accuracy is the file’s. The reader gives back what’s stored, and the USGS and other publishers state their own accuracy.
- There’s no command: a program calls the library.