@@ -192,23 +192,14 @@ export class RasterDEMTileSource extends RasterTileSource implements Source {
192192 *
193193 * Returns `null` for coordinates where no DEM tile is currently loaded.
194194 *
195- * Tiles are not evicted during a single call, so it is safe to batch-process
196- * a large number of coordinates (e.g. a full GPX track) in one call.
197- *
198195 * @param lnglats - Array of geographic coordinates to query.
199- * @param minzoom - Minimum zoom to consider (default: source minzoom). Tiles below this are skipped.
200- * @param maxzoom - Maximum zoom to consider (default: source maxzoom). Search starts here.
201196 * @returns Array of elevation results (or `null` where no data is available),
202197 * in the same order as the input coordinates.
203198 *
204199 * @example
205200 * ```ts
206201 * const demSource = map.getSource('terrain-dem') as RasterDEMTileSource;
207- * // Query with minimum zoom 12 to avoid low-resolution data
208- * const results = demSource.queryElevations(
209- * [[7.0, 45.0], [7.1, 45.1]],
210- * 12 // minzoom
211- * );
202+ * const results = demSource.queryElevations([[7.0, 45.0], [7.1, 45.1]]);
212203 * const missing = results.filter(r => r === null).length;
213204 * if (missing > 0) console.log(`${missing} points have no loaded tile`);
214205 * results.forEach((r, i) => {
@@ -217,9 +208,7 @@ export class RasterDEMTileSource extends RasterTileSource implements Source {
217208 * ```
218209 */
219210 queryElevations (
220- lnglats : LngLatLike [ ] ,
221- minzoom ?: number ,
222- maxzoom ?: number
211+ lnglats : LngLatLike [ ]
223212 ) : ( ElevationQueryResult | null ) [ ] {
224213 if ( ! this . map ) {
225214 throw new Error ( 'Source is not added to a map' ) ;
@@ -230,16 +219,13 @@ export class RasterDEMTileSource extends RasterTileSource implements Source {
230219 throw new Error ( `No tile manager found for source "${ this . id } "` ) ;
231220 }
232221
233- const maxZ = Math . min ( maxzoom ?? this . maxzoom , this . maxzoom ) ;
234- const minZ = Math . max ( minzoom ?? this . minzoom , this . minzoom ) ;
235-
236222 return lnglats . map ( ll => {
237223 const lnglat = LngLat . convert ( ll ) . wrap ( ) ;
238224 const mercator = MercatorCoordinate . fromLngLat ( lnglat ) ;
239225 const mx = Math . max ( 0 , Math . min ( 1 - 1e-15 , mercator . x ) ) ;
240226 const my = Math . max ( 0 , Math . min ( 1 - 1e-15 , mercator . y ) ) ;
241227
242- for ( let z = maxZ ; z >= minZ ; z -- ) {
228+ for ( let z = this . maxzoom ; z >= this . minzoom ; z -- ) {
243229 const tileCount = 1 << z ;
244230 const tileX = Math . min ( Math . floor ( mx * tileCount ) , tileCount - 1 ) ;
245231 const tileY = Math . min ( Math . floor ( my * tileCount ) , tileCount - 1 ) ;
0 commit comments