[PROJ] Use of EPSG codes in proj_create()
Oliver Eichler
oliver.eichler at dspsolutions.de
Tue Apr 2 01:38:45 PDT 2019
Hi,
I am working on the transition of QMapShack from version 4 to version 5
API. So far so good. There is only on thing that breaks. The use of EPSG
codes for projection strings.
That's what I try to do:
// used PROJ version: 6.0.0
// PJ * pj = proj_create(PJ_DEFAULT_CTX, "EPSG:3395"); // [1]
result for x and y is inf
PJ * pj = proj_create(PJ_DEFAULT_CTX, "+proj=merc"); // [2]
result is expected one
// PJ * pj = proj_create(PJ_DEFAULT_CTX, "+init=EPSG:3395") // [3]
pj is nullptr
PJ_COORD pt = {11 * DEG_TO_RAD, 48 * DEG_TO_RAD};
size_t s = proj_trans_generic(pj, PJ_FWD,
&pt.xy.x, 0, 1,
&pt.xy.y, 0, 1,
0,0,0,
0,0,0);
If I use [1] to create a PJ object I succeed with a pointer. However if
I use it in proj_trans_generic() the result for x and y ins INF.
Version [2] is fine and works as expected.
Version [3] fails to create a PJ object, but as far as I understand the
docs this is perfectly fine.
So how is this intended to work? Maybe a bit of background about this:
QMapShack addresses consumers not scientific users. The experience of
the last years revealed that it is much easier to tell a user to use an
EPSG code as projection rather than a lengthy "+proj=..." string with
all kinds of possibilities to introduce typos. That's why I would like
to keep the possibility to use EPSSG codes.
Thanks for feedback
Oliver
More information about the PROJ
mailing list