@itwin/core-common
Version:
iTwin.js components common to frontend and backend
79 lines • 6.16 kB
JavaScript
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
* @module iModels
*/
// cspell:ignore NGVD, NAVD, COMPD_CS, PROJCS, GEOGCS
import { GeoServiceStatus } from "@itwin/core-bentley";
/** This enumeration lists all possible status as returned from a coordinate conversion to or from a
* [[GeographicCRS]] and either another [[GeographicCRS]] or a [[GeodeticDatum]].
* @see [[GeoConverter]] to perform coordinate conversions.
* @see [[PointWithStatus]] for the result of a coordinate conversion, including its status code.
* @public
* @extensions
*/
export var GeoCoordStatus;
(function (GeoCoordStatus) {
/** Indicates successful coordinate conversion. */
GeoCoordStatus[GeoCoordStatus["Success"] = 0] = "Success";
/** Indicates that the source or target of the conversion is not defined, usually the iModel Geographic Coordinate Reference System.*/
GeoCoordStatus[GeoCoordStatus["NoGCSDefined"] = 100] = "NoGCSDefined";
/** This value indicates that the conversion was performed outside of the normal use of application of either Geographic Coordinate Reference Systems.
* This return value can often be treated as a warning in specific cases. For example, global imagery extent spans the whole globe and
* may extend far beyond the normal area of the iModel project extents and the extent of normal use of its Geographic Coordinate Reference System.
* In such cases this value can be considered a warning as accuracy and precision is not expected in this specific case and approximate localization
* of global imagery or other low accuracy context data is not essential far from the project.
* If this status is returned for high accuracy data then it indicates that either Geographic Coordinate Reference Systems were inappropriately selected
* for the iModel or other geolocated data. If this is the case the status should be somehow reported so action
* can be performed to verify used geolocation parameters.
* In either case the returned coordinates are to be considered valid though they may be inaccurate or result in some unexpected distortion of graphical
* elements.
*/
GeoCoordStatus[GeoCoordStatus["OutOfUsefulRange"] = 1] = "OutOfUsefulRange";
/** Indicates a hard error where conversions were requested outside of the area of the mathematical capacity of the conversion process for either
* Geographic Coordinate Reference Systems involved. An example could be to attempt a conversion involving a Transverse Mercator more than 60 degrees
* East or West of the projection central meridian.
* The values returned may or may not be valid and should be discarded.
*/
GeoCoordStatus[GeoCoordStatus["OutOfMathematicalDomain"] = 2] = "OutOfMathematicalDomain";
/** Indicates that datum transformation between the two Geographic Coordinate Reference Systems could not be performed.
* This error is usually the result of a datum transformation path requiring use of latitude/longitude grid shift files that could not be obtained
* or installed. In this case the latitude/longitude transformation is bypassed but the remainder of the conversion process is completed.
* This error can be ignored for low accuracy data but should be somehow reported so actions can be performed to provide the missing files.
*/
GeoCoordStatus[GeoCoordStatus["NoDatumConverter"] = 25] = "NoDatumConverter";
/** Indicates that a problem occurred during vertical datum conversion. This may the result of the inability to access the
* Geoid separation data or vertical datum differential data (such as used by NGVD29 to NAVD88 conversion).
* The horizontal coordinates returned are valid but the elevation ordinate will be returned unchanged or partially changed.
* This status should be somehow reported so actions can be performed to provide the missing information.
*/
GeoCoordStatus[GeoCoordStatus["VerticalDatumConvertError"] = 26] = "VerticalDatumConvertError";
/** General inner conversion engine error. Coordinates returned are invalid and should be discarded */
GeoCoordStatus[GeoCoordStatus["CSMapError"] = 4096] = "CSMapError";
/** This temporary status is used to mark coordinates for which the conversion has not yet been processed by the backend
* as opposed to other coordinate conversions that may have been resolved otherwise (typically a cache).
* At the completion of the conversion promise no coordinates should have this status.
* @deprecated in 5.0 - will not be removed until after 2026-06-13. Pending is no longer returned as a status for coordinate conversions.
*/
GeoCoordStatus[GeoCoordStatus["Pending"] = -41556] = "Pending";
})(GeoCoordStatus || (GeoCoordStatus = {}));
/** Maps a GeoCoordStatus to the equivalent GeoServiceStatus.
* @public
*/
export function mapToGeoServiceStatus(s) {
switch (s) {
case GeoCoordStatus.Success: return GeoServiceStatus.Success;
case GeoCoordStatus.NoGCSDefined: return GeoServiceStatus.NoGeoLocation;
case GeoCoordStatus.OutOfUsefulRange: return GeoServiceStatus.OutOfUsefulRange;
case GeoCoordStatus.OutOfMathematicalDomain: return GeoServiceStatus.OutOfMathematicalDomain;
case GeoCoordStatus.NoDatumConverter: return GeoServiceStatus.NoDatumConverter;
case GeoCoordStatus.VerticalDatumConvertError: return GeoServiceStatus.VerticalDatumConvertError;
case GeoCoordStatus.CSMapError: return GeoServiceStatus.CSMapError;
case GeoCoordStatus.Pending: return GeoServiceStatus.Pending; // eslint-disable-line @typescript-eslint/no-deprecated
default:
throw new Error("GeoCoordStatus -> GeoServiceStatus - Missing enum conversion");
}
}
//# sourceMappingURL=GeoCoordinateServices.js.map