# Class AutoProjectionService

- Defined in src/misc/AutoProjection.js:32

#####
Index

### Methods

getProjectionList
stringToCoordinates
tryProjections
tryProjectionsWithInversion

## Methods

### getProjectionList

- getProjectionList(projectionsCodes): Projection[]

- Get an array of projections corresponding to their EPSG codes. Log an error for each code that are not defined in ol projections.

  #### Parameters

  - ##### projectionsCodes: string[]

    EPSG codes (e.g. 'EPSG:3857', 'epsg:3857' or '3857').

  #### Returns Projection[]

  An array of projections.

  - Defined in src/misc/AutoProjection.js:61

### stringToCoordinates

- stringToCoordinates(str): Coordinate

- Parse a string and return a coordinate if the result is valid. Given string must be a two numbers separated by a space.

  #### Parameters

  - ##### str: string

    the string to parse.

  #### Returns Coordinate

  A coordinate or null if the format is not valid.

  - Defined in src/misc/AutoProjection.js:41

### tryProjections

- tryProjections(coordinates, extent, viewProjection, opt_projections?): Coordinate

- It projects the point using the projection array and finds the first one for which it falls inside of the viewProjection extent.

  #### Parameters

  - ##### coordinates: Coordinate

    The point to test.

  - ##### extent: Extent

    Limits in which coordinates can be valid.

  - ##### viewProjection: Projection

    Target projection the point.

  - ##### `Optional` opt_projections: (string | Projection)[]

    optional array of projections. The point is tested in each projection, in the order of the array.

  #### Returns Coordinate

  A coordinates in the view's projection if it matches in one of the given projections, or null else.

  - Defined in src/misc/AutoProjection.js:93

### tryProjectionsWithInversion

- tryProjectionsWithInversion(coordinates, extent, viewProjection, opt_projections?): Coordinate

- Same as AutoProjection.tryProjections but if tryProjections return null, re-call it with coordinates in reverse order.

  #### Parameters

  - ##### coordinates: Coordinate

    The point to test.

  - ##### extent: Extent

    Limits in which coordinates can be valid.

  - ##### viewProjection: Projection

    Target projection the point.

  - ##### `Optional` opt_projections: (string | Projection)[]

    optional array of projections. The point is tested in each projection, in the order of the array.

  #### Returns Coordinate

  A coordinates in the view's projection if it matches in one of the given projections, or null else.

  - Defined in src/misc/AutoProjection.js:131

Generated using TypeDoc