Class GeofenceShape

java.lang.Object
com.cercalia.sdk.model.geofencing.GeofenceShape

public final class GeofenceShape extends Object
Geofence shape definition (polygon or circle in WKT format).

Supported WKT formats:

  • CIRCLE(lng lat, radiusMeters) - e.g., "CIRCLE(2.17 41.38, 1000)"
  • POLYGON((lng lat, lng lat, ...)) - e.g., "POLYGON((2.15 41.37, 2.19 41.37, 2.19 41.40, 2.15 41.40, 2.15 41.37))"
  • Constructor Details

    • GeofenceShape

      public GeofenceShape(@NotNull @NotNull String id, @NotNull @NotNull String wkt)
      Creates a new GeofenceShape.
      Parameters:
      id - unique identifier for the shape.
      wkt - shape geometry in WKT format.
  • Method Details

    • getId

      @NotNull public @NotNull String getId()
      Returns the unique identifier for the shape.
      Returns:
      the shape ID.
    • getWkt

      @NotNull public @NotNull String getWkt()
      Returns the shape geometry in WKT format.
      Returns:
      the WKT geometry.
    • circle

      @NotNull public static @NotNull GeofenceShape circle(@NotNull @NotNull String id, double centerLng, double centerLat, double radiusMeters)
      Creates a circular geofence shape.
      Parameters:
      id - unique identifier.
      centerLng - center longitude.
      centerLat - center latitude.
      radiusMeters - radius in meters.
      Returns:
      a new GeofenceShape with circle WKT.
    • rectangle

      @NotNull public static @NotNull GeofenceShape rectangle(@NotNull @NotNull String id, double swLng, double swLat, double neLng, double neLat)
      Creates a rectangular (polygon) geofence shape.
      Parameters:
      id - unique identifier.
      swLng - southwest corner longitude.
      swLat - southwest corner latitude.
      neLng - northeast corner longitude.
      neLat - northeast corner latitude.
      Returns:
      a new GeofenceShape with polygon WKT.
    • toString

      public String toString()
      Overrides:
      toString in class Object