diff --git a/Code/BasicFilters/otbRasterizeVectorDataFilter.txx b/Code/BasicFilters/otbRasterizeVectorDataFilter.txx index 40a7dc38577f5ac1ffc202eec61b9210fed7b123..4b417b0537d94f2f391e373ef0940aeae429bfd8 100644 --- a/Code/BasicFilters/otbRasterizeVectorDataFilter.txx +++ b/Code/BasicFilters/otbRasterizeVectorDataFilter.txx @@ -174,8 +174,8 @@ RasterizeVectorDataFilter<TVectorData, TInputImage, TOutputImage>::GenerateData( InputIndexType bufferIndexOrigin = bufferedRegion.GetIndex(); InputPointType bufferOrigin; this->GetOutput()->TransformIndexToPhysicalPoint(bufferIndexOrigin, bufferOrigin); - geoTransform[0] = bufferOrigin[0]; - geoTransform[3] = bufferOrigin[1]; + geoTransform[0] = bufferOrigin[0] - 0.5 * this->GetOutput()->GetSpacing()[0]; + geoTransform[3] = bufferOrigin[1] - 0.5 * this->GetOutput()->GetSpacing()[1]; geoTransform[1] = this->GetOutput()->GetSpacing()[0]; geoTransform[5] = this->GetOutput()->GetSpacing()[1]; diff --git a/Code/Common/otbLabelImageToOGRDataSourceFilter.txx b/Code/Common/otbLabelImageToOGRDataSourceFilter.txx index 807ff59a8a25284a3de1ea033474b03f5094a10a..a1ad27a20860ef0a35e35736797c768430a4b044 100644 --- a/Code/Common/otbLabelImageToOGRDataSourceFilter.txx +++ b/Code/Common/otbLabelImageToOGRDataSourceFilter.txx @@ -186,8 +186,8 @@ LabelImageToOGRDataSourceFilter<TInputImage> IndexType bufferIndexOrigin = this->GetInput()->GetBufferedRegion().GetIndex(); OriginType bufferOrigin; this->GetInput()->TransformIndexToPhysicalPoint(bufferIndexOrigin, bufferOrigin); - geoTransform[0] = bufferOrigin[0]; - geoTransform[3] = bufferOrigin[1]; + geoTransform[0] = bufferOrigin[0] - 0.5 * this->GetInput()->GetSpacing()[0]; + geoTransform[3] = bufferOrigin[1] - 0.5 * this->GetInput()->GetSpacing()[1]; geoTransform[1] = this->GetInput()->GetSpacing()[0]; geoTransform[5] = this->GetInput()->GetSpacing()[1]; // FIXME: Here component 1 and 4 should be replaced by the orientation parameters @@ -256,8 +256,8 @@ LabelImageToOGRDataSourceFilter<TInputImage> // the spacing is unchanged, the origin is relative to the buffered region bufferIndexOrigin = this->GetInputMask()->GetBufferedRegion().GetIndex(); this->GetInputMask()->TransformIndexToPhysicalPoint(bufferIndexOrigin, bufferOrigin); - geoTransform[0] = bufferOrigin[0]; - geoTransform[3] = bufferOrigin[1]; + geoTransform[0] = bufferOrigin[0] - 0.5 * this->GetInputMask()->GetSpacing()[0]; + geoTransform[3] = bufferOrigin[1] - 0.5 * this->GetInputMask()->GetSpacing()[1]; geoTransform[1] = this->GetInputMask()->GetSpacing()[0]; geoTransform[5] = this->GetInputMask()->GetSpacing()[1]; // FIXME: Here component 1 and 4 should be replaced by the orientation parameters