Skip to content

Enhanced coordinate data structures for positions, bounding boxes and series of positions #270

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
navispatial opened this issue Mar 12, 2025 · 0 comments
Labels
enhancement New feature or request 🌐 geobase Related to the code package "geobase"

Comments

@navispatial
Copy link
Member

Goal

Analyze current class hierarchy on the package version 1.5.0 positions representing coordinates for a single point or location.

Suggest how to improve this in the version 2.0.0.

Documentation

Key documentation related to this issue on the doc site (v1):

See also the API documentation (v 1.5.0):

Implementation in version 1.5

Positions, Box and PositionSeries

Geographic and projected coordinates can be represented as single positions, series of positions and bounding boxes (with minimum and maximum positions).

Class hierarchy:

  • Positionable (contains data structures for (geospatial) position data, directly or within child objects)
    • ValuePositionable (A positionable object that has (geospatial) coordinate values directly available)
      • Box (A base class for axis-aligned bounding boxes with min & max coordinates)
      • Position (A base class for geospatial positions)
        • Geographic (A geographic position with longitude, latitude and optional elevation and m)
        • Projected (A projected position with x, y, and optional z and m coordinates)
    • Bounded (A positionable object with position data (directly or within child objects) and methods to resolve bounding boxes)
      • PositionSeries (A fixed-length (and random-access) view to a series of positions)

The PositionSeries class also implements ValuePositionable, not only Bounded. It's an abstract class that can be instantiated using two different data structures to store coordinate values of positions contained in a series:

  • A list of Position objects (each object contain x and y coordinates, and optionally z and m too).
  • A list of double values as a flat structure. For example a double list could contain coordinates like [x0, y0, z0, x1, y1, z1, x2, y2, z2] that represents three positions each with x, y and z coordinates.

The Bounded class is also implemented by FeatureObject and Geometry. Sub classes of FeatureObject are Feature and FeatureCollection. Sub classes of Geometry are different geometry data structures representing points, line strings (polylines), polygons, multi points, multi line strings, multi polygons and geometry collections. These are not discussed any further on this issue.

Scalable coordinates

Scalable coordinates are coordinates associated with a level of detail (LOD) or a zoom level. They are used for example by tiling schemes to represent pixels or tiles in tile matrices.

Class hierarchy:

  • Scalable (A scalable object at the zoom level (a positive number))
    • Scalable2i (Scalable x, y coordinates at the zoom level.)

Coordinate values

Classes representing position, bounding box and scalable coordinates:

Coordinate values in position classes (projected and geographic):

Class Required coordinates Optional coordinates Values
Position x, y z, m double
Projected x, y z, m double
Geographic lon, lat elev, m double

Coordinate values in bounding box classes (projected and geographic):

Class Required coordinates Optional coordinates Values
Box minX, minY, maxX, maxY minZ, minM, maxZ, maxM double
ProjBox minX, minY, maxX, maxY minZ, minM, maxZ, maxM double
GeoBox west, south, east, north minElev, minM, maxElev, maxM double

Coordinate values in scalable classes:

Class Required coordinates Optional coordinates Values
Scalable2i zoom, x, y int

Coordinates are stored as double values in all position and bounding box
classes but Scalable2i uses int coordinate values.

Geodesy (ellipsoidal and spherical)

On the geodesy sub package there are also other classes representing positions on spherical or ellipsoidal representations of the Earth.

Class hierarchy:

  • Geocentric (geocentric cartesian position (X, Y, Z) representing an ECEF (earth-centric earth-fixed) position)
  • Ellipsoidal (The base class for calculations related to the Earth surface modeled by ellipsoidal reference frames with geographic position (latitude, longitude) as an origin)
    • EllipsoidalVincenty (Calculations for Distances & bearings between points, and destination points given start points & initial bearings)
  • Geodetic (not exported) (An abstract class with methods to calculate distances, bearings, destinations, etc on a geographic position.)
    • SphericalGreatCircle (Latitude/longitude points on a spherical model earth, and methods for calculating distances, bearings, destinations, etc on (orthodromic) great-circle paths)
    • SphericalRhumbLine (Latitude/longitude points on a spherical model earth, and methods for calculating distances, bearings, destinations, etc on (loxodromic) rhumb lines.)

These classes contain geographic positions in properties:

  • Geocentric
    • originPosition (The origin position for calculations.)
    • ellipsoidEllipsoid (The reference ellipsoid used for calculations)
    • datumDatum (An optional datum used for calculations with a reference ellipsoid and datum transformation parameters)*
  • Geodetic and sub classes
    • position : Geographic (The current geographic position for calculations)
  • Ellipsoidal and sub classes
    • originGeographic (The origin position for calculations)
    • ellipsoidEllipsoid (The reference ellipsoid used for calculations)
    • datumDatum (An optional datum used for calculations with a reference ellipsoid and datum transformation parameters)

Also following classes exists (the first defined on the coordinates sub package, the latter on the geodesy sub package):

Geodesy (global grids)

Classes related to UTM coordinates:

Class Description
Utm UTM coordinates, with functions to parse them and convert them to geographic points.
UtmMeta Metadata (convergence and scale) as a result from UTM calculations related to position.
UtmZone The UTM zone represented by the lonZone number and hemisphere.

Classes about MGRS grid references:

Class Description
Mgrs Military Grid Reference System (MGRS/NATO) grid references, with methods to parse references, and to convert between MGRS references and UTM coordinates.
MgrsGridSquare The 100km grid square (or the 100,000-meter square identifier) as a part of the grid zone in MGRS/NATO grid references.
MgrsGridZone A grid zone as a polygon of 6° × 8° in MGRS/NATO grid references.

The classes contains following properties:

  • UtmZone
    • hemisphereHemisphere (The hemisphere of the Earth (north or south) is represented by 'N' or 'S' in UTM coordinates)
    • lonZoneint (represents UTM 6° longitudinal zone (1..60 covering 180°W..180°E))
  • UtmMeta<T extends Object>
    • zoneUtmZone (The UTM zone of the position)
    • positionT (either a geographic position or projected UTM coordinates as indicated by T, potentially with the geodetic datum information.)
    • convergencedouble (The meridian convergence specifies the bearing of the grid north clockwise from the true north, in degrees.)
    • scaledouble (represents the UTM grid scale factor at position).
  • Utm
    • datumDatum (The datum used for calculations with a reference ellipsoid and datum transformation parameters)
    • zoneUtmZone (The UTM zone object with the longitudinal zone (1..60) and the hemisphere)
    • projectedProjected (The projected position as UTM coordinates (x=easting, y=northing, z=elev) in the specified zone)
    • eastingdouble (The easting (x) in metres from the false easting (-500km from the central meridian))
    • northingdouble (The northing (y) in metres from the equator (N) or from the false northing -10,000km (S))
  • MgrsGridZone
    • lonZoneint(represents UTM 6° longitudinal zone (1..60 covering 180°W..180°E))
    • bandString (represents 8° latitudinal band (C..X covering 80°S..84°N))
  • MgrsGridSquare (extends MgrsGridZone)
    • inherited properties
    • columnString (represents the first letter (E) of a 100km grid square. Allowed letter characters are A..Z, omitting I and O.)
    • rowString (represents the second letter (N) of a 100km grid square. Allowed letter characters are A..V, omitting I and O.)
  • Mgrs
    • datumDatum (The datum used for calculations with a reference ellipsoid and datum transformation parameters)
    • gridSquareMgrsGridSquare
      (The 100km grid square identified by a grid zone designator (GZD) and a 100km square identification)
    • eastingint (The easting (x) in metres within a 100km grid square)
    • northingint (The northing (y) in metres within a 100km grid square)

Suggested refactoring for the version 2.0

Geodesy (ellipsoidal and spherical)

  • Geocentric has the origin property with a generic position type Position, maybe there should be a new class Cartesian (extending Position) to better match geocentric cartesian position (X, Y, Z) representing an ECEF position description.
  • SphericalGreatCircle and SphericalRhumbLine should use origin (of type Geographic) instead of position for consistency.

Geodesy (global grids)

  • Refactor the UtmMeta class as a record type.

Suggested new features for the version 2.0

Coordinates

New features

  • support for representing coordinate values (xy, xyz, xym, xyzm, ..) as records and transferring between objects instantiated from current position classes (as described above) and record representations

New classes

  • Cartesian extends Position
    • would have x, y, z and m just like Position and Projected but meant to hold cartesian coordinates like geocentric cartesian coordinates (aggregated on the Geocentric class) or local coordinate systems that are not "projected" on the map.
  • GeographicOrientation extends GeographicBearing (along position and bearing provide also tilt and roll angles, or map specific properties (tilt, zoom) like in google map CameraPosition)

Geodesy (ellipsoidal and spherical)

New features

  • support for local tangent planes as suggested in Possibility for local tangent plane support? #269 with "ENU" (east, north, up) coordinates - how this would fit to coordinate classes consistently in the geobase package needs some analyzing before implementing it
@navispatial navispatial added enhancement New feature or request 🌐 geobase Related to the code package "geobase" labels Mar 12, 2025
@navispatial navispatial added this to the geobase v2.0 on dart 3.6 milestone Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request 🌐 geobase Related to the code package "geobase"
Projects
None yet
Development

No branches or pull requests

1 participant