Class Coordinate

java.lang.Object
com.cercalia.sdk.model.common.Coordinate

public final class Coordinate extends Object
Represents a geographic coordinate with latitude and longitude.

This is the fundamental spatial data type used throughout the SDK. Coordinates are typically represented in WGS84 (EPSG:4326).

  • Constructor Details

    • Coordinate

      public Coordinate(double lat, double lng)
      Creates a new Coordinate.
      Parameters:
      lat - the latitude
      lng - the longitude
  • Method Details

    • getLat

      public double getLat()
      Returns the latitude.
      Returns:
      the latitude
    • getLng

      public double getLng()
      Returns the longitude.
      Returns:
      the longitude
    • toCercaliaString

      @NotNull public @NotNull String toCercaliaString()
      Returns the coordinate as a string in "lng,lat" format (Cercalia format).
      Returns:
      the coordinate string
    • toLatLngString

      @NotNull public @NotNull String toLatLngString()
      Returns the coordinate as a string in "lat,lng" format.
      Returns:
      the coordinate string
    • fromCercaliaString

      @NotNull public static @NotNull Coordinate fromCercaliaString(@NotNull @NotNull String coordString)
      Parses a coordinate from Cercalia format string "lng,lat".
      Parameters:
      coordString - the coordinate string
      Returns:
      the parsed Coordinate
      Throws:
      IllegalArgumentException - if the string is invalid
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object