@@ -564,6 +564,12 @@ msRasterQueryByRectLow(mapObj *map, layerObj *layer, GDALDatasetH hDS,
564
564
}
565
565
#endif
566
566
567
+ reprojectionObj * reprojector = NULL ;
568
+ if ( layer -> project )
569
+ {
570
+ reprojector = msProjectCreateReprojector (& (layer -> projection ), & (map -> projection ));
571
+ }
572
+
567
573
/* -------------------------------------------------------------------- */
568
574
/* Loop over all pixels determining which are "in". */
569
575
/* -------------------------------------------------------------------- */
@@ -588,7 +594,7 @@ msRasterQueryByRectLow(mapObj *map, layerObj *layer, GDALDatasetH hDS,
588
594
/* in sPixelLocationInLayerSRS, so that we can return those */
589
595
/* coordinates if we have a hit */
590
596
sReprojectedPixelLocation = sPixelLocation ;
591
- if ( layer -> project )
597
+ if ( reprojector )
592
598
{
593
599
#if PROJ_VERSION_MAJOR < 6
594
600
/* Works around a bug in PROJ < 6 when reprojecting from a lon_wrap */
@@ -603,8 +609,7 @@ msRasterQueryByRectLow(mapObj *map, layerObj *layer, GDALDatasetH hDS,
603
609
}
604
610
#endif
605
611
606
- msProjectPoint ( & (layer -> projection ), & (map -> projection ),
607
- & sReprojectedPixelLocation );
612
+ msProjectPointEx ( reprojector , & sReprojectedPixelLocation );
608
613
}
609
614
610
615
/* If we are doing QueryByShape, check against the shape now */
@@ -662,6 +667,7 @@ msRasterQueryByRectLow(mapObj *map, layerObj *layer, GDALDatasetH hDS,
662
667
/* Cleanup. */
663
668
/* -------------------------------------------------------------------- */
664
669
free ( pafRaster );
670
+ msProjectDestroyReprojector ( reprojector );
665
671
666
672
return MS_SUCCESS ;
667
673
}
0 commit comments