Re: [OpenMap Users] getting a new latitudes and longitude points from another latitude and longitude

From: Don Dietrick <dietrick_at_bbn.com>
Date: Mon, 3 Oct 2005 13:49:04 -0400

Hi Kedar,

You could use

double kmValue = Length.KM.fromRadians(radianValue);

- Don

On Oct 3, 2005, at 1:37 PM, kedar myadam wrote:

> Hi Don,
>
> I did not find functions for convertiing from
> radians to KM in the class you gave(com.bbn.openmap.proj.Length)..
> Instead
>
> com.bbn.openmap.geo.Geo has the functions for it, i have included
> the code that i have used.
>
> Thanks for helping me,
>
> kedar
>
>
> import com.bbn.openmap.proj.GreatCircle;
> import com.bbn.openmap.LatLonPoint;
> import com.bbn.openmap.geo.Geo;
>
>
>
> public class GetCordinates
> {
>
> public static void main(String[] args)
> {
> GreatCircle gc= null;// = new GreatCircle();
> LatLonPoint lt = new LatLonPoint();
>
>
> //float pi=3.1415f;
> //float phi1=(((28.5f)*(pi))/(180.0f));
> float phi1=(float)(Geo.radians(28.5f)); //start lat point
> //float lam=(((-80.0f)*(pi))/(180.0f));
> float lam=(float)(Geo.radians(-80.0f)); //start long point
> //float c=(((150.0f)*(pi))/(180.0f));
> float c =(float)(Geo.kmToAngle(150.0f)); //distance in
> radians
>
> float Az=(float)(Geo.radians(-45.0f)); //Azimuth upper
> left
>
> float AzLr=(float)(Geo.radians(135.0f)); //Azimuth
> Lower right
>
> //finding the upper left latitude and longitude
> lt = gc.spherical_between(phi1,lam,c,Az);
> float upperlatit=lt.getLatitude();
> float upperlongit =lt.getLongitude();
>
> System.out.println("The upper left latitude and longitude
> points are "+upperlatit+ " " +upperlongit);
>
>
>
> //finding the lower Right latitude and longitude
> lt = gc.spherical_between(phi1,lam,c,AzLr);
> float lowerlatit=lt.getLatitude();
> float lowerlongit =lt.getLongitude();
>
> System.out.println("The Lower Right latitude and longitude
> points are "+lowerlatit+ " " +lowerlongit);
>
>
> }
>
> }
>
>
>
> On 9/29/05, Don Dietrick <dietrick_at_bbn.com> wrote: c should be in
> radians, you can use the com.bbn.openmap.proj.Length
> class to convert from other units (km, miles, etc).
>
> Az should also be in radians. You can use the Length class, or the
> java Math class to convert to radians. west isn't 270, it's -90, but
> you have to convert to radians, too.
>
> - Don
>
>
> On Sep 29, 2005, at 12:19 AM, kedar myadam wrote:
>
> > Hi all,
> >
> > i am trying to figure out the new latitude and
> > longitude from a given point(lat,lon). I think i am messing some
> > things around. I am not sure what the c - arc radius in radians
> > (0 < c <= PI) // what exactly is the arc radius... should i
> > convert Kilometers to radians or some other units to radians. Az -
> > azimuth (direction) east of north (-PI <= Az < PI) // i guess North
> > is 0 and East 90, South 180 and west is 270.
> > I am attaching an image to this mail, that would explain it
> > clearly. The center is at lat,lon(28,-80). and the image represents
> > 150 kms. I am trying to map on to mapbean. For doing that i need to
> > know top left cordinates and lower right coordinates. I have
> > written the code for it but i guess i am doing something wrong, i
> > am ending up getting some wrong coordinates. Can someone tell me
> > where i am wrong.
> >
> > Here is my code,
> >
> > [code]
> >
> >
> >
> > import java.awt.event.ActionEvent;
> > import java.util.ArrayList;
> > import java.util.List;
> > import javax.swing.ImageIcon;
> > import javax.swing.JMenuItem;
> >
> >
> > import com.bbn.openmap.event.MapMouseEvent;
> > import com.bbn.openmap.layer.OMGraphicHandlerLayer;
> > import com.bbn.openmap.omGraphics.OMGraphic;
> > import com.bbn.openmap.omGraphics.OMGraphicList ;
> > import com.bbn.openmap.omGraphics.OMScalingIcon ;
> > import com.bbn.openmap.omGraphics.OMScalingRaster;
> > import java.awt.image.*;
> > import java.awt.*;
> > import java.net.*;
> >
> > import com.bbn.openmap.proj.GreatCircle;
> > import com.bbn.openmap.LatLonPoint;
> >
> >
> > public class GetCordinates
> > {
> >
> > public static void main(String[] args)
> > {
> > GreatCircle gc= null;// = new GreatCircle();
> > LatLonPoint lt = new LatLonPoint();
> >
> > float pi=3.1415f ;
> > float phi1=(((28.5f)*(pi))/(180.0f)); //start point latitude
> > float lam=(((-80.0f)*(pi))/(180.0f)); // start point longitude
> > float c=(((150.0f)*(pi))/(180.0f)); // arc radius in radians
> > (0 < c <= PI)
> > float Az=315.0f //(Azimuth) North-
> > west, I dont know whether i am right
> >
> >
> > lt = gc.spherical_between(phi1,lam,c,Az);
> > float latit=lt.getLatitude();
> > float longit = lt.getLongitude();
> >
> > System.out.println(" "+latit+ " " +longit);
> >
> > float b=lt.azimuth(lt);
> > System.out.println(" "+b);
> > }
> >
> > }
> >
> > [/code]
> >
> >
> > thanks,
> >
> > kedar
> > <img.jpg>
>
>
>
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Don Dietrick, dietrick_at_bbn.com
> BBN Technologies, Cambridge, MA
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
>
>



=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Don Dietrick, dietrick_at_bbn.com
BBN Technologies, Cambridge, MA
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


--
[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 Mon Oct 03 2005 - 13:49:33 EDT

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