rHEALPix new parameters

classic Classic list List threaded Threaded
24 messages Options
12
Reply | Threaded
Open this post in threaded view
|

rHEALPix new parameters

Michael Speth
Greetings,
   I've implemented the HEALPix projection and have now moved on to
implementing a new projection called rHEALPix.  I have two questions
regarding this implementation.

* rHEALPix requires 2 new parameters (spole and npole).  How do I
specify those parameters on the command line?  (In the code I am using
the pr_param function.

* The rHEALPix projection uses the HEALPix projection.  So is it
possible to create a header with corresponding c file that shares common
functions between the HEALPix and rHEALPix projections?  If so, how
should I name the files?

Thanks

--
Michael Speth
Scientific Programmer
Landcare Research

_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: rHEALPix new parameters

Frank Warmerdam
On 11-10-13 06:22 PM, Michael Speth wrote:
> Greetings,
>     I've implemented the HEALPix projection and have now moved on to
> implementing a new projection called rHEALPix.  I have two questions
> regarding this implementation.
>
> * rHEALPix requires 2 new parameters (spole and npole).  How do I
> specify those parameters on the command line?  (In the code I am using
> the pr_param function.

Michael,

To the best of my knowledge you just grab them with pj_param().  You
don't need to do anything special to declare them.

> * The rHEALPix projection uses the HEALPix projection.  So is it
> possible to create a header with corresponding c file that shares common
> functions between the HEALPix and rHEALPix projections?  If so, how
> should I name the files?

I would suggest just putting both projections in one source file to avoid
needing the external header file.  It is not uncommon to have more than one
related projection in a single file (eg. tmerc and utm in PJ_tmerc).

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, [hidden email]
light and sound - activate the windows | http://pobox.com/warmerda
and watch the world go round - Rush    | Geospatial Software Developer

_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: rHEALPix new parameters

Michael Speth
Thanks Frank! 
* New Parameters *
For adding new parameters, what is the command line syntax?

Example: proj -v +proj=rhealpix +lon_0=0 +a=1 +R_A +ellps=WGS84 npole=0 spole=0 -E <<EOF 0 0 EOF

This doesn't seem to work.  I've also tried using +npole=0 and +spole=0 and also doesn't work.  How do I fix this?

* On Combining 2 Projections into 1 File
Typically, there are 2 to 4 Functions FORWARD(s_forward), INVERSE(s_forward), and etc.  Would I need to create 8 of these functions (4 for each projection)?

For instance, can I do the following:
ENTRY0(healpix)
if(P->es){
        P->inv = e_inverse; P->fwd = e_h_forward;
    }else{
        P->inv = s_inverse; P->fwd = s_h_forward;
    }
ENDENTRY(P)
ENTRY0(rhealpix)
if(P->es){
        P->inv = e_inverse; P->fwd = e_rh_forward;
    }else{
        P->inv = s_inverse; P->fwd = s_rh_forward;
    }
ENDENTRY(P)

Note, e_h_forward would correspond to the function FOWARD(e_h_forward) and etc.

Thank you for your help.



On 14/10/11 17:43, Frank Warmerdam wrote:
On 11-10-13 06:22 PM, Michael Speth wrote:
Greetings,
    I've implemented the HEALPix projection and have now moved on to
implementing a new projection called rHEALPix.  I have two questions
regarding this implementation.

* rHEALPix requires 2 new parameters (spole and npole).  How do I
specify those parameters on the command line?  (In the code I am using
the pr_param function.
Michael,

To the best of my knowledge you just grab them with pj_param().  You
don't need to do anything special to declare them.

* The rHEALPix projection uses the HEALPix projection.  So is it
possible to create a header with corresponding c file that shares common
functions between the HEALPix and rHEALPix projections?  If so, how
should I name the files?
I would suggest just putting both projections in one source file to avoid
needing the external header file.  It is not uncommon to have more than one
related projection in a single file (eg. tmerc and utm in PJ_tmerc).

Best regards,


-- 
Michael Speth
Scientific Programmer
Landcare Research

_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: rHEALPix new parameters

Frank Warmerdam
On Sun, Oct 16, 2011 at 3:27 PM, Michael Speth
<[hidden email]> wrote:
> Thanks Frank!
> * New Parameters *
> For adding new parameters, what is the command line syntax?
>
> Example: proj -v +proj=rhealpix +lon_0=0 +a=1 +R_A +ellps=WGS84 npole=0
> spole=0 -E <<EOF 0 0 EOF
>
> This doesn't seem to work.  I've also tried using +npole=0 and +spole=0 and
> also doesn't work.  How do I fix this?


Michael,

I'm not sure.  With the "+" prefix, they should be available for pj_params
calls.  If you provide your code I could investigate.

> * On Combining 2 Projections into 1 File
> Typically, there are 2 to 4 Functions FORWARD(s_forward),
> INVERSE(s_forward), and etc.  Would I need to create 8 of these functions (4
> for each projection)?


Yes, I imagine so.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, [hidden email]
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Software Developer
_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: rHEALPix new parameters

Michael Speth
Thanks for looking into this.  Here is a link to the source.  Note, I have combined the healpix and rhealpix (still have more to implement on rhealpix).  The spole and npole parameters used can be found on lines 471, 472, 493, and 494.

http://code.scenzgrid.org/index.php/p/scenzgrid-proj4/source/tree/master/src/PJ_healpix.c

Thanks

On 17/10/11 11:55, Frank Warmerdam wrote:
On Sun, Oct 16, 2011 at 3:27 PM, Michael Speth
[hidden email] wrote:
Thanks Frank!
* New Parameters *
For adding new parameters, what is the command line syntax?

Example: proj -v +proj=rhealpix +lon_0=0 +a=1 +R_A +ellps=WGS84 npole=0
spole=0 -E <<EOF 0 0 EOF

This doesn't seem to work.  I've also tried using +npole=0 and +spole=0 and
also doesn't work.  How do I fix this?

Michael,

I'm not sure.  With the "+" prefix, they should be available for pj_params
calls.  If you provide your code I could investigate.

* On Combining 2 Projections into 1 File
Typically, there are 2 to 4 Functions FORWARD(s_forward),
INVERSE(s_forward), and etc.  Would I need to create 8 of these functions (4
for each projection)?

Yes, I imagine so.

Best regards,


-- 
Michael Speth
Scientific Programmer
Landcare Research

_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: rHEALPix new parameters

Frank Warmerdam
Michael,

I see you have not been working against PROJ trunk.  PROJ trunk
has moved to using a "context" structure for thread safety reasons in
many calls and you are clearly not yet caught up to that.  I'm not really
inclined to make a lot of changes to just get things working against
trunk.  If you can update to trunk I'll take another look.

Best regards,


On Sun, Oct 16, 2011 at 5:38 PM, Michael Speth
<[hidden email]> wrote:

> Thanks for looking into this.  Here is a link to the source.  Note, I have
> combined the healpix and rhealpix (still have more to implement on
> rhealpix).  The spole and npole parameters used can be found on lines 471,
> 472, 493, and 494.
>
> http://code.scenzgrid.org/index.php/p/scenzgrid-proj4/source/tree/master/src/PJ_healpix.c
>
> Thanks
>
> On 17/10/11 11:55, Frank Warmerdam wrote:
>
> On Sun, Oct 16, 2011 at 3:27 PM, Michael Speth
> <[hidden email]> wrote:
>
> Thanks Frank!
> * New Parameters *
> For adding new parameters, what is the command line syntax?
>
> Example: proj -v +proj=rhealpix +lon_0=0 +a=1 +R_A +ellps=WGS84 npole=0
> spole=0 -E <<EOF 0 0 EOF
>
> This doesn't seem to work.  I've also tried using +npole=0 and +spole=0 and
> also doesn't work.  How do I fix this?
>
> Michael,
>
> I'm not sure.  With the "+" prefix, they should be available for pj_params
> calls.  If you provide your code I could investigate.
>
> * On Combining 2 Projections into 1 File
> Typically, there are 2 to 4 Functions FORWARD(s_forward),
> INVERSE(s_forward), and etc.  Would I need to create 8 of these functions (4
> for each projection)?
>
> Yes, I imagine so.
>
> Best regards,
>
>
> --
> Michael Speth
> Scientific Programmer
> Landcare Research
>
> _______________________________________________
> Proj mailing list
> [hidden email]
> http://lists.maptools.org/mailman/listinfo/proj
>



--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, [hidden email]
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Software Developer
_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: rHEALPix new parameters

Michael Speth
Hello.  I updated the source to use the trunk.  Here are the updated changes.

http://code.scenzgrid.org/index.php/p/scenzgrid-proj4/source/tree/master/src/PJ_healpix.c

Thank you for looking over the source!

On 17/10/11 14:14, Frank Warmerdam wrote:
Michael,

I see you have not been working against PROJ trunk.  PROJ trunk
has moved to using a "context" structure for thread safety reasons in
many calls and you are clearly not yet caught up to that.  I'm not really
inclined to make a lot of changes to just get things working against
trunk.  If you can update to trunk I'll take another look.

Best regards,


On Sun, Oct 16, 2011 at 5:38 PM, Michael Speth
[hidden email] wrote:
Thanks for looking into this.  Here is a link to the source.  Note, I have
combined the healpix and rhealpix (still have more to implement on
rhealpix).  The spole and npole parameters used can be found on lines 471,
472, 493, and 494.

http://code.scenzgrid.org/index.php/p/scenzgrid-proj4/source/tree/master/src/PJ_healpix.c

Thanks

On 17/10/11 11:55, Frank Warmerdam wrote:

On Sun, Oct 16, 2011 at 3:27 PM, Michael Speth
[hidden email] wrote:

Thanks Frank!
* New Parameters *
For adding new parameters, what is the command line syntax?

Example: proj -v +proj=rhealpix +lon_0=0 +a=1 +R_A +ellps=WGS84 npole=0
spole=0 -E <<EOF 0 0 EOF

This doesn't seem to work.  I've also tried using +npole=0 and +spole=0 and
also doesn't work.  How do I fix this?

Michael,

I'm not sure.  With the "+" prefix, they should be available for pj_params
calls.  If you provide your code I could investigate.

* On Combining 2 Projections into 1 File
Typically, there are 2 to 4 Functions FORWARD(s_forward),
INVERSE(s_forward), and etc.  Would I need to create 8 of these functions (4
for each projection)?

Yes, I imagine so.

Best regards,


--
Michael Speth
Scientific Programmer
Landcare Research

_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj





-- 
Michael Speth
Scientific Programmer
Landcare Research

_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: rHEALPix new parameters

Frank Warmerdam
On Sun, Oct 16, 2011 at 7:18 PM, Michael Speth
<[hidden email]> wrote:
> Hello.  I updated the source to use the trunk.  Here are the updated
> changes.
>
> http://code.scenzgrid.org/index.php/p/scenzgrid-proj4/source/tree/master/src/PJ_healpix.c
>
> Thank you for looking over the source!

Michael,

Ah, you called my bluff!  Debugging through the code
I see the problem is (at least) that you did not specify a
type code in the pj_param code.  You need to prefix the
parameter name with a type code character - 'i' for an
integer parameter.

eg.
    int npole = pj_param(P->ctx, P->params,"inpole").i;
    int spole = pj_param(P->ctx,P->params,"ispole").i;

By the way, it is more conventional to collect such parameters
in your initialization functions and to declare them as part of
your projection details via the PROJ_PARMS__ macro.  You can
see an example of this early in PJ_gstmerc.c for instance.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, [hidden email]
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Software Developer
_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: rHEALPix new parameters

Michael Speth
Thank you Frank!
   I've added your recommended fixes and it works!  We will now start
thoroughly testing.  Do you have any suggestions for testing?

Thanks

On 17/10/11 16:19, Frank Warmerdam wrote:

> On Sun, Oct 16, 2011 at 7:18 PM, Michael Speth
> <[hidden email]>  wrote:
>> Hello.  I updated the source to use the trunk.  Here are the updated
>> changes.
>>
>> http://code.scenzgrid.org/index.php/p/scenzgrid-proj4/source/tree/master/src/PJ_healpix.c
>>
>> Thank you for looking over the source!
> Michael,
>
> Ah, you called my bluff!  Debugging through the code
> I see the problem is (at least) that you did not specify a
> type code in the pj_param code.  You need to prefix the
> parameter name with a type code character - 'i' for an
> integer parameter.
>
> eg.
>      int npole = pj_param(P->ctx, P->params,"inpole").i;
>      int spole = pj_param(P->ctx,P->params,"ispole").i;
>
> By the way, it is more conventional to collect such parameters
> in your initialization functions and to declare them as part of
> your projection details via the PROJ_PARMS__ macro.  You can
> see an example of this early in PJ_gstmerc.c for instance.
>
> Best regards,


--
Michael Speth
Scientific Programmer
Landcare Research

_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: rHEALPix new parameters

Frank Warmerdam
On Mon, Oct 17, 2011 at 7:00 PM, Michael Speth
<[hidden email]> wrote:
> Thank you Frank!
>   I've added your recommended fixes and it works!  We will now start
> thoroughly testing.  Do you have any suggestions for testing?

Michael,

Nothing deep, no.  But I would like to have a few representative
test points to incorporate into proj/nad/testvarious so you might
want to consider including that in the submission patch.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, [hidden email]
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Software Developer
_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: rHEALPix new parameters

Michael Speth
Greetings,
   How is the tv_out.dist file generated?
   Also, does Proj.4 have any conventions for indicating that a given
set of parameters for a projection are invalid?

Thanks for your help!

On 18/10/11 15:41, Frank Warmerdam wrote:

> On Mon, Oct 17, 2011 at 7:00 PM, Michael Speth
> <[hidden email]>  wrote:
>> Thank you Frank!
>>    I've added your recommended fixes and it works!  We will now start
>> thoroughly testing.  Do you have any suggestions for testing?
> Michael,
>
> Nothing deep, no.  But I would like to have a few representative
> test points to incorporate into proj/nad/testvarious so you might
> want to consider including that in the submission patch.
>
> Best regards,


--
Michael Speth
Scientific Programmer
Landcare Research

_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: rHEALPix new parameters

Frank Warmerdam
On Wed, Oct 19, 2011 at 1:35 PM, Michael Speth
<[hidden email]> wrote:
> Greetings,
>   How is the tv_out.dist file generated?

Michael,

The file is generated by running the script and renaming the
output file after human review shows any diffs are due to newly
added good results.


>   Also, does Proj.4 have any conventions for indicating that a given
> set of parameters for a projection are invalid?

I'm not sure how you mean.  In the cs2cs output?  In the code?  In
the docs?

In the code for PJ_tmerc.c you can see how errors in +zone=
values are reported with E_ERROR() during projection initialization.

Best regards,

> Thanks for your help!
>
> On 18/10/11 15:41, Frank Warmerdam wrote:
>> On Mon, Oct 17, 2011 at 7:00 PM, Michael Speth
>> <[hidden email]>  wrote:
>>> Thank you Frank!
>>>    I've added your recommended fixes and it works!  We will now start
>>> thoroughly testing.  Do you have any suggestions for testing?
>> Michael,
>>
>> Nothing deep, no.  But I would like to have a few representative
>> test points to incorporate into proj/nad/testvarious so you might
>> want to consider including that in the submission patch.
>>
>> Best regards,
>
>
> --
> Michael Speth
> Scientific Programmer
> Landcare Research
>
> _______________________________________________
> Proj mailing list
> [hidden email]
> http://lists.maptools.org/mailman/listinfo/proj
>



--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, [hidden email]
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Software Developer
_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: rHEALPix new parameters

Eric Miller-4
Frank,

Did you have any thoughts on dealing with the minus zero problem in the test comparisons?  I guess some compilers (Intel, others?) will print "-0.00" in some cases which causes the textual comparison to "0.00" to fail.

See the message from "brick <[hidden email]>" on 9/27.
--

Eric G. Miller
Staff Programmer
CA Dept. of Fish & Game


>>> On 10/19/2011 at  1:54 PM, Frank Warmerdam <[hidden email]> wrote:
> On Wed, Oct 19, 2011 at 1:35 PM, Michael Speth
> <[hidden email]> wrote:
>> Greetings,
>>   How is the tv_out.dist file generated?
>
> Michael,
>
> The file is generated by running the script and renaming the
> output file after human review shows any diffs are due to newly
> added good results.
>
>
>>   Also, does Proj.4 have any conventions for indicating that a given
>> set of parameters for a projection are invalid?
>
> I'm not sure how you mean.  In the cs2cs output?  In the code?  In
> the docs?
>
> In the code for PJ_tmerc.c you can see how errors in +zone=
> values are reported with E_ERROR() during projection initialization.
>
> Best regards,
>
>> Thanks for your help!
>>
>> On 18/10/11 15:41, Frank Warmerdam wrote:
>>> On Mon, Oct 17, 2011 at 7:00 PM, Michael Speth
>>> <[hidden email]>  wrote:
>>>> Thank you Frank!
>>>>    I've added your recommended fixes and it works!  We will now start
>>>> thoroughly testing.  Do you have any suggestions for testing?
>>> Michael,
>>>
>>> Nothing deep, no.  But I would like to have a few representative
>>> test points to incorporate into proj/nad/testvarious so you might
>>> want to consider including that in the submission patch.
>>>
>>> Best regards,
>>
>>
>> --
>> Michael Speth
>> Scientific Programmer
>> Landcare Research
>>
>> _______________________________________________
>> Proj mailing list
>> [hidden email]
>> http://lists.maptools.org/mailman/listinfo/proj 
>>
>
>


_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: rHEALPix new parameters

Frank Warmerdam
On Wed, Oct 19, 2011 at 2:33 PM, Eric Miller <[hidden email]> wrote:
> Frank,
>
> Did you have any thoughts on dealing with the minus zero problem in the test comparisons?  I guess some compilers (Intel, others?) will print "-0.00" in some cases which causes the textual comparison to "0.00" to fail.
>
> See the message from "brick <[hidden email]>" on 9/27.

Eric,

My suggestion would be that we pick test points that don't result in a
zero result.  :-)

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, [hidden email]
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Software Developer
_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: rHEALPix new parameters

support.mn
In reply to this post by Michael Speth
Michael,

Proj.4 does not have any deep checking for parameters, it is
very basic and simple library. It just usually makes something
wrong without giving any error messages about the wrong
results. There was a discussion about to add a syntax checker
in front of proj.4, kind of a pre processor which would sort out
the most obvious errors. But that addition is waiting for a better
day to be done. Until then the user must be very careful not to
enter anything wrong to it.

Janne.

----------------------------------------------------------------

Michael Speth [[hidden email]] kirjoitti:
> Greetings,
>    How is the tv_out.dist file generated?
>    Also, does Proj.4 have any conventions for indicating that a given
> set of parameters for a projection are invalid?
>

_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: rHEALPix new parameters

Michael Speth
In reply to this post by Frank Warmerdam
Greetings,
   The E_ERROR calls the set_errno function.  Is there a header file that contains a reference to the error codes for proj.4?  In the case of HEALPix and rHEALPix, I want to report that for the inverse of these projections, that the point is not within the projection space.  Also, for the rHEALPix, I want to report that the values for npole and spole are invalid.

How should I choose the the values to pass to errno?

Thanks

On 20/10/11 09:54, Frank Warmerdam wrote:
On Wed, Oct 19, 2011 at 1:35 PM, Michael Speth
[hidden email] wrote:
Greetings,
  How is the tv_out.dist file generated?
Michael,

The file is generated by running the script and renaming the
output file after human review shows any diffs are due to newly
added good results.


  Also, does Proj.4 have any conventions for indicating that a given
set of parameters for a projection are invalid?
I'm not sure how you mean.  In the cs2cs output?  In the code?  In
the docs?

In the code for PJ_tmerc.c you can see how errors in +zone=
values are reported with E_ERROR() during projection initialization.

Best regards,

Thanks for your help!

On 18/10/11 15:41, Frank Warmerdam wrote:
On Mon, Oct 17, 2011 at 7:00 PM, Michael Speth
[hidden email]  wrote:
Thank you Frank!
   I've added your recommended fixes and it works!  We will now start
thoroughly testing.  Do you have any suggestions for testing?
Michael,

Nothing deep, no.  But I would like to have a few representative
test points to incorporate into proj/nad/testvarious so you might
want to consider including that in the submission patch.

Best regards,

--
Michael Speth
Scientific Programmer
Landcare Research

_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj





-- 
Michael Speth
Scientific Programmer
Landcare Research

_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: rHEALPix new parameters

Frank Warmerdam
Michael,

The full list of proj.4 errors are in pj_strerrno.c.  I have added
a few #define constants for errors in projects.h, but I haven't
tried to add these for older errors.  Right now it can be relatively
hard to find all the places a particular error code might come from!

On Mon, Oct 31, 2011 at 12:20 PM, Michael Speth
<[hidden email]> wrote:
> Greetings,
>    The E_ERROR calls the set_errno function.  Is there a header file that
> contains a reference to the error codes for proj.4?  In the case of HEALPix
> and rHEALPix, I want to report that for the inverse of these projections,
> that the point is not within the projection space.  Also, for the rHEALPix,
> I want to report that the values for npole and spole are invalid.
>
> How should I choose the the values to pass to errno?

I guess just look at the error text and try to chose something appropriate.
I'd generally not encourage adding new error codes if avoidable.

Note that a point not being in the projection space on inverse
projection is (I think) normally just represented by returning
HUGE_VAL, not by setting an error number.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, [hidden email]
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Software Developer
_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: rHEALPix new parameters

Michael Speth
Hi Frank,
  There are 4 errors that I want to generate which are only in the inverse projections and not the forward.  However, the E_ERROR directive seems to only work in the ENTRY and SETUP functions (because it returns an int). 

From looking at proj.c, the forward or inverse functions are called after the setup code which includes the ENTRY0; I think that I am unable to check in the ENTRY0 directive for the error conditions for inverse projections.  Is this correct?

So should I use the I_ERROR directive in this case?  If so, it doesn't seem to allow for entering errno values (its defined as -20).  Can I create a new directive similar to E_ERROR(err) but for I_ERROR?

Thanks

On 01/11/11 08:28, Frank Warmerdam wrote:
Michael,

The full list of proj.4 errors are in pj_strerrno.c.  I have added
a few #define constants for errors in projects.h, but I haven't
tried to add these for older errors.  Right now it can be relatively
hard to find all the places a particular error code might come from!

On Mon, Oct 31, 2011 at 12:20 PM, Michael Speth
[hidden email] wrote:
Greetings,
   The E_ERROR calls the set_errno function.  Is there a header file that
contains a reference to the error codes for proj.4?  In the case of HEALPix
and rHEALPix, I want to report that for the inverse of these projections,
that the point is not within the projection space.  Also, for the rHEALPix,
I want to report that the values for npole and spole are invalid.

How should I choose the the values to pass to errno?
I guess just look at the error text and try to chose something appropriate.
I'd generally not encourage adding new error codes if avoidable.

Note that a point not being in the projection space on inverse
projection is (I think) normally just represented by returning
HUGE_VAL, not by setting an error number.

Best regards,


-- 
Michael Speth
Scientific Programmer
Landcare Research

_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: rHEALPix new parameters

Frank Warmerdam
On Mon, Oct 31, 2011 at 1:31 PM, Michael Speth
<[hidden email]> wrote:

> Hi Frank,
>   There are 4 errors that I want to generate which are only in the inverse
> projections and not the forward.  However, the E_ERROR directive seems to
> only work in the ENTRY and SETUP functions (because it returns an int).
>
> From looking at proj.c, the forward or inverse functions are called after
> the setup code which includes the ENTRY0; I think that I am unable to check
> in the ENTRY0 directive for the error conditions for inverse projections.
> Is this correct?
>
> So should I use the I_ERROR directive in this case?  If so, it doesn't seem
> to allow for entering errno values (its defined as -20).  Can I create a new
> directive similar to E_ERROR(err) but for I_ERROR?

Michael,

I would actually encourage you to actually explicitly call
the error code instead of using the opaque I_ERROR
or a similar macro.  For instance in PJ_tmerc.c I now do:

        /*
         * Fail if our longitude is more than 90 degrees from the
         * central meridian since the results are essentially garbage.
         * Is error -20 really an appropriate return value?
         *
         *  http://trac.osgeo.org/proj/ticket/5
         */
        if( lp.lam < -HALFPI || lp.lam > HALFPI )
        {
            xy.x = HUGE_VAL;
            xy.y = HUGE_VAL;
            pj_ctx_set_errno( P->ctx, -14 );
            return xy;
        }

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, [hidden email]
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Software Developer
_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Reply | Threaded
Open this post in threaded view
|

Re: rHEALPix new parameters

Michael Speth
Greetings,
  I've updated
the code to use pj_ctx_set_errno.  Thanks!  What is the command line flag for displaying the error code/error string?

Thanks

On 01/11/11 09:45, Frank Warmerdam wrote:
On Mon, Oct 31, 2011 at 1:31 PM, Michael Speth
[hidden email] wrote:
Hi Frank,
  There are 4 errors that I want to generate which are only in the inverse
projections and not the forward.  However, the E_ERROR directive seems to
only work in the ENTRY and SETUP functions (because it returns an int).

From looking at proj.c, the forward or inverse functions are called after
the setup code which includes the ENTRY0; I think that I am unable to check
in the ENTRY0 directive for the error conditions for inverse projections.
Is this correct?

So should I use the I_ERROR directive in this case?  If so, it doesn't seem
to allow for entering errno values (its defined as -20).  Can I create a new
directive similar to E_ERROR(err) but for I_ERROR?
Michael,

I would actually encourage you to actually explicitly call
the error code instead of using the opaque I_ERROR
or a similar macro.  For instance in PJ_tmerc.c I now do:

        /*
         * Fail if our longitude is more than 90 degrees from the
         * central meridian since the results are essentially garbage.
         * Is error -20 really an appropriate return value?
         *
         *  http://trac.osgeo.org/proj/ticket/5
         */
        if( lp.lam < -HALFPI || lp.lam > HALFPI )
        {
            xy.x = HUGE_VAL;
            xy.y = HUGE_VAL;
            pj_ctx_set_errno( P->ctx, -14 );
            return xy;
        }

Best regards,


-- 
Michael Speth
Scientific Programmer
Landcare Research

_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
12