Hi Michael. How calculate value direction in geodeticcalculator?

double dir = ... // bearing in decimal degrees (-180 : 180)

many thanks.

-----Mensaje original-----
De: Michael Bedward [mailto:[email protected]] 
Enviado el: martes, 02 de junio de 2009 3:56
Para: Preciado Venero, Abel; geotools users
Asunto: Re: [Geotools-gt2-users] Calculate new Coordinate to distance

Hi Abel,

> Hello michael. I can a problem with GeodeticCalculator. I don't know
two
> point, I know distance. When calculate two coordinate whit the
distance?
>

You need:
1. starting location
2. distance
3. azimuth (= bearing = angle)

Here's an example...

GeodeticCalculator calc = new GeodeticCalculator( myCRS );

// you can do this...
double longitude = ...  // in decimal degrees
double latitude = ...    //
calc.setStartingGeographicPoint( longitude, latitude );

// or this...
DirectPosition startPos = ...
calc.setStartingPosition( startPos );

// then set the distance and bearing from the start point
double distance = ...
double dir = ... // bearing in decimal degrees (-180 : 180)
calc.setDirection( dir, distance );

// now get the destination
DirectPosition destination = calc.getDestinationPosition();

You'll need to put the above code in a try - catch block for
TransformException.

Hope this helps.  Let us know how you go.

Michael

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to