Opened 12 years ago

Closed 12 years ago

#63 closed enhancement (fixed)

r.los: patch to support earth curvature

Reported by: neteler Owned by: grass-dev@…
Priority: major Milestone: 6.4.0
Component: Default Version: svn-trunk
Keywords: Cc: andrea.antonello@…
CPU: Unspecified Platform: Unspecified

Description

Based on ideas from r.cva and prototype code from Andrea Antonello I have added earth curvature support in r.los. Please test.

Markus

Attachments (1)

rlos_curv.diff (8.8 KB) - added by neteler 12 years ago.

Download all attachments as: .zip

Change History (8)

Changed 12 years ago by neteler

Attachment: rlos_curv.diff added

comment:1 Changed 12 years ago by neteler

Type: defectenhancement

comment:3 Changed 12 years ago by hamish

r.los/main.c:
@@ -109,9 +114,13 @@
     opt6->type = TYPE_DOUBLE;
     opt6->required = NO;
     opt6->answer = "10000";
-    opt6->options = "0-999999";
+    opt6->options = "0-9999999999";
     opt6->description = _("Maximum distance from the viewing point (meters)");

Why increase that so much? At the top of Everest, the maximum theoretical distance to the horizon would be about 3.86*sqrt(8850) = 350km = 350,000m.

http://mintaka.sdsu.edu/GF/explain/atmos_refr/horizon.html

make it 500000m?

Should all the new /* try to get the radius ... */ code live behind a check for the -c flag? in case the proj stuff has problems.

Hamish

comment:4 Changed 12 years ago by hopfgartner

The observer might be on an airplane or other aircraft vehicel

comment:5 in reply to:  4 Changed 12 years ago by hopfgartner

Replying to hopfgartner:

The observer might be on an airplane or other aircraft vehicel

Earth radius might be the ultimative limit, as far as refraction is not considered.

comment:6 Changed 12 years ago by pkelly

I've no comment on the maths of the curvature stuff, but I think the code to find the ellpisoid radius should simply use G_get_ellipsoid_parameters() and all the PROJ_INFO parsing and checking for invalid values etc. is taken care of then.

comment:7 Changed 12 years ago by neteler

Resolution: fixed
Status: newclosed

I have simplified the ellipsoid stuff to:

   if (curvature->answer){
      /* try to get the radius the standard GRASS way from the libs */
      G_get_ellipsoid_parameters (&aa, &e2);
      if (aa == 0) {
          /* since there was a problem, take a hardcoded radius :( */
          G_warning(_("Problem to obtain current ellipsoid parameters, using sphere (6370997.0)"));
          aa = 6370997.00;
      }
      G_debug(3, "radius: %f", aa);
    }

Updated earth curvature patch submitted as [c30614] (http://trac.osgeo.org/grass/changeset/c30614).

Markus

Note: See TracTickets for help on using tickets.