mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-05 00:04:40 -05:00
[processing][gdal] Strip newlines from custom proj CRS definitions
before passing to GDAL commands Fixes #19855
This commit is contained in:
parent
fb80835911
commit
e005d6e2b9
@ -447,5 +447,5 @@ class GdalUtils:
|
||||
if crs.authid().upper().startswith('EPSG:'):
|
||||
return crs.authid()
|
||||
|
||||
# fallback to proj4 string
|
||||
return crs.toProj4()
|
||||
# fallback to proj4 string, stripping out newline characters
|
||||
return crs.toProj4().replace('\n', ' ').replace('\r', ' ')
|
||||
|
||||
@ -292,6 +292,13 @@ class TestGdalAlgorithms(unittest.TestCase, AlgorithmsTestBase.AlgorithmsTest):
|
||||
self.assertTrue(crs.isValid())
|
||||
self.assertEqual(GdalUtils.gdal_crs_string(crs),
|
||||
'+proj=utm +zone=36 +south +a=600000 +b=70000 +towgs84=-143,-90,-294,0,0,0,0 +units=m +no_defs')
|
||||
# check that newlines are stripped
|
||||
crs = QgsCoordinateReferenceSystem()
|
||||
crs.createFromProj4(
|
||||
'+proj=utm +zone=36 +south\n +a=600000 +b=70000 \r\n +towgs84=-143,-90,-294,0,0,0,0 +units=m\n+no_defs')
|
||||
self.assertTrue(crs.isValid())
|
||||
self.assertEqual(GdalUtils.gdal_crs_string(crs),
|
||||
'+proj=utm +zone=36 +south +a=600000 +b=70000 +towgs84=-143,-90,-294,0,0,0,0 +units=m +no_defs')
|
||||
|
||||
def testAssignProjection(self):
|
||||
context = QgsProcessingContext()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user