Re: [OpenMap Users] projection problem

From: duboscqd <duboscqd_at_wanadoo.fr>
Date: Tue, 11 Mar 2008 21:36:35 +0100

Hi John,
thanks for the help,don't know too much about MATLAB even if collegues use it...
...and don't really want to go more in it

Since i post the problem i've worked on it and found a solution, acceptable, at least for my need.
The idea is to find first the longitude that's more dependant on the earth curve,
and find the latitude according to that longitude.
i use also <<LatLonPoint.azimuth(LatLonPoint);>> method to ge the angle after enforcing the latitude (resp. the longitude)
The count (int) is only used to make sure going out of the loops.
The algorithm hereafter converges before reaching the 10 time count
(at least for the tries i performed : the points i'm looking for are maximum 500 DM far from reference point)

// laDistXEnDM is the X distance
// laDistYEnDM is the Y distance
//ref : is the reference LatLonPoint
// res = result : the computed LatLonPoint

        float rads = Math.abs(Length.DM.toRadians((float)laDistXEnDM));
        double angle = Math.PI / 2;
        if ( laDistXEnDM < 0 ){
            angle = - angle;
        }
        LatLonPoint res = ref.getPoint( rads , (float)angle);
        int count = 0;
        while (( Math.abs(res.getLatitude() - ref.getLatitude()) > 0.0001f ) &&
                (count < 10 )){
            count = count + 1;
            res.setLatitude(ref.getLatitude());
            angle = ref.azimuth(res);
            res = ref.getPoint( rads , (float)angle);
// System.out.println("loop 1 : angle = " +
// + Length.DECIMAL_DEGREE.fromRadians(angle) +
// ", Lat = " + res.getLatitude() + ", Lon = " + res.getLongitude());
        }
        float Longitude = res.getLongitude();
        angle = 0;
        rads = Math.abs(Length.DM.toRadians((float)laDistYEnDM));
        if ( laDistYEnDM < 0 ){
            angle = - Math.PI;
        }
        res = ref.getPoint( rads , (float)angle);
        count = 0;
        while (( Math.abs(res.getLongitude() - ref.getLongitude()) > 0.0001f )
                &&
                (count < 10 )){
            count = count + 1;
            res.setLongitude(ref.getLongitude());
            angle = ref.azimuth(res);
            res = ref.getPoint( rads , (float)angle);
        }
        res.setLongitude(Longitude);



  ----- Original Message -----
  From: Jackson, John
  To: duboscqd
  Sent: Tuesday, March 11, 2008 12:57 PM
  Subject: RE: [OpenMap Users] projection problem


  Hi,

   

  I don't know if Openmap has the appropriate tools, but it would be fairly easy to create a library of tools to do just what you need.

   

  I suggest looking for a set of MATLAB routines called Geodetic Toolkit. This toolkit is a "library" of routines to convert between spherical, ellipsoidal and Cartesian coordinates. A few of them will give you what you need.

   

  I've added a zip file (change the extension to .zip from piz). In case you might have a problem finding it I've included the file.

   

  Good Luck.

   

  John

   


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

  From: owner-openmap-users_at_bbn.com [mailto:owner-openmap-users_at_bbn.com] On Behalf Of duboscqd
  Sent: Sunday, March 09, 2008 1:09 AM
  To: openmap-users_at_bbn.com
  Subject: Re: [OpenMap Users] projection problem

   

  Hello again,

   

  A few precisions on my question :

  the point i'm looking for is defined as follow :

  if X = 0 (0 north) the point P1 should have the same latitude as the reference point

  if y = 0 (west) the point should have the same longitude as the reference point

  My problem is to find the longitude Lon1 of a point that has the same latitude as the reference and is X meters west from the reference

  and to find the latitude lat1of a point that has the same longitude as the reference and is Y meters north from the reference.

  My point is (Lat1, Lon1)

   

   

  An exemple : my reference point is 43N006E, and the point i'm looking for is 585 miles east and 60 miles north.

  If I try graphically with the distance tool of OPENMAP,

  when i point 585 miles east of my reference with an angle of -90° i find (about) 42,4N.

  I assume <<ref.getPoint( rads , angle );>> use a +/- 90 angle to go east and west

  (at least it seems according to my differents tries)

   

  In that example, for <<ref.getPoint>>, the angle i should use to find my point should be about -86° that gives a point

  585 miles east with the same latitude (43N),

  of course that angle depends on the distance and i don't know how to find it.

   

  Can i do that with a few calls using existing openmap methods ?

   

    ----- Original Message -----

    From: duboscqd

    To: openmap-users_at_bbn.com

    Sent: Saturday, March 08, 2008 9:33 AM

    Subject: [OpenMap Users] projection problem

     

    Hello,

     

    I would lile to interpret & display data that comes as follow :

    - I receive a reference point with lat/lon data

    - i receive points (let say P1) that is expressed with X (miles or meters) and Y(miles or meters) distance from the reference point.

    The sender gives X and Y according to a flat representation centered on the reference point.

     

    To get the lat/lon of P1 i compute distance (rads) and angle from X and Y then use : ref.getPoint( rads , angle );

     

    However the result is not clean, since it seems that the "getPoint call" computes the lat/lon taking into considerations that the distance is on the earth,

    and in my case the distance is from the flat representation.

     

    I hope my explanantions are clear enough.

    Is there any other transformation method i could use to solve that problem ?

     

    Thx by advance



--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Tue Mar 11 2008 - 17:20:51 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:09 EDT