# TMS Tiled Map Service in Babylon

**URL:** <https://forum.babylonjs.com/t/tms-tiled-map-service-in-babylon/61185>\
**Category:** Demos and projects\
**Created:** [October 29, 2025, 2:00am UTC](https://forum.babylonjs.com/t/tms-tiled-map-service-in-babylon/61185 "2025-10-29T02:00:34Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![HiGreg](https://avatars.discourse-cdn.com/v4/letter/h/c5a1d2/32.png) [@HiGreg](https://forum.babylonjs.com/u/HiGreg)\
**Post date:** [October 29, 2025, 2:00am UTC](https://forum.babylonjs.com/t/tms-tiled-map-service-in-babylon/61185/1 "2025-10-29T02:00:34Z")

</div>

Inspired by @Jacky_Liu [forum post](https://forum.babylonjs.com/t/babylon-earth-with-tms/61083), I’ve honed my modifications of his original code to provide a dynamic loading of TMS tiles from OpenMapServer onto a sphere in Babylon.

> **[Babylon.js Playground](https://playground.babylonjs.com/#5128US%236)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

Features include:

1. Dynamic loading of tiles in view
2. Single texture
3. Zoom using fov allows close view of globe without zooming through the mesh/sphere

Because only a single texture is used, the useful TMS zoom level is limited. When the texture size would otherwise grow to be bigger than the max specified (or aauto detected by the engine) the scale of tiles is reduced. When the scale is 1/4 or 1/8, it becomes uselessly blurry. You can play around with texture properties (anisotropic filtering, sample mode, etc) and canvas context properties (imageSmoothingEnabled, imageSmoothingQuality) but I haven’t really found any particularly crisp combinations.

Turn on boundaries and text mode 1 to watch the dynamic loading sequences as zoom level changes.

1. options in code: show text none, xyzoom, or distance from camera
2. draw sphere or flat map
3. load/draw images or not
4. draw boundaries or not
5. maximum TMS zoom
6. set maximum simultaneous downloads
7. set maximum downloads per second
8. show dots on visible tile corners
9. set maximum texture size (or auto set)

Am I overlooking any optimizations or features?

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [October 29, 2025, 4:04pm UTC](https://forum.babylonjs.com/t/tms-tiled-map-service-in-babylon/61185/2 "2025-10-29T16:04:18Z")

</div>

Ok this is super cool!

---

<div class="post-metadata">

**Author:** ![HiGreg](https://avatars.discourse-cdn.com/v4/letter/h/c5a1d2/32.png) [@HiGreg](https://forum.babylonjs.com/u/HiGreg)\
**Post date:** [October 30, 2025, 11:05am UTC](https://forum.babylonjs.com/t/tms-tiled-map-service-in-babylon/61185/3 "2025-10-30T11:05:45Z")

</div>

> **[Babylon.js Playground](https://playground.babylonjs.com/#5128US%237)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

An update to get the projection correct. Now, continents don’t shift around when crossing a zoom level. And added zoom levels 0 and 1.

Uses UV mapping on the sphere, which means decreasing the _segments_ too much on the sphere results in visible distortion of the map. 256 segments on the sphere seems to be good enough, 16 is too low.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [October 30, 2025, 4:54pm UTC](https://forum.babylonjs.com/t/tms-tiled-map-service-in-babylon/61185/4 "2025-10-30T16:54:01Z")

</div>

Can you also limit the mouse radius and speed? I’d love to zoom 🙂

---

<div class="post-metadata">

**Author:** ![dsaffo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dsaffo/32/31907_2.png) [@dsaffo](https://forum.babylonjs.com/u/dsaffo)\
**Post date:** [October 30, 2025, 5:22pm UTC](https://forum.babylonjs.com/t/tms-tiled-map-service-in-babylon/61185/5 "2025-10-30T17:22:43Z")

</div>

Also helps to increase the FOV as you get closer to the globe

---

<div class="post-metadata">

**Author:** ![HiGreg](https://avatars.discourse-cdn.com/v4/letter/h/c5a1d2/32.png) [@HiGreg](https://forum.babylonjs.com/u/HiGreg)\
**Post date:** [October 30, 2025, 7:11pm UTC](https://forum.babylonjs.com/t/tms-tiled-map-service-in-babylon/61185/6 "2025-10-30T19:11:53Z")

</div>

I am _only_ increasing fov. There is no radius zoom. I modified \_computeX function in the camera control to only do fov zooming.

Edit: fov for pinch zoom only. I’ll change mouse wheel zooming to be fov, too. Thank you for input!

---

<div class="post-metadata">

**Author:** ![HiGreg](https://avatars.discourse-cdn.com/v4/letter/h/c5a1d2/32.png) [@HiGreg](https://forum.babylonjs.com/u/HiGreg)\
**Post date:** [October 30, 2025, 7:13pm UTC](https://forum.babylonjs.com/t/tms-tiled-map-service-in-babylon/61185/7 "2025-10-30T19:13:42Z")

</div>

I’ll hook up my mouse and see what it does. I modified camera control for fov zooming, but maybe that’s only for pinch? The modified function is near or at the bottom of the code.

Edit: confirmed I didn’t change mouse wheel zoom. Mouse wheel still changes radius and not fov.

---

<div class="post-metadata">

**Author:** ![HiGreg](https://avatars.discourse-cdn.com/v4/letter/h/c5a1d2/32.png) [@HiGreg](https://forum.babylonjs.com/u/HiGreg)\
**Post date:** [October 31, 2025, 7:35am UTC](https://forum.babylonjs.com/t/tms-tiled-map-service-in-babylon/61185/8 "2025-10-31T07:35:17Z")

</div>

> **[Babylon.js Playground](https://playground.babylonjs.com/#5128US%239)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

Added

- zoom wheel now modifies fov
- reduced pan, rotate, and fov sensitivity

Edit:

- starting distance 2 instead of 3
- lower minimum fov (higher max zoom)

Better?

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [October 31, 2025, 3:59pm UTC](https://forum.babylonjs.com/t/tms-tiled-map-service-in-babylon/61185/9 "2025-10-31T15:59:14Z")

</div>

Far better!!!

---

<div class="post-metadata">

**Author:** ![link2twenty](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/link2twenty/32/19199_2.png) [@link2twenty](https://forum.babylonjs.com/u/link2twenty)\
**Post date:** [November 5, 2025, 12:32pm UTC](https://forum.babylonjs.com/t/tms-tiled-map-service-in-babylon/61185/10 "2025-11-05T12:32:58Z")

</div>

Interestingly I was looking at tiling the other day too but as a way to make PhotoDomes load faster. I only got as far as clicking on a “tile” making it go high res though was going to look at how to make it work based on zoom and position too.

> **[Babylon.js Playground](https://playground.babylonjs.com/#14KRGG%231593)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

I don’t know if anything I did would be helpful for you but feel free to have a look and take anything you want 😃
