Skip to content

Conversation

@jgillich
Copy link

@jgillich jgillich commented Oct 26, 2025

Description

Adds the RasterDemSource, which is used by HillshadeLayer. Currently Android-only because I don't own a Mac PC.

Test plan

Confirmed working with this snippet (it renders hills around Austria)

      HillshadeLayer(
        id = "hillshade123",
        source =
          rememberRasterDemSource(
            "https://demotiles.maplibre.org/terrain-tiles/tiles.json",
            tileSize = 256,
          ),
      )

Checklist

To your knowledge, are you making any breaking changes?

No

Have you tested the changes? On which platforms?

  • Android: 16

Currently implemented for Android only
@sargunv sargunv self-requested a review October 27, 2025 17:04
options: TileSetOptions,
tileSize: Int,
) : super() {
this.impl = TODO()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe at least use TODO("Not implemented") or similar for clarity, after all, a TODO produces a runtime exception if that code is reached, IIRC.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

@westnordost westnordost Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Raster DEM sources have the additional property encoding which is missing here. Could be represented with

/** The encoding used by a Raster DEM source. */
public sealed interface RasterDemEncoding {

  /** Mapbox Terrain RGB tiles. See https://www.mapbox.com/help/access-elevation-data/#mapbox-terrain-rgb for more info */
  public data object Mapbox : RasterDemEncoding

  /** Terrarium format PNG tiles. See https://aws.amazon.com/es/public-datasets/terrain/ for more info. */
  public data object Terrarium : RasterDemEncoding

  /** 
    Custom format using the given [redFactor], [blueFactor], [greenFactor] and [baseShift] parameters.
    Currently only supported in JS.
  */
  public data class Custom(
    /** Value that will be multiplied by the red channel value when decoding. */
    val redFactor: Float = 1f,
    /** Value that will be multiplied by the blue channel value when decoding. */
    val blueFactor: Float = 1f,
    /** Value that will be multiplied by the green channel value when decoding. */
    val greenFactor: Float = 1f,
    /** Value that will be added to the encoding mix when decoding. */
    val baseShift: Float = 0f,
  ) : RasterDemEncoding
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants