Skip to content

ThemeMap produces discontinuous coordinates when SpatialRecord span UTM zone boundaries or the equator #41

@cassioutfpr

Description

@cassioutfpr

Summary

The ToUtm() extension method in ShapeExtensions.cs converts each point individually, deriving the UTM zone (longitude of origin) and the hemisphere on a per-point basis. When a dataset (SpatialRecord) contains points on opposite sides of a UTM zone boundary or on opposite sides of the equator, the resulting projected coordinates have large artificial discontinuities, causing the spatial view to render geometries thousands of kilometers away from where they actually are.

This is reproducible with real-world field operation data in regions that straddle a zone boundary (common in Brazil, which is crossed by UTM zones 21–24) or the equator (northern Brazil, Ecuador, Indonesia, parts of Africa, etc.).

Steps to reproduce

  1. Load an OperationData dataset with spatial points whose longitudes cross a UTM zone boundary (e.g. a field straddling longitude −48° in Brazil), or whose latitudes cross the equator.
  2. Open the spatial view in the Visualizer.
  3. Observe that points/lines/polygons appear split, mirrored, or displaced by hundreds to thousands of kilometers from their true relative positions.

Expected behavior

All geometries belonging to the same dataset should render with correct relative positions on the spatial view, regardless of whether they cross a UTM zone boundary or the equator.

Evidences Before Fix

Crossing UTM zones before fix:
Image

Crossing the equator before fix:
Image

Proposed fix

Add ToUtmRelativeToSpatialRecordFirstPoint(this ApplicationDataModel.Shapes.Point point, ApplicationDataModel.Shapes.Point firstPoint) so that a single longitude of origin and a single hemisphere reference are chosen for the entire dataset (for example, derived from the centroid or first point of the shapes being projected) and applied uniformly to every point — an extended UTM approach. Points falling outside the reference zone/hemisphere remain mathematically continuous (Easting beyond the normal zone range, or Northing that may be negative or exceed 10,000,000), which is exactly what a single-canvas visualizer needs. The scale distortion introduced by projecting points outside the reference zone is negligible at field/farm scales (well under 1 part in 1,000 within a few degrees of the central meridian), which I think is acceptable for a diagnostic visualizer.

Evidences After Fix

Crossing UTM zones after fix:

Image

Crossing the equator after fix:

Image

Environment

  • Repository: ADAPT/ADAPT-Visualizer, branch develop
  • Component: SpatialRecordProcessor.ThemeMap()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions