[PROJ] Check if a definition if a cartographic projection

José Luis García Pallero jgpallero at gmail.com
Fri Feb 21 09:31:53 PST 2020


Well, I did more tests, and I think I understand the situation better.

1. The EPSG:XXXXX input mode works only for transformation between
CRS, but not fpr pure projection. This is the reason why although I
can initialize a projection using proj_create(context,proj_definition)
I can't perform the projection. So for cartographic projections it is
necessary to use the "+proj" syntax. Well, I suppose I could perform
the projection defining as the start CRS an ellipsoid as EPSG:4326
(WGS84 ellipsoide, for example) and end CRS any other code
corresponding to a projection onto the same ellipsoid. But I would
like not to use this method in order to avoid the twice definition of
the same ellipsoid. So I think that for my personal FWD and INV
functions for cartographic projection the "+proj" definition method
plus checking for proj_get_type()==PJ_TYPE_OTHER_COORDINATE_OPERATION
and proj_angular_input()==1 for the forward step, and
proj_angular_output()==1 for INV is better.

2. I found that for my interests the most adequate function for
computations is proj_trans_generic(), as it can work with arrays. I
suppose in the FWD step the first two arguments (x,y) ate ALWAYS
(longitude,latitude). Am I right? Also, according to documentation it
returns the number of transformations successfully completed, so if
this number is lower than the number of elements I must found for the
points not transformed. For such finding, is the correct way the test
x[i]==HUGE_VAL or must I check both the x and the y?

Best regards

El vie., 21 feb. 2020 a las 16:19, José Luis García Pallero
(<jgpallero at gmail.com>) escribió:
>
> Thank you for your answer, Kristian. I've made some tests, and I have
> more questions in order to clarification the task of detecting pure
> cartographic projections (I understand as pure cartographic projection
> a definition such that in the FWD step transforms geodetic coordinates
> into projected XY coordinates and vice verda for the INV stap, always
> using the ellipsoid stated in the definition, i.e., in any case a
> transformation between ellipsoids is performed):
>
> 1. If I use a definition based on the "plus" form ("+proj=utm
> +lon_0=3w +ellps=GRS80", i.e., UTM30, ellipsoid GRS80):
>
> In all cases I've checked, the proj_get_type() function always returns
> the identifier PJ_TYPE_OTHER_COORDINATE_OPERATION. Then, I use the
> function proj_angular_input() with the PJ_FWD argument in order to
> check for radians. So the couple
> (PJ_TYPE_OTHER_COORDINATE_OPERATION,1) identifies a definition as a
> pure cartographic projection, i.e. geodetic coordinates as input and
> XY projected as output in PJ_FWD, and vice versa in PJ_INV. Is this
> correct? From your previous message I understand that I won't catch
> all situations like that, but most of them, but the question is: can
> exist any situation of (PJ_TYPE_OTHER_COORDINATE_OPERATION,1) does not
> corresponding to a pure cartographic projection?
>
> I've tried also the +pipeline form you suggested "+proj=pipeline +step
> +unitconvert +xy_in=rad +xy_out=deg +step +proj=<projection>" as
>
> "+proj=pipeline +step +unitconvert +xy_in=rad +xy_out=deg +step
> +proj=utm +lon_0=3w +ellps=GRS80"
>
> in order to work with UTM30 using the GRS80 ellipsoid. Using this
> definition I understand that in the FWD step the input coordinates are
> defined in radians, but for the INV step the output mus be in degrees.
> But when I execute proj_create() with the previous definition I obtain
> the message "proj_create: Error -4: projection not named". Is there
> any error in the definition?
>
> 2. If I use a definition based on the EPSG code:
>
> I've used for example the "EPSG:25830", corresponding to ETRS89 UTM30,
> i.e., the same projection as the previously used ("+proj=utm +lon_0=3w
> +ellps=GRS80"). The proj_get_type() function returns the identifier
> PJ_TYPE_PROJECTED_CRS. Is this type the unique identificator for a
> pure cartographic projection? But in this case the
> proj_angular_input() for FWD returns 0, so it means that the input
> angular coordinates units are not radians. Am I right? But if I try
> the projection I obtain always (Inf,Inf), whether if I use the data in
> radians or in degrees. I suppose I've made a mistake, but I can't
> understand where
>
> Best regards
>
> El vie., 21 feb. 2020 a las 13:42, Kristian Evers (<kreve at sdfe.dk>) escribió:
> >
> > Hi José
> >
> > Congrats on taking the big step towards PRO 6! As you've already found out
> > there are a few changes in how to work with projections. I'll try to answer your
> > questions:
> >
> > 1. I don't think so if you are strictly using proj_create(), but you can use
> > proj_angular_input() and proj_angular_output() to check if the operation
> > you've created with proj_create() behaves as a projection usually do:
> > angular in, non-angular out. You won't catch all situations like that, but
> > most of them.
> > Alternatively you can use proj_create_crs_to_crs() and define the input
> > and output CRS's in terms of EPSG-codes or WKT(2) definitions. In that
> > case you can use proj_get_type() to get an idea about what you are dealing
> > with.
> >
> > 2. If your operation purely consist of "+proj=<projection", then yes. If you
> > expand that into a pipeline like
> > "+proj=pipeline +step +unitconvert +xy_in=rad +xy_out=deg +step +proj=<projection>",
> > then you can use degress.
> >
> > 3. Yes, that phrasing is incorrect and could be improved by mentioning ellipsoids
> > as well.
> >
> > /Kristian
> >
> > -----Original Message-----
> > From: PROJ <proj-bounces at lists.osgeo.org> On Behalf Of José Luis García Pallero
> > Sent: 21. februar 2020 12:39
> > To: proj at lists.osgeo.org
> > Subject: [PROJ] Check if a definition if a cartographic projection
> >
> > Hello:
> >
> > I'm porting an old PROJ4 code for strictly cartographic projections
> > (forward and inverse steps) to version 6 and I'm a bit confused about
> > the definition. I see that I must substitute the old pj_fwd() and
> > pj_inv() by theproj_trans() function, where I set the forward or
> > inverse step via the PJ_DIRECTION input argument. My questions are:
> >
> > 1. Is it possible (has PROJ6 any function or other method) to check
> > the definition in order to guarantee it is strictly a cartographic
> > projection?
> >
> > 2. Must be the geodesic coordinates for the forward cartographic
> > problem always radians?
> >
> > On the other hand, I can read in https://proj.org/operations/index.html
> >
> > "
> > Projections are purely cartographic mappings of the sphere onto the plane
> > "
> >
> > But PROJ also works in the ellipsoid, so I suppose it is a mistake
> >
> > Best regards
> >
> > --
> > *****************************************
> > José Luis García Pallero
> > jgpallero at gmail.com
> > (o<
> > / / \
> > V_/_
> > Use Debian GNU/Linux and enjoy!
> > *****************************************
> > _______________________________________________
> > PROJ mailing list
> > PROJ at lists.osgeo.org
> > https://lists.osgeo.org/mailman/listinfo/proj
>
>
>
> --
> *****************************************
> José Luis García Pallero
> jgpallero at gmail.com
> (o<
> / / \
> V_/_
> Use Debian GNU/Linux and enjoy!
> *****************************************



-- 
*****************************************
José Luis García Pallero
jgpallero at gmail.com
(o<
/ / \
V_/_
Use Debian GNU/Linux and enjoy!
*****************************************


More information about the PROJ mailing list