---
title: "ProximityRule | Geocoding | JavaScript maps SDK"
description: "Documentation for Search and Geocoding control"
---

> 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 ProximityRule

ProximityRule: { maxZoom?: number; minZoom?: number } & (  
    | { coordinates: [Position](https://docs.maptiler.com/sdk-js/modules/geocoding/api/api-reference/types/Position/); type: "fixed" }  
    | { type: "map-center" }  
    | { type: "server-geolocation" }  
    | { cachedLocationExpiry?: number; type: "client-geolocation" } & PositionOptions  
)

#### Type Declaration

-   ##### `Optional`maxZoom?: number
    
    maximal map zoom for the rule to be used
    
-   ##### `Optional`minZoom?: number
    
    minimal map zoom for the rule to be used
    

-   { coordinates: [Position](https://docs.maptiler.com/sdk-js/modules/geocoding/api/api-reference/types/Position/); type: "fixed" }
    -   ##### coordinates: [Position](https://docs.maptiler.com/sdk-js/modules/geocoding/api/api-reference/types/Position/)
        
        coordinates of the fixed proximity
        
    -   ##### type: "fixed"
        
        fixed proximity
        
-   { type: "map-center" }
    -   ##### type: "map-center"
        
        use map center coordinates for the proximity
        
-   { type: "server-geolocation" }
    -   ##### type: "server-geolocation"
        
        resolve proximity by geolocating IP of the geocoding API call
        
-   { cachedLocationExpiry?: number; type: "client-geolocation" } & PositionOptions
    -   ##### `Optional`cachedLocationExpiry?: number
        
        how long should the geolocation result be cached, in milliseconds
        
    -   ##### type: "client-geolocation"
        
        use browser's geolocation API for proximity. If it fails, following proximity rules are iterated.
        

-   Defined in [src/types.ts:24](https://github.com/maptiler/maptiler-geocoding-control/blob/7abb332debfe243d5d21e0823dd92a94259b6d8e/src/types.ts#L24)
