Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#5081 closed defect (fixed)

[PATCH] gdalwarp does not honour -s_srs with -cutline option

Reported by: etourigny Owned by: warmerdam
Priority: normal Milestone: 1.10.1
Component: Algorithms Version: unspecified
Severity: normal Keywords: warp, cutline
Cc:

Description

When a cutline is used and source srs is not known (but set using -s_srs option), the following warning is given and source crs remains unknown.

Warning : the input vector layer has a SRS, but the source raster dataset does not.
Cutline results may be incorrect.

This simple patch resolves the issue by using the SRC_SRS value stored in papszTO.

Index: apps/gdalwarp.cpp
===================================================================
--- apps/gdalwarp.cpp	(revision 25996)
+++ apps/gdalwarp.cpp	(working copy)
@@ -2128,6 +2128,9 @@
     else if( GDALGetGCPProjection( hSrcDS ) != NULL )
         pszProjection = GDALGetGCPProjection( hSrcDS );
 
+    if( pszProjection == NULL || EQUAL( pszProjection, "" ) )
+        pszProjection = CSLFetchNameValue( papszTO, "SRC_SRS" );
+
     if( pszProjection != NULL )
     {
         hRasterSRS = OSRNewSpatialReference(NULL);

Change History (3)

comment:1 by Even Rouault, 11 years ago

Etienne, the patch makes sense to me. Please commit.

comment:2 by etourigny, 11 years ago

Resolution: fixed
Status: newclosed

fixed in trunk (r26004), later will apply to 1.10 also along with other patches

comment:3 by etourigny, 11 years ago

fixed in 1.10 (r26006)

Note: See TracTickets for help on using tickets.