Skip to content

Commit aed7223

Browse files
committed
Better detect situations where no reprojection is needed (apply to both PROJ 4 and PROJ 6)
1 parent 75860fd commit aed7223

File tree

6 files changed

+22
-5
lines changed

6 files changed

+22
-5
lines changed

mapproject.c

+13-4
Original file line numberDiff line numberDiff line change
@@ -428,13 +428,22 @@ reprojectionObj* msProjectCreateReprojector(projectionObj* in, projectionObj* ou
428428
obj->out = out;
429429

430430
/* -------------------------------------------------------------------- */
431-
/* If the source and destination are simple and equal, then do */
432-
/* nothing. */
431+
/* If the source and destination are equal, then do nothing. */
433432
/* -------------------------------------------------------------------- */
434-
if( in && in->numargs == 1 && out && out->numargs == 1
435-
&& strcmp(in->args[0],out->args[0]) == 0 ) {
433+
if( in && out && in->numargs == out->numargs && in->numargs > 0
434+
&& strcmp(in->args[0],out->args[0]) == 0 )
435+
{
436+
int i;
436437
obj->no_op = MS_TRUE;
438+
for( i = 1; i < in->numargs; i++ )
439+
{
440+
if( strcmp(in->args[i],out->args[i]) != 0 ) {
441+
obj->no_op = MS_FALSE;
442+
break;
443+
}
444+
}
437445
}
446+
438447
/* -------------------------------------------------------------------- */
439448
/* If we have a fully defined input coordinate system and */
440449
/* output coordinate system, then we will use pj_transform */

mapresample.c

+8
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,8 @@ void *msInitProjTransformer( projectionObj *psSrc,
691691
double *padfDstGeoTransform )
692692

693693
{
694+
int backup_src_need_gt;
695+
int backup_dst_need_gt;
694696
msProjTransformInfo *psPTInfo;
695697

696698
psPTInfo = (msProjTransformInfo *) msSmallCalloc(1,sizeof(msProjTransformInfo));
@@ -699,9 +701,15 @@ void *msInitProjTransformer( projectionObj *psSrc,
699701
/* We won't even use PROJ.4 if either coordinate system is */
700702
/* NULL. */
701703
/* -------------------------------------------------------------------- */
704+
backup_src_need_gt = psSrc->gt.need_geotransform;
705+
psSrc->gt.need_geotransform = 0;
706+
backup_dst_need_gt = psDst->gt.need_geotransform;
707+
psDst->gt.need_geotransform = 0;
702708
psPTInfo->bUseProj =
703709
(psSrc->proj != NULL && psDst->proj != NULL
704710
&& msProjectionsDiffer( psSrc, psDst ) );
711+
psSrc->gt.need_geotransform = backup_src_need_gt;
712+
psDst->gt.need_geotransform = backup_dst_need_gt;
705713

706714
/* -------------------------------------------------------------------- */
707715
/* Record source image information. We invert the source */
6 Bytes
Loading
-1 Bytes
Loading
-2 Bytes
Loading
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version='1.0' encoding="UTF-8" ?>
22
<ServiceExceptionReport version="1.2.0"
33
xmlns="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/wcs/1.0.0/OGC-exception.xsd">
4-
<ServiceException code="NoApplicableCode" locator="bbox">msWCSGetCoverage(): WCS server error. Requested BBOX (500.000111169182,499.999999995423,1000.00011052692,999.999999990907) is outside requested coverage BBOX (0,0,400,300)
4+
<ServiceException code="NoApplicableCode" locator="bbox">msWCSGetCoverage(): WCS server error. Requested BBOX (500,500,1000,1000) is outside requested coverage BBOX (0,0,400,300)
55
</ServiceException>
66
</ServiceExceptionReport>

0 commit comments

Comments
 (0)