---
title: "Projection | 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.

# Interface Projection

interface Projection {  
    get [latitudeErrorCorrectionRadians](#latitudeerrorcorrectionradianslatitudeerrorcorrectionradians)(): number;  
    get [name](#namename)(): | [PropertyValueSpecification](https://docs.maptiler.com/sdk-js/api-reference/types/PropertyValueSpecification/)<[ProjectionDefinitionSpecification](https://docs.maptiler.com/sdk-js/api-reference/types/ProjectionDefinitionSpecification/)\>  
    | undefined;  
    get [shaderDefine](#shaderdefineshaderdefine)(): string;  
    get [shaderPreludeCode](#shaderpreludecodeshaderpreludecode)(): [PreparedShader](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.PreparedShader/);  
    get [shaderVariantName](#shadervariantnameshadervariantname)(): string;  
    get [subdivisionGranularity](#subdivisiongranularitysubdivisiongranularity)(): [SubdivisionGranularitySetting](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.SubdivisionGranularitySetting/);  
    get [transitionState](#transitionstatetransitionstate)(): number;  
    get [useSubdivision](#usesubdivisionusesubdivision)(): boolean;  
    get [vertexShaderPreludeCode](#vertexshaderpreludecodevertexshaderpreludecode)(): string;  
    [destroy](#destroy-1)(): void;  
    [getMeshFromTileID](#getmeshfromtileid-1)(  
        context: [Context](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.Context/),  
        tileID: [CanonicalTileID](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.CanonicalTileID/),  
        hasBorder: boolean,  
        allowPoles: boolean,  
        usage: [TileMeshUsage](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.TileMeshUsage/),  
    ): [Mesh](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.Mesh/);  
    [hasTransition](#hastransition-1)(): boolean;  
    [recalculate](#recalculate-1)(params: [EvaluationParameters](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.EvaluationParameters/)): void;  
    [setErrorQueryLatitudeDegrees](#seterrorquerylatitudedegrees-1)(value: number): any;  
    [updateGPUdependent](#updategpudependent-1)(renderContext: [ProjectionGPUContext](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.ProjectionGPUContext/)): void;  
}

##### Index

### Accessors[](#accessors)

[latitudeErrorCorrectionRadians](#latitudeerrorcorrectionradians) [name](#name) [shaderDefine](#shaderdefine) [shaderPreludeCode](#shaderpreludecode) [shaderVariantName](#shadervariantname) [subdivisionGranularity](#subdivisiongranularity) [transitionState](#transitionstate) [useSubdivision](#usesubdivision) [vertexShaderPreludeCode](#vertexshaderpreludecode)

### Methods[](#methods)

[destroy](#destroy) [getMeshFromTileID](#getmeshfromtileid) [hasTransition](#hastransition) [recalculate](#recalculate) [setErrorQueryLatitudeDegrees](#seterrorquerylatitudedegrees) [updateGPUdependent](#updategpudependent)

## Accessors[](#accessors-1)

### latitudeErrorCorrectionRadians[](#latitudeerrorcorrectionradians)

-   get latitudeErrorCorrectionRadians(): number
    
    #### Returns number
    
    #### Internal[](#internal)
    
    Gets the error correction latitude in radians.
    

### name[](#name)

-   get name(): | [PropertyValueSpecification](https://docs.maptiler.com/sdk-js/api-reference/types/PropertyValueSpecification/)<[ProjectionDefinitionSpecification](https://docs.maptiler.com/sdk-js/api-reference/types/ProjectionDefinitionSpecification/)\>  
    | undefined
    
    #### Returns [PropertyValueSpecification](https://docs.maptiler.com/sdk-js/api-reference/types/PropertyValueSpecification/)<[ProjectionDefinitionSpecification](https://docs.maptiler.com/sdk-js/api-reference/types/ProjectionDefinitionSpecification/)\> | undefined
    
    #### Internal[](#internal-1)
    
    A short, descriptive name of this projection, such as 'mercator' or 'globe'.
    

### shaderDefine[](#shaderdefine)

-   get shaderDefine(): string
    
    A `#define` macro that is injected into every MapLibre shader that uses this projection.
    
    #### Returns string
    
    #### Example[](#example)
    
    ```typescript
    `const define = projection.shaderDefine; // '#define GLOBE'`
    ```
    

### shaderPreludeCode[](#shaderpreludecode)

-   get shaderPreludeCode(): [PreparedShader](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.PreparedShader/)
    
    #### Returns [PreparedShader](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.PreparedShader/)
    
    #### Internal[](#internal-2)
    
    A preprocessed prelude code for both vertex and fragment shaders.
    

### shaderVariantName[](#shadervariantname)

-   get shaderVariantName(): string
    
    Name of the shader projection variant that should be used for this projection. Note that this value may change dynamically, for example when globe projection internally transitions to mercator. Then globe projection might start reporting the mercator shader variant name to make MapLibre use faster mercator shaders.
    
    #### Returns string
    

### subdivisionGranularity[](#subdivisiongranularity)

-   get subdivisionGranularity(): [SubdivisionGranularitySetting](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.SubdivisionGranularitySetting/)
    
    #### Returns [SubdivisionGranularitySetting](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.SubdivisionGranularitySetting/)
    
    #### Internal[](#internal-3)
    
    An object describing how much subdivision should be applied to rendered geometry. The subdivision settings should be a constant for a given projection. Projections that do not require subdivision should return [SubdivisionGranularitySetting.noSubdivision](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.SubdivisionGranularitySetting/#nosubdivision).
    

### transitionState[](#transitionstate)

-   get transitionState(): number
    
    #### Returns number
    
    #### Internal[](#internal-4)
    
    A number representing the current transition state of the projection. The return value should be a number between 0 and 1, where 0 means the projection is fully in the initial state, and 1 means the projection is fully in the final state.
    

### useSubdivision[](#usesubdivision)

-   get useSubdivision(): boolean
    
    #### Returns boolean
    
    #### Internal[](#internal-5)
    
    True if this projection needs to render subdivided geometry. Optimized rendering paths for non-subdivided geometry might be used throughout MapLibre. The value of this property may change during runtime, for example in globe projection depending on zoom.
    

### vertexShaderPreludeCode[](#vertexshaderpreludecode)

-   get vertexShaderPreludeCode(): string
    
    Vertex shader code that is injected into every MapLibre vertex shader that uses this projection.
    
    #### Returns string
    

## Methods[](#methods-1)

### destroy[](#destroy)

-   destroy(): void[](#destroy-1)
    
    #### Returns void
    
    #### Internal[](#internal-6)
    
    Cleans up any resources the projection created, especially GPU buffers.
    

### getMeshFromTileID[](#getmeshfromtileid)

-   getMeshFromTileID(  
        context: [Context](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.Context/),  
        tileID: [CanonicalTileID](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.CanonicalTileID/),  
        hasBorder: boolean,  
        allowPoles: boolean,  
        usage: [TileMeshUsage](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.TileMeshUsage/),  
    ): [Mesh](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.Mesh/)[](#getmeshfromtileid-1)
    
    #### Parameters
    
    -   context: [Context](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.Context/)
        
        WebGL context.
        
    -   tileID: [CanonicalTileID](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.CanonicalTileID/)
        
        The tile coordinates for which to return a mesh. Meshes for tiles that border the top/bottom mercator edge might include extra geometry for the north/south pole.
        
    -   hasBorder: boolean
        
        When true, the mesh will also include a small border beyond the 0..EXTENT range.
        
    -   allowPoles: boolean
        
        When true, the mesh will also include geometry to cover the north (south) pole, if the given tileID borders the mercator range's top (bottom) edge.
        
    -   usage: [TileMeshUsage](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.TileMeshUsage/)
        
        Specify the usage of the tile mesh, as different usages might use different levels of subdivision.
        
    
    #### Returns [Mesh](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.Mesh/)
    
    #### Internal[](#internal-7)
    
    Returns a subdivided mesh for a given tile ID, covering 0..EXTENT range.
    

### hasTransition[](#hastransition)

-   hasTransition(): boolean[](#hastransition-1)
    
    #### Returns boolean
    
    #### Internal[](#internal-8)
    
    Returns true if the projection is currently transitioning between two states.
    

### recalculate[](#recalculate)

-   recalculate(params: [EvaluationParameters](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.EvaluationParameters/)): void[](#recalculate-1)
    
    #### Parameters
    
    -   params: [EvaluationParameters](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.EvaluationParameters/)
        
        Evaluation parameters.
        
    
    #### Returns void
    
    #### Internal[](#internal-9)
    
    Recalculates the projection state based on the current evaluation parameters.
    

### setErrorQueryLatitudeDegrees[](#seterrorquerylatitudedegrees)

-   setErrorQueryLatitudeDegrees(value: number): any[](#seterrorquerylatitudedegrees-1)
    
    #### Parameters
    
    -   value: number
    
    #### Returns any
    
    #### Internal[](#internal-10)
    
    Sets the error query latidude in degrees
    

### updateGPUdependent[](#updategpudependent)

-   updateGPUdependent(renderContext: [ProjectionGPUContext](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.ProjectionGPUContext/)): void[](#updategpudependent-1)
    
    #### Parameters
    
    -   renderContext: [ProjectionGPUContext](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.ProjectionGPUContext/)
    
    #### Returns void
    
    #### Internal[](#internal-11)
    
    Runs any GPU-side tasks this projection required. Called at the beginning of every frame.
