https://issues.qgis.org/https://issues.qgis.org/favicon.ico2011-08-29T17:34:04ZQGIS Issue TrackingQGIS Application - Feature request #4236: Add ability to (over)write CRS for an existing raster file e.g. to geotif or to .aux.xml file for jpg + jgwhttps://issues.qgis.org/issues/4236?journal_id=255382011-08-29T17:34:04ZAlister Hood
<ul></ul><p>Just for information, here is an example .aux.xml which defines CRS:</p>
<pre><PAMDataset>
<Metadata domain="xml:ESRI" format="xml">
<GeodataXform xsi:type="typens:IdentityXform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:typens="http://www.esri.com/schemas/ArcGIS/9.2">
<SpatialReference xsi:type="typens:ProjectedCoordinateSystem">
<WKT>PROJCS[&quot;GD_1949_New_Zealand_Map_Grid&quot;,GEOGCS[&quot;GCS_New_Zealand_1949&quot;,DATUM[&quot;D_New_Zealand_1949&quot;,SPHEROID[&quot;International_1924&quot;,6378388.0,297.0]],PRIMEM[&quot;Greenwich&quot;,0.0],UNIT[&quot;Degree&quot;,0.0174532925199433]],PROJECTION[&quot;New_Zealand_Map_Grid&quot;],PARAMETER[&quot;False_Easting&quot;,2510000.0],PARAMETER[&quot;False_Northing&quot;,6023150.0],PARAMETER[&quot;Central_Meridian&quot;,173.0],PARAMETER[&quot;Latitude_Of_Origin&quot;,-41.0],UNIT[&quot;Meter&quot;,1.0]]</WKT>
<XOrigin>-149973.520044524</XOrigin>
<YOrigin>-339656.819984179</YOrigin>
<XYScale>1052125299.09217</XYScale>
<ZOrigin>0</ZOrigin>
<ZScale>8192</ZScale>
<MOrigin>-100000</MOrigin>
<MScale>10000</MScale>
<XYTolerance>0.001</XYTolerance>
<ZTolerance>2</ZTolerance>
<MTolerance>2</MTolerance>
<HighPrecision>true</HighPrecision>
</SpatialReference>
</GeodataXform>
</Metadata>
</PAMDataset></pre> QGIS Application - Feature request #4236: Add ability to (over)write CRS for an existing raster file e.g. to geotif or to .aux.xml file for jpg + jgwhttps://issues.qgis.org/issues/4236?journal_id=277532011-12-16T13:11:25ZGiovanni Manghigiovanni.manghi@gmail.com
<ul><li><strong>Target version</strong> set to <i>Version 1.7.4</i></li></ul> QGIS Application - Feature request #4236: Add ability to (over)write CRS for an existing raster file e.g. to geotif or to .aux.xml file for jpg + jgwhttps://issues.qgis.org/issues/4236?journal_id=303082012-04-15T08:09:28ZGiovanni Manghigiovanni.manghi@gmail.com
<ul><li><strong>Target version</strong> changed from <i>Version 1.7.4</i> to <i>Version 2.0.0</i></li></ul> QGIS Application - Feature request #4236: Add ability to (over)write CRS for an existing raster file e.g. to geotif or to .aux.xml file for jpg + jgwhttps://issues.qgis.org/issues/4236?journal_id=357642012-10-06T00:15:21ZPirmin Kalberer
<ul><li><strong>Target version</strong> changed from <i>Version 2.0.0</i> to <i>Future Release - Nice to have</i></li></ul> QGIS Application - Feature request #4236: Add ability to (over)write CRS for an existing raster file e.g. to geotif or to .aux.xml file for jpg + jgwhttps://issues.qgis.org/issues/4236?journal_id=561262014-10-08T19:53:16ZMiroslav Umlaufmiroslav.umlauf@gmail.com
<ul></ul><p>It actually would be nice to have. And it shouldn't be that hard. When I am creating JPGs from TIF with -co WORDFILE=YES it actually creates *.wld file plus .aux.xml with:</p>
<pre>
<PAMDataset>
<SRS>PROJCS["WGS 84 / Pseudo-Mercator",...]</SRS>
</PAMDataset>
</pre>
<p>JPGs created this way are opened by QGIS straight (QGIS does not prompt for CRS).</p> QGIS Application - Feature request #4236: Add ability to (over)write CRS for an existing raster file e.g. to geotif or to .aux.xml file for jpg + jgwhttps://issues.qgis.org/issues/4236?journal_id=771162017-04-30T22:50:07ZGiovanni Manghigiovanni.manghi@gmail.com
<ul><li><strong>Easy fix?</strong> set to <i>No</i></li></ul> QGIS Application - Feature request #4236: Add ability to (over)write CRS for an existing raster file e.g. to geotif or to .aux.xml file for jpg + jgwhttps://issues.qgis.org/issues/4236?journal_id=857172018-01-10T02:36:26ZAlister Hood
<ul><li><strong>Description</strong> updated (<a href="/journals/diff/85717?detail_id=74364" title="View differences">diff</a>)</li></ul><p>Miroslav Umlauf wrote:</p>
<blockquote>
<p>And it shouldn't be that hard.</p>
</blockquote>
<p>Correct - e.g. you can write the CRS information like this:</p>
<p><code>gdal_edit.py -ro -a_srs EPSG:2105 "C:\Processing\1.jpg"</code></p>
<p>A complicating factor in this case is that the jpeg driver requires -ro:</p>
<p><code>gdal_edit.py -stats "C:\Processing\1.jpg" <br />ERROR 6: The JPEG driver does not support update access to existing datasets.</code></p>
<p>But there may be files that don't require -ro, and in those cases I guess it would be best not to use -ro. (By default the gdal driver normally writes statistics when you open a raster in QGIS (or at least used to) - are these always written to a .aux.xml file? I can't figure out how to enable it to test - I thought I'd disabled it by setting GDAL_PAM_ENABLED=NO in the QGIS options, but it isn't showing up there.)</p> QGIS Application - Feature request #4236: Add ability to (over)write CRS for an existing raster file e.g. to geotif or to .aux.xml file for jpg + jgwhttps://issues.qgis.org/issues/4236?journal_id=857182018-01-10T02:46:39ZAlister Hood
<ul></ul><p>Alister Hood wrote:</p>
<blockquote>
<p>It would be good if QGIS could create .aux.xml files containing CRS information, <strong>probably after prompting for CRS when a raster layer is added.</strong></p>
</blockquote>
<p>Thinking about it, writing it when loading a layer would be bad, as people probably often guess a CRS, to see if the raster shows up in the right place, and they wouldn't want it written if they'd guessed the wrong CRS.<br />So I guess it would be better to provide an option to "Save CRS with layer", either from the right-click menu in the TOC (I'm sure this wouldn't be accepted, on the basis that the menu is busy), or in the coordinate reference system selector.</p> QGIS Application - Feature request #4236: Add ability to (over)write CRS for an existing raster file e.g. to geotif or to .aux.xml file for jpg + jgwhttps://issues.qgis.org/issues/4236?journal_id=857192018-01-10T02:47:52ZAlister Hood
<ul></ul><p>Also see <a class="issue tracker-2 status-1 priority-4 priority-" href="https://issues.qgis.org/issues/5005" title="Display layer's native CRS, and provide the ability to remove any override (Open)">#5005</a> and <a class="issue tracker-1 status-1 priority-4 priority-" href="https://issues.qgis.org/issues/4100" title="Text for two CRS dialogues is wrong (swapped) (Open)">#4100</a></p> QGIS Application - Feature request #4236: Add ability to (over)write CRS for an existing raster file e.g. to geotif or to .aux.xml file for jpg + jgwhttps://issues.qgis.org/issues/4236?journal_id=857332018-01-10T23:28:27ZAlister Hood
<ul></ul><p>Alister Hood wrote:</p>
<blockquote>
<p>So I guess it would be better to provide an option to "Save CRS with layer"</p>
</blockquote>
<p>To be clear, I meant to suggest a button, rather than a checkbox or something.</p> QGIS Application - Feature request #4236: Add ability to (over)write CRS for an existing raster file e.g. to geotif or to .aux.xml file for jpg + jgwhttps://issues.qgis.org/issues/4236?journal_id=857342018-01-10T23:30:07ZAlister Hood
<ul></ul><p>Alister Hood wrote:</p>
<blockquote>
<p>But there may be files that don't require -ro, and in those cases I guess it would be best not to use -ro. (By default the gdal driver normally writes statistics when you open a raster in QGIS (or at least used to) - are these always written to a .aux.xml file? I can't figure out how to enable it to test - I thought I'd disabled it by setting GDAL_PAM_ENABLED=NO in the QGIS options, but it isn't showing up there.)</p>
</blockquote>
<p>Ah, of course - I don't have .aux.xml generation disabled currently, I'd just forgotten that they aren't actually written until the layer is removed or the project closed.</p>
<p>Testing opening a tiff without embedded statistics in QGIS, I see the statistics are written to a .aux.xml file. This seems sub-optimal if I can write statistics to the actual tiff using gdal_edit, but it does mean that if we always wrote CRS to a .aux.xml we would be consistent.</p> QGIS Application - Feature request #4236: Add ability to (over)write CRS for an existing raster file e.g. to geotif or to .aux.xml file for jpg + jgwhttps://issues.qgis.org/issues/4236?journal_id=857352018-01-10T23:37:37ZAlister Hood
<ul></ul><p>Incidentally, <code>gdal_edit -ro -a_srs ...</code> doesn't do anything for a tiff, and if the tiff file is read-only <code> gdal_edit -ro -a_srs...</code> fails silently.</p> QGIS Application - Feature request #4236: Add ability to (over)write CRS for an existing raster file e.g. to geotif or to .aux.xml file for jpg + jgwhttps://issues.qgis.org/issues/4236?journal_id=882892018-03-05T05:30:20ZAlister Hood
<ul><li><strong>Description</strong> updated (<a href="/journals/diff/88289?detail_id=77166" title="View differences">diff</a>)</li><li><strong>Subject</strong> changed from <i>Write CRS to .aux.xml file when adding raster with no embedded CRS information</i> to <i>Add ability to (over)write CRS for an existing raster file e.g. to geotif or to .aux.xml file for jpg + jgw</i></li></ul> QGIS Application - Feature request #4236: Add ability to (over)write CRS for an existing raster file e.g. to geotif or to .aux.xml file for jpg + jgwhttps://issues.qgis.org/issues/4236?journal_id=882902018-03-05T05:33:44ZAlister Hood
<ul></ul><p>I have rewritten the description including adding an example of the less obvious benefits of this feature i.e. one of the frustrating problems it would help to avoid.</p> QGIS Application - Feature request #4236: Add ability to (over)write CRS for an existing raster file e.g. to geotif or to .aux.xml file for jpg + jgwhttps://issues.qgis.org/issues/4236?journal_id=939202018-10-05T10:13:58ZAlister Hood
<ul></ul><p>Re the suggested workaround to use gdal_edit, I see that this is now available in Processing, as "Assign Projection". Unfortunately it doesn't allow editing the command to use -ro, so it is no use for jpeg layers.</p>