<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1043303" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1043303</link>
    <description></description>
    <language>en</language>
          <item>
    <title>The shot is assigned an</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/calculate-direction-using-two-latlon-coordinate-pairs#comment-1239858</link>
    <description> &lt;p&gt;The shot is assigned an X-coordinate by adding (type 1) or multiplying&lt;br /&gt;
(type 2) DFLS (distance from the last shot) to the X-coordinate of the&lt;br /&gt;
shot.  Each receiver is assigned an X-coordinate by adding the&lt;br /&gt;
shot-receiver distance to the shot X-coordinate.  The  RP X-coordinate&lt;br /&gt;
is calculated by assuming the RP is halfway between the shot and&lt;br /&gt;
receiver.  The RP number is the RP X-coordinate divided by DBRPS&lt;br /&gt;
(distance between RPs) and truncating to an integer.  The coordinate of&lt;br /&gt;
the first shot of the job is the shot number (from the header) times the&lt;br /&gt;
distance from the previous shot.  i.e.&lt;br /&gt;
      xs = FLOAT(lhead(3)) * dfls&lt;br /&gt;
      rx = FLOAT(lhead(10))&lt;br /&gt;
      xr = xs + rx&lt;br /&gt;
      xrp = (xr + xs) / 2.&lt;br /&gt;
      lhead(6) = NINT( xrp/dbrps )&lt;/p&gt;
&lt;p&gt;&lt;em&gt;[Mod Edit: Link removed. Please use your forum signature instead, cheers]&lt;/em&gt;&lt;/p&gt;
 </description>
     <pubDate>Fri, 27 Mar 2009 11:17:00 +0000</pubDate>
 <dc:creator>bloggingnews</dc:creator>
 <guid isPermaLink="false">comment 1239858 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>As a soon to be maths</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/calculate-direction-using-two-latlon-coordinate-pairs#comment-1239816</link>
    <description> &lt;p&gt;As a soon to be maths graduate I can tell you that this would be easiest solved in a polar coordinates system (as that is basically what lat and lon lines are). You can then calculate the arc length easily to give you the distance travelled and as it is all in a nice vector you can process it correctly to give an accurate direction of travel as well. It would also allow you to deal with your issue of moving over the poles etc. &lt;/p&gt;
&lt;p&gt;If you want any more math help on it let me know.&lt;/p&gt;
 </description>
     <pubDate>Thu, 26 Mar 2009 15:09:10 +0000</pubDate>
 <dc:creator>kht</dc:creator>
 <guid isPermaLink="false">comment 1239816 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>pr0gr4mm3r wrote:
You can</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/calculate-direction-using-two-latlon-coordinate-pairs#comment-1239384</link>
    <description> &lt;p&gt;&lt;div class=&quot;quote-msg&quot;&gt;&lt;div class=&quot;quote-author&quot;&gt;&lt;em&gt;pr0gr4mm3r&lt;/em&gt; wrote:&lt;/div&gt;You can travel east all you want...you won&#039;t cross the equator. ;)&lt;/div&gt;That was my point&lt;br /&gt;
&lt;div class=&quot;quote-msg&quot;&gt;&lt;div class=&quot;quote-author&quot;&gt;&lt;em&gt;greg&lt;/em&gt; wrote:&lt;/div&gt;Or what if you traveled east across the equator?&lt;/div&gt;&lt;br /&gt;
I know wording could have been better, such as &quot;along&quot; the equator, but I thought lat2-lat1=0 would have pointed to that.&lt;/p&gt;
&lt;p&gt;The degrees are angular degrees, as it&#039;s for a sphere.&lt;br /&gt;
360° circumference&lt;/p&gt;
 </description>
     <pubDate>Sun, 15 Mar 2009 18:07:10 +0000</pubDate>
 <dc:creator>greg</dc:creator>
 <guid isPermaLink="false">comment 1239384 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Nope, degrees are degrees.</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/calculate-direction-using-two-latlon-coordinate-pairs#comment-1239383</link>
    <description> &lt;p&gt;Nope, degrees are degrees. &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/wink.png&quot; title=&quot;Wink&quot; alt=&quot;Wink&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Sun, 15 Mar 2009 17:46:39 +0000</pubDate>
 <dc:creator>kazimmerman</dc:creator>
 <guid isPermaLink="false">comment 1239383 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Thanks for that link - I&#039;m</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/calculate-direction-using-two-latlon-coordinate-pairs#comment-1239380</link>
    <description> &lt;p&gt;Thanks for that link - I&#039;m going to try this forumla:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;ATAN2(COS(lat1)*SIN(lat2)-SIN(lat1)*COS(lat2)*COS(lon2-lon1), SIN(lon2-lon1)*COS(lat2))&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;When I look up &lt;a href=&quot;http://www.php.net/manual/en/function.sin.php&quot;&gt;sin()&lt;/a&gt; in the PHP manual, it says that the parameter must be provided in radians, not degrees.  This is probably a stupid question, but the lat/lon &quot;degrees&quot; is different from the angle &quot;degree&quot;, correct?  Or do I need to pass the coordinates through the &lt;a href=&quot;http://www.php.net/manual/en/function.sin.php&quot;&gt;deg2rad()&lt;/a&gt; function first?&lt;/p&gt;
 </description>
     <pubDate>Sun, 15 Mar 2009 16:53:10 +0000</pubDate>
 <dc:creator>pr0gr4mm3r</dc:creator>
 <guid isPermaLink="false">comment 1239380 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>I&#039;m getting the direction</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/calculate-direction-using-two-latlon-coordinate-pairs#comment-1239379</link>
    <description> &lt;p&gt;I&#039;m getting the direction from the last two coordinates from the GPS, usually 1-3 seconds apart.  It would only give an inaccurate reading for a couple seconds when I cross the 0 degree line.  I can live with that. &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Or what if you traveled east across the equator?&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;You can travel east all you want...you won&#039;t cross the equator. &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/wink.png&quot; title=&quot;Wink&quot; alt=&quot;Wink&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Sun, 15 Mar 2009 16:50:00 +0000</pubDate>
 <dc:creator>pr0gr4mm3r</dc:creator>
 <guid isPermaLink="false">comment 1239379 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Your suggesting lat2-lat1</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/calculate-direction-using-two-latlon-coordinate-pairs#comment-1239374</link>
    <description> &lt;p&gt;Your suggesting lat2-lat1 isn&#039;t going to allow for accuracy.&lt;br /&gt;
Subtracting lat1 from lat2 would work MOST times on a basic journey of one point to another, as would Kurtis&#039; idea of checking which was the greater.&lt;/p&gt;
&lt;p&gt;But if you want more accuracy and provide for any possible journey around a globe, you obviously need to carry out a lot more checks to determine various things. (I&#039;m sure you both knew that, but it&#039;s an interesting topic and I wanted to chip in &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/grin.png&quot; title=&quot;Laugh&quot; alt=&quot;Laugh&quot; class=&quot;smiley-content&quot; /&gt;)&lt;/p&gt;
&lt;p&gt;What if one of the two points goes beyond either pole, you travel from lat2 at +60, past the south pole (-90) and back beyond the north pole to +70. The cardinal direction would show north - lat2-lat1=+10, and you&#039;d get the same result if you simply determine which is the greater value of the two.&lt;br /&gt;
Or what if you traveled east across the equator? Last time I looked, 0 minus 0 equals 0.&lt;br /&gt;
That of course is simply a check if lat1=0 &amp;amp;&amp;amp; lat2=0 you are trying to determine if east or west, even then you may pass beyond the -180 or +180 and still need the additional checks the same as with latitude passing a pole.&lt;/p&gt;
&lt;p&gt;You could also calculate intercardinal, and cardinal or intercardinal directions for each point on a journey.&lt;br /&gt;
2.5 miles south-east, then 1 mile south, then 3 miles south-west etc.&lt;/p&gt;
&lt;p&gt;Hmm, interesting...sounds like a fun set of if/elses &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/grin.png&quot; title=&quot;Laugh&quot; alt=&quot;Laugh&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Sun, 15 Mar 2009 11:10:00 +0000</pubDate>
 <dc:creator>greg</dc:creator>
 <guid isPermaLink="false">comment 1239374 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Well, I don&#039;t have much time</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/calculate-direction-using-two-latlon-coordinate-pairs#comment-1239370</link>
    <description> &lt;p&gt;Well, I don&#039;t have much time to pluck through it right now, but &lt;a href=&quot;http://www.movable-type.co.uk/scripts/latlong.html&quot;&gt;this site&lt;/a&gt; does those computations and provides the source behind it.  You&#039;re going for the bearing, if I&#039;m not mistaken. &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/wink.png&quot; title=&quot;Wink&quot; alt=&quot;Wink&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Sun, 15 Mar 2009 02:07:51 +0000</pubDate>
 <dc:creator>kazimmerman</dc:creator>
 <guid isPermaLink="false">comment 1239370 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>That was my initial thought.</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/calculate-direction-using-two-latlon-coordinate-pairs#comment-1239369</link>
    <description> &lt;p&gt;That was my initial thought.  I could also subtract lat2 - lat1.  A negative number would yield one direction, and the other would be the other direction.  Same for lon2 - lon1.  The problem with both of these methods is that I was looking for a more specific result, like a number from 0 to 360.  Simple programs like &lt;a href=&quot;http://curioustech.home.insightbb.com/compass.htm&quot;&gt;this one&lt;/a&gt; can do it.&lt;/p&gt;
 </description>
     <pubDate>Sun, 15 Mar 2009 01:20:49 +0000</pubDate>
 <dc:creator>pr0gr4mm3r</dc:creator>
 <guid isPermaLink="false">comment 1239369 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>I&#039;m not really sure how the</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/calculate-direction-using-two-latlon-coordinate-pairs#comment-1239368</link>
    <description> &lt;p&gt;I&#039;m not really sure how the degrees of lat/lon are given to you, but here&#039;s my thinking:&lt;/p&gt;
&lt;p&gt;To figure the direction from one lat/lon pair to another, find the slope (remember slope from high school math?) between the two pairs.  Latitude would be like the y-axis on a graph, and longitude would be like the x-axis on the graph.  Treat degrees longitude east of Prime Meridian as positive and degrees west of the line should be changed to negative values.  Same for degrees latitude above and below the equator, respectively.  Then, create two points: (lon1,lat1),(lon2,lat2) and find the slope:&lt;/p&gt;
&lt;p&gt;(lat2-lat1)/(lon2-lon1) would be the slope, and then we can determine the direction based on the value of this number:&lt;/p&gt;
&lt;p&gt;if slope = 0, then direction is either east or west (determine using denominator)&lt;br /&gt;
if slope = (DIVISION BY ZERO ERROR), then direction is either north or south (I would actually check the denominator for zero first to determine this to avoid an actual PHP error)&lt;br /&gt;
if slope &amp;gt; 0, then direction is northeast or southwest (determine by comparing actual lat/lon values&lt;br /&gt;
if slope &amp;lt; 0, then direction is northwest or southeast (same as before)&lt;/p&gt;
&lt;p&gt;Hope this helped a little...if not, I can explain in more detail. &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/wink.png&quot; title=&quot;Wink&quot; alt=&quot;Wink&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Sun, 15 Mar 2009 00:45:11 +0000</pubDate>
 <dc:creator>kazimmerman</dc:creator>
 <guid isPermaLink="false">comment 1239368 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
