---
title: "TransformConstrainFunction | JavaScript maps SDK"
description: "Documentation for MapTiler SDK"
---

> For AI agents: a documentation index is available at [/llms.txt](https://docs.maptiler.com/llms.txt). Markdown versions of all pages are available by appending .md to any URL.

# Type Alias TransformConstrainFunction

TransformConstrainFunction: (  
    lngLat: [LngLat](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.LngLat/),  
    zoom: number,  
) \=> { center: [LngLat](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.LngLat/); zoom: number }

The callback defining how the transform constrains the viewport's lnglat and zoom to respect the longitude and latitude bounds.

#### Type Declaration

-   -   (lngLat: [LngLat](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.LngLat/), zoom: number): { center: [LngLat](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.LngLat/); zoom: number }
    -   #### Parameters
        
        -   lngLat: [LngLat](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.LngLat/)
        -   zoom: number
        
        #### Returns { center: [LngLat](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.LngLat/); zoom: number }
        

#### See[](#see)

[Customize the map transform constrain](https://maplibre.org/maplibre-gl-js/docs/examples/customize-the-map-transform-constrain/)
