<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:2094667203;
        mso-list-type:hybrid;
        mso-list-template-ids:372132262 201326607 201326617 201326619 201326607 201326617 201326619 201326607 201326617 201326619;}
@list l0:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=en-NL link="#0563C1" vlink="#954F72" style='word-wrap:break-word'><div class=WordSection1><p class=MsoNormal><span lang=EN-US>Greetings all,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Working with QGIS, I am in need of developing a ‘custom CRS’ with its own origin and orientation. <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>Basically I need a CRS that is DERIVED from a PROJCRS, resulting in a <b>DERIVEDPROJCRS</b>.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>I have done some work to that extent, that can be seen at the following spreadsheet on GitHub:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><a href="https://github.com/Duijndam-Dev/TopoLib/blob/master/TopoLib/Samples/DerivedProjectedCrsTests.xlsb">https://github.com/Duijndam-Dev/TopoLib/blob/master/TopoLib/Samples/DerivedProjectedCrsTests.xlsb</a><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Right now, I do this by hacking a WKT2 string, based on various examples found on the internet.<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><a href="https://gis.stackexchange.com/questions/353022/defining-a-coordinate-system-in-wkt-or-proj-format-that-has-an-affine-transforma">https://gis.stackexchange.com/questions/353022/defining-a-coordinate-system-in-wkt-or-proj-format-that-has-an-affine-transforma</a> <span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><a href="https://gis.stackexchange.com/questions/350228/define-custom-projection-in-qgis-from-some-control-points">https://gis.stackexchange.com/questions/350228/define-custom-projection-in-qgis-from-some-control-points</a> <span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><a href="https://gis.stackexchange.com/questions/408406/qgis-custom-projection-in-wkt-not-saving-prj-file">https://gis.stackexchange.com/questions/408406/qgis-custom-projection-in-wkt-not-saving-prj-file</a> <span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><a href="https://gis.stackexchange.com/questions/366578/custom-crs-for-historic-site-grid">https://gis.stackexchange.com/questions/366578/custom-crs-for-historic-site-grid</a> <span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><a href="https://gis.stackexchange.com/questions/408683/custom-derived-crs-by-affine-transformation-from-epsg32633-setting-as-layer-cr">https://gis.stackexchange.com/questions/408683/custom-derived-crs-by-affine-transformation-from-epsg32633-setting-as-layer-cr</a> <span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span lang=EN-US>Doing the required affine transform is relatively straightforward. What is more of a concern is creating a WKT2 string to setup the DERIVEDPROJCRS.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>In particular, I would like to preserve the USAGE definition and BBOX field. Any closing ID field needs to be removed, as it is no longer valid.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>But the process of editing a WKT2 string is rather error prone. It is not something you’d like a ‘novice’ having to do.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>Now, the fact is that proj supports affine transforms since v6.0.0. See: <a href="https://proj.org/operations/transformations/affine.html?highlight=affine+transformation#">https://proj.org/operations/transformations/affine.html?highlight=affine+transformation#</a><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Finally, to come to my question: would it be possible to define the following workflow in C++ code:<o:p></o:p></span></p><ol style='margin-top:0cm' start=1 type=1><li class=MsoListParagraph style='margin-left:0cm;mso-list:l0 level1 lfo1'><span lang=EN-US>Create a projected CRS object (from EPSG code, or a WKT string)<o:p></o:p></span></li><li class=MsoListParagraph style='margin-left:0cm;mso-list:l0 level1 lfo1'><span lang=EN-US>Apply an affine transformation on this CRS<o:p></o:p></span></li><li class=MsoListParagraph style='margin-left:0cm;mso-list:l0 level1 lfo1'><span lang=EN-US>Export the modified CRS as a WKT string<o:p></o:p></span></li></ol><p class=MsoNormal><span lang=EN-US>This automation would avoid any manual editing of the WKT2 string.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Maybe - if this isn’t the best approach - are any other ways conceivable to achieve my goal ?<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>Much appreciate your advice.<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span lang=NL style='font-size:12.0pt;mso-fareast-language:#0C00'><a href="mailto:Bart.Duijndam@ziggo.nl"><span lang=EN-US>Bart Duijndam</span></a></span><span lang=EN-US style='font-size:12.0pt;mso-fareast-language:#0C00'><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:#0C00'>Geoscience consultant<o:p></o:p></span></p><p class=MsoNormal><span lang=NL style='mso-fareast-language:#0C00'><a href="http://www.duijndam.dev/">www.duijndam.dev</a> <o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>