Skip to content

Commit 59eeafe

Browse files
committed
msRasterQueryByRectLow(): use msProjectPointEx() for better performance
1 parent ead62a6 commit 59eeafe

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Diff for: maprasterquery.c

+9-3
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,12 @@ msRasterQueryByRectLow(mapObj *map, layerObj *layer, GDALDatasetH hDS,
564564
}
565565
#endif
566566

567+
reprojectionObj* reprojector = NULL;
568+
if( layer->project )
569+
{
570+
reprojector = msProjectCreateReprojector(&(layer->projection), &(map->projection));
571+
}
572+
567573
/* -------------------------------------------------------------------- */
568574
/* Loop over all pixels determining which are "in". */
569575
/* -------------------------------------------------------------------- */
@@ -588,7 +594,7 @@ msRasterQueryByRectLow(mapObj *map, layerObj *layer, GDALDatasetH hDS,
588594
/* in sPixelLocationInLayerSRS, so that we can return those */
589595
/* coordinates if we have a hit */
590596
sReprojectedPixelLocation = sPixelLocation;
591-
if( layer->project )
597+
if( reprojector )
592598
{
593599
#if PROJ_VERSION_MAJOR < 6
594600
/* Works around a bug in PROJ < 6 when reprojecting from a lon_wrap */
@@ -603,8 +609,7 @@ msRasterQueryByRectLow(mapObj *map, layerObj *layer, GDALDatasetH hDS,
603609
}
604610
#endif
605611

606-
msProjectPoint( &(layer->projection), &(map->projection),
607-
&sReprojectedPixelLocation);
612+
msProjectPointEx( reprojector, &sReprojectedPixelLocation);
608613
}
609614

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

666672
return MS_SUCCESS;
667673
}

0 commit comments

Comments
 (0)