Skip to content

GroundImageState

GroundImageState is an ObservableObject used by GroundImage(state:).

Use it when the image, opacity, geographic bounds, or click handler changes at runtime.

  • id: String
  • bounds: GeoRectBounds
  • image: UIImage
  • opacity: Double
  • tileSize: Int
  • extra: Any?
  • onClick: OnGroundImageEventHandler?
let bounds = GeoRectBounds(
southWest: GeoPoint(latitude: 35.67, longitude: 139.74),
northEast: GeoPoint(latitude: 35.69, longitude: 139.76)
)
let groundImageState = GroundImageState(
bounds: bounds,
image: UIImage(named: "overlay")!,
opacity: 0.5
)
GroundImage(state: groundImageState)
groundImageState.opacity = 1.0

Update bounds to move or resize the image:

groundImageState.bounds = GeoRectBounds(
southWest: GeoPoint(latitude: 35.66, longitude: 139.73),
northEast: GeoPoint(latitude: 35.70, longitude: 139.77)
)

Update image when the displayed raster changes. Use tileSize to control the tile size used by the overlay renderer.