Skip to content
Permalink
Browse files
msRasterQueryByRectLow(): use msProjectPointEx() for better performance
  • Loading branch information
rouault committed Jan 11, 2020
1 parent ead62a6 commit 59eeafe7ae98e817167bb78b04e5069fd2b936b3
Showing 1 changed file with 9 additions and 3 deletions.
@@ -564,6 +564,12 @@ msRasterQueryByRectLow(mapObj *map, layerObj *layer, GDALDatasetH hDS,
}
#endif

reprojectionObj* reprojector = NULL;
if( layer->project )
{
reprojector = msProjectCreateReprojector(&(layer->projection), &(map->projection));
}

/* -------------------------------------------------------------------- */
/* Loop over all pixels determining which are "in". */
/* -------------------------------------------------------------------- */
@@ -588,7 +594,7 @@ msRasterQueryByRectLow(mapObj *map, layerObj *layer, GDALDatasetH hDS,
/* in sPixelLocationInLayerSRS, so that we can return those */
/* coordinates if we have a hit */
sReprojectedPixelLocation = sPixelLocation;
if( layer->project )
if( reprojector )
{
#if PROJ_VERSION_MAJOR < 6
/* Works around a bug in PROJ < 6 when reprojecting from a lon_wrap */
@@ -603,8 +609,7 @@ msRasterQueryByRectLow(mapObj *map, layerObj *layer, GDALDatasetH hDS,
}
#endif

msProjectPoint( &(layer->projection), &(map->projection),
&sReprojectedPixelLocation);
msProjectPointEx( reprojector, &sReprojectedPixelLocation);
}

/* If we are doing QueryByShape, check against the shape now */
@@ -662,6 +667,7 @@ msRasterQueryByRectLow(mapObj *map, layerObj *layer, GDALDatasetH hDS,
/* Cleanup. */
/* -------------------------------------------------------------------- */
free( pafRaster );
msProjectDestroyReprojector( reprojector );

return MS_SUCCESS;
}

0 comments on commit 59eeafe

Please sign in to comment.