# Reprojection

The Reprojection operator reprojects data from one spatial reference system to another. It accepts exactly one input which can either be a raster or a vector data stream. The operator produces all data that, after reprojection, is contained in the query rectangle.

## Data type specifics

The concrete behavior depends on the data type.

### Vector data

The reprojection operator reprojects all coordinates of the features individually. The result contains all features that, after reprojection, are intersected by the query rectangle. If not all coordinates of the vector data stream could be projected, the operator returns an error.

### Raster data

To create tiles in the target projection, the operator first loads the corresponding tiles in the source projection. Note, that in order to create one reprojected output tile, it may be necessary to load multiple source tiles. For each output pixel, the operator takes the value of the input pixel nearest to its upper left corner.

In order to obtain precise results but avoid loading too much data, the operators estimate the resolution in which it loads the input raster stream. The estimate is based on the target resolution defined by the query rectangle and the relationship between the length of the diagonal of the query rectangle in both projections. Please refer to the source code for details.

In case a tile, or part of a tile, is not available in the source projection because it is outside of the defined extent, the operator will produce pixels with no data values. If the input raster stream has no no data value defined, the value 0 will be used instead.

## Parameters

ParameterTypeDescriptionExample Value
targetSpatialReferenceStringThe srs string (authority:code) of the target spatial reference.EPSG:4326

## Inputs

The Reprojection operator expects exactly one raster or vector input.

ParameterType
sourceRasterOrVectorOperator

## Errors

The operator returns an error if the target projection is unknown or if the input data cannot be reprojected.

## Example JSON

{
"type": "Reprojection",
"params": {
"targetSpatialReference": "EPSG:4326"
},
"sources": {
"source": {
"type": "GdalSource",
"params": {
"data": {
"type": "internal",
"datasetId": "a626c880-1c41-489b-9e19-9596d129859c"
}
}
}
}
}