<div dir="ltr">+1 <font face="Arial" color="black" size="2"><span style="font-size:11pt;font-family:arial;color:black">Mikael</span></font></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 14, 2016 at 1:02 PM, Mikael Rittri <span dir="ltr"><<a href="mailto:Mikael.Rittri@carmenta.com" target="_blank">Mikael.Rittri@carmenta.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div link="blue" vlink="purple" lang="SV">
<div class="m_3027134763447650281Section1">
<p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:11.0pt;font-family:Arial" lang="EN-US">I just want to say that, although I personally will probably not bother to change to the new API, I have always found the traditional source code
of Proj.4 difficult to read, and I am happy to see a new enthusiastic group of developers taking care of Proj.4. The period of stagnation a few years ago was unfortunate.<u></u><u></u></span></font></p>
<div>
<p class="MsoNormal"><font face="Arial" color="black" size="2"><span style="font-size:11.0pt;font-family:Arial;color:black" lang="EN-US"><u></u> <u></u></span></font></p>
<p class="MsoNormal"><font face="Arial" color="black" size="2"><span style="font-size:11.0pt;font-family:Arial;color:black">Mikael Rittri<u></u><u></u></span></font></p>
<p class="MsoNormal"><font face="Arial" color="black" size="2"><span style="font-size:11.0pt;font-family:Arial;color:black">Carmenta
<u></u><u></u></span></font></p>
<p class="MsoNormal"><font face="Arial" color="black" size="2"><span style="font-size:11.0pt;font-family:Arial;color:black">Sweden<br>
<a href="http://www.carmenta.com/" target="_blank"></a></span><a href="http://www.carmenta.com">http://www.carmenta.com</a> </font><font face="Arial"><span style="font-family:Arial"><u></u><u></u></span></font></p>
<p class="MsoNormal"><font face="Calibri" size="2"><span style="font-size:11.0pt"><span><u></u> <u></u></span></span></font></p>
</div>
<div>
<div class="MsoNormal" style="text-align:center" align="center"><font face="Times New Roman" size="3"><span style="font-size:12.0pt;font-family:"Times New Roman"" lang="EN-US">
<hr align="center" size="2" width="100%">
</span></font></div>
<p class="MsoNormal"><b><font face="Tahoma" size="2"><span style="font-size:10.0pt;font-family:Tahoma;font-weight:bold" lang="EN-US">From:</span></font></b><font face="Tahoma" size="2"><span style="font-size:10.0pt;font-family:Tahoma" lang="EN-US"> <a href="mailto:proj-bounces@lists.maptools.org" target="_blank">proj-bounces@lists.maptools.<wbr>org</a>
[mailto:<a href="mailto:proj-bounces@lists.maptools.org" target="_blank">proj-bounces@lists.<wbr>maptools.org</a>] <b><span style="font-weight:bold">On Behalf Of
</span></b>Kristian Evers<br>
<b><span style="font-weight:bold">Sent:</span></b> Thursday, November 03, 2016 3:41 PM<br>
<b><span style="font-weight:bold">To:</span></b> PROJ.4 and general Projections Discussions<br>
<b><span style="font-weight:bold">Subject:</span></b> [Proj] A re-rationalized API for PROJ.4</span></font><font face="Times New Roman" size="3"><span style="font-size:12.0pt;font-family:"Times New Roman"" lang="EN-US"><u></u><u></u></span></font></p>
</div><div><div class="h5">
<p class="MsoNormal"><font face="Calibri" size="2"><span style="font-size:11.0pt"><u></u> <u></u></span></font></p>
<p class="MsoNormal"><font face="Calibri" size="2"><span style="font-size:11.0pt" lang="EN-US">Hello everybody,<u></u><u></u></span></font></p>
<p class="MsoNormal"><font face="Calibri" size="2"><span style="font-size:11.0pt" lang="EN-US"><u></u> <u></u></span></font></p>
<p class="MsoNormal"><font face="Calibri" size="2"><span style="font-size:11.0pt" lang="EN-US">I want to direct your attention to the work Thomas Knudsen is doing on a new and more homogenous API for PROJ.4. Thomas presented his first ideas about a new API
earlier this year when talk about transformation pipelines first started. Since then the initial pipeline pull request has been withdrawn and the changes needed to make transformation pipelines happen are broken into smaller more logical chunks. A new API
being one of those smaller chunks. Before anyone gets their knickers in a twist, let me just stress the fact that this DOES NOT change the behavior of the old API (projects.h/proj_api.h), it merely adds a cleaner interface that will make usage of PROJ.4 a
lot easier in the future. <u></u><u></u></span></font></p>
<p class="MsoNormal"><font face="Calibri" size="2"><span style="font-size:11.0pt" lang="EN-US">Thomas has already typed up a description of his work but until now it has only been available on the GitHub page. This is his introduction to the new API:<u></u><u></u></span></font></p>
<p class="MsoNormal"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US"><u></u> <u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">The original proj API (defined in projects.h) has grown organically<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">over the years, but it has also grown somewhat messy.<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US"><u></u> <u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">The same has happened with the newer high level API (defined in<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">proj_api.h): To support various historical objectives, proj_api.h<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">contains a rather complex combination of conditional defines and<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">typedefs. Probably for good (historical) reasons, which are not<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">always evident from today's perspective.<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US"><u></u> <u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">This is an evolving attempt at creating a re-rationalized API<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">with primary design goals focused on sanitizing the namespaces.<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">Hence, all symbols exposed are being moved to the pj_ namespace,<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">while all data types are being moved to the PJ_ namespace.<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US"><u></u> <u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">Please note that this API is *orthogonal* to the previous APIs:<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">Apart from some inclusion guards, projects.h and proj_api.h are not<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">touched - if you do not include proj.h, the projects and proj_api<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">APIs should work as they always have.<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US"><u></u> <u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">A few implementation details:<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US"><u></u> <u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">Apart from the namespacing efforts, I'm trying to eliminate three<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">proj_api elements, which I have found especially confusing.<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US"><u></u> <u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">FIRST and foremost, I try to avoid typedef'ing away pointer<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">semantics. I agree that it can be occasionally useful, but I<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">prefer having the pointer nature of function arguments being<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">explicitly visible.<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US"><u></u> <u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">Hence, projCtx has been replaced by PJ_CONTEXT *.<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US"><u></u> <u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">SECOND, I try to eliminate cases of information hiding implemented<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">by redefining data types to void pointers.<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US"><u></u> <u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">I prefer using a combination of forward declarations and typedefs.<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">Hence:<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US"> typedef void *projCtx;<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">Has been replaced by:<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US"> struct projCtx_t;<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US"> typedef struct projCtx_t PJ_CONTEXT;<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">This makes it possible for the calling program to know that the<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">PJ_CONTEXT data type exists, and handle pointers to that data type<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">without having any idea about its internals.<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US"><u></u> <u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">(obviously, in this example, struct projCtx_t should also be moved<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">to struct pj_ctx some day...)<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US"><u></u> <u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">THIRD, I try to eliminate implicit type punning. Hence this API<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">introduces the OBSERVATION data type, for generic coordinate and<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">ancillary data handling.<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US"><u></u> <u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">It includes the PJ_SPATIOTEMPORAL and PJ_TRIPLET unions<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">making it possible to make explicit the previously used<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">"implicit type punning", where a XY is turned into a LP by<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">re#defining both as UV, behind the back of the user.<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US"><u></u> <u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">The bare essentials API presented here follows the PROJ.4<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">convention of sailing the coordinate to be reprojected, up on<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">the stack ("call by value"), and symmetrically returning the<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">result on the stack. Although the OBSERVATION object is 4 times<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">as large as the traditional XY and LP objects, timing results<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">have shown the overhead to be very reasonable.<u></u><u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US"><u></u> <u></u></span></font></p>
<p class="MsoNormal" style="margin-left:65.2pt"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US">See pj_proj_test.c for an example of how to use the API.<u></u><u></u></span></font></p>
<p class="MsoNormal"><font face="Consolas" size="2"><span style="font-size:10.0pt;font-family:Consolas" lang="EN-US"><u></u> <u></u></span></font></p>
<p class="MsoNormal"><font face="Calibri" size="2"><span style="font-size:11.0pt" lang="EN-US">The pull request is found at
<a href="https://github.com/OSGeo/proj.4/pull/445" target="_blank">https://github.com/OSGeo/proj.<wbr>4/pull/445</a> and the example code can be found here:
<a href="https://github.com/busstoptaktik/proj.4/blob/pipeline_plus_api/examples/pj_proj_test.c" target="_blank">
https://github.com/<wbr>busstoptaktik/proj.4/blob/<wbr>pipeline_plus_api/examples/pj_<wbr>proj_test.c</a><u></u><u></u></span></font></p>
<p class="MsoNormal"><font face="Calibri" size="2"><span style="font-size:11.0pt" lang="EN-US"><u></u> <u></u></span></font></p>
<p class="MsoNormal"><font face="Calibri" size="2"><span style="font-size:11.0pt" lang="EN-US">Please share your thoughts on the new API that Thomas has been working on. There has already been some discussion about how to expose the thread-contexts of the
PJ-objects. In the current incarnation they are somewhat hidden to the user compared the what’s in proj_api.h. On top of that, Thomas and I have personally discussed the projFileAPI which does not seem to be used outside of PROJ.4 itself (at least nothing
shows up on google, closed source we have no idea about). Is this something people actually need?<u></u><u></u></span></font></p>
<p class="MsoNormal"><font face="Calibri" size="2"><span style="font-size:11.0pt" lang="EN-US"><u></u> <u></u></span></font></p>
<p class="MsoNormal"><font face="Calibri" size="2"><span style="font-size:11.0pt" lang="EN-US">/Kristian<u></u><u></u></span></font></p>
</div></div></div>
</div>
<br>______________________________<wbr>_________________<br>
Proj mailing list<br>
<a href="mailto:Proj@lists.maptools.org">Proj@lists.maptools.org</a><br>
<a href="http://lists.maptools.org/mailman/listinfo/proj" rel="noreferrer" target="_blank">http://lists.maptools.org/<wbr>mailman/listinfo/proj</a><br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Roger Oberholtzer</div>
</div>