MCPcopy Index your code
hub / github.com/MapServer/MapServer / msResampleGDALToMap

Function msResampleGDALToMap

mapresample.c:1303–1675  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1301/************************************************************************/
1302
1303int msResampleGDALToMap( mapObj *map, layerObj *layer, imageObj *image,
1304 rasterBufferObj *rb, GDALDatasetH hDS )
1305
1306{
1307/* -------------------------------------------------------------------- */
1308/* We require PROJ.4 4.4.2 or later. Earlier versions don't */
1309/* have PJD_GRIDSHIFT. */
1310/* -------------------------------------------------------------------- */
1311#if !defined(PJD_GRIDSHIFT) && !defined(PJ_VERSION)
1312 msSetError(MS_PROJERR,
1313 "Projection support is not available, so msResampleGDALToMap() fails.",
1314 "msProjectRect()");
1315 return(MS_FAILURE);
1316#else
1317 int nSrcXSize, nSrcYSize, nDstXSize, nDstYSize;
1318 int result, bSuccess;
1319 double adfSrcGeoTransform[6], adfDstGeoTransform[6];
1320 double adfInvSrcGeoTransform[6], dfNominalCellSize;
1321 rectObj sSrcExtent, sOrigSrcExtent;
1322 mapObj sDummyMap;
1323 imageObj *srcImage;
1324 void *pTCBData;
1325 void *pACBData;
1326 int anCMap[256];
1327 char **papszAlteredProcessing = NULL;
1328 int nLoadImgXSize, nLoadImgYSize;
1329 double dfOversampleRatio;
1330 rasterBufferObj src_rb, *psrc_rb = NULL;
1331
1332
1333 const char *resampleMode = CSLFetchNameValue( layer->processing,
1334 "RESAMPLE" );
1335
1336 if( resampleMode == NULL )
1337 resampleMode = "NEAREST";
1338
1339/* -------------------------------------------------------------------- */
1340/* We will require source and destination to have a valid */
1341/* projection object. */
1342/* -------------------------------------------------------------------- */
1343 if( map->projection.proj == NULL
1344 || layer->projection.proj == NULL )
1345 {
1346 if( layer->debug )
1347 msDebug( "msResampleGDALToMap(): "
1348 "Either map or layer projection is NULL, assuming compatible.\n" );
1349 }
1350
1351/* -------------------------------------------------------------------- */
1352/* Initialize some information. */
1353/* -------------------------------------------------------------------- */
1354 nDstXSize = image->width;
1355 nDstYSize = image->height;
1356
1357 memcpy( adfDstGeoTransform, map->gt.geotransform, sizeof(double)*6 );
1358
1359 msGetGDALGeoTransform( hDS, map, layer, adfSrcGeoTransform );
1360

Callers 1

msDrawRasterLayerLowFunction · 0.85

Calls 15

msSetErrorFunction · 0.85
msDebugFunction · 0.85
msGetGDALGeoTransformFunction · 0.85
InvGeoTransformFunction · 0.85
msTransformMapToSourceFunction · 0.85
msCloneOutputFormatFunction · 0.85
msImageCreateFunction · 0.85
msDrawRasterLayerGDALFunction · 0.85
msFreeRasterBufferFunction · 0.85
msFreeImageFunction · 0.85
msAddColorGDFunction · 0.85

Tested by

no test coverage detected