Skip to content

Function to compare functionally equivalent CRS data #8427

@DanRod1999

Description

@DanRod1999

When attempting to merge imodels using the imodel-transformation repo, it would be useful to have a function that compares Horizontal and Vertical CRS for functional equivalence. Currently we only have a deep equals that also compares the CRS description which can vary between imodels, despite all other data matching.

I created a draft PR that has an almostEqual for HorizontalCRS

From prior discussions, it is my understanding that the verticalCRS cannot differ between imodels in any way without causing bad side effects, so nothing there would need to change. However their are other parameters to HorizontalCRS that I am unsure about and would like to know if they can also be omitted from this comparison

These are all the possible fields, but I'm mainly curious if these can differ between imodels:

  • name
  • id
  • description (my PR removes this already)
  • datumId
  • ellipsoidId

My guess is the id's should be constants, but just want to double check.

  /** The identifier of the horizontal CRS as stored in the dictionary or the service database */
  public readonly id?: string;
  /** Used only for user-defined definitions that will typically use a GUID as id. A display name for the CRS that allows
   ** a human to understand the nature of the definition
   */
  public readonly name?: string;
  /** Description */
  public readonly description?: string;
  /** The source of the CRS definition. */
  public readonly source?: string;
  /** If true then indicates the definition is deprecated. It should then be used for backward compatibility only.
   *  If false then the definition is not deprecated. Default is false.
   */
  public readonly deprecated: boolean;
  /** The EPSG code of the CRS. If undefined then there is no EPSG code associated. */
  public readonly epsg?: number;
  /** The identifier of the geodetic datum as stored in the dictionary or the service database. */
  public readonly datumId?: string;
  /** The complete definition of the geodetic datum referred to by datumId. It can also be used if the datum is not stored
   *  in either service or dictionary.
   */
  public readonly datum?: GeodeticDatum;

  /** The identifier of the geodetic ellipsoid as stored in the dictionary or the service database. This property is exclusive
   *  of having datumId and datum properties undefined.
  */
  public readonly ellipsoidId?: string;
  /** The complete definition of the geodetic ellipsoid referred to by ellipsoidId. It can also be used if the ellipsoid is not stored
   *  in either service or dictionary. This property is exclusive
   *  of having datumId and datum properties undefined.
  */
  public readonly ellipsoid?: GeodeticEllipsoid;
  /** The text indicating the unit used. */
  public readonly unit?: UnitType;
  /** Projection including projection parameters. */
  public readonly projection?: Projection;
  /** Extent representing the domain of application of the CRS. */
  public readonly extent?: HorizontalCRSExtent;

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions