You need to use GeodeticCalculator class from geotools  - it will calculate 
distance on the ellipsoid (ie it will give you the distance in meters between 
two lat long points - for formular you are using will give you the distance in 
angle). This will still be the straight line distance...

For driving distance you would need to use a route finder; and have a highway 
data set:

-          http://docs.codehaus.org/display/GEOTDOC/Graphs

In the future please email questions directly to the geotools-gt2-users list - 
while you can email implementers directly many can provide you with support 
contract information if you have a reason to to be on public emails lists. For 
more information:

-          http://docs.codehaus.org/display/GEOTDOC/10+Communication+and+Support

Jody

From: sameer hassan [mailto:[email protected]]
Sent: Monday, 17 August 2009 7:58 PM
To: Jody Garnett; [email protected]
Subject: Real Driving Distance in java

Dear Nicolas Gramlich

I am Sameer Hassan a Student at Otto von Guericke University Magdeburg,Germany
i came through the Geo server website http://geoserver.org/display/GEOS/Welcome
which is a open source software server written in Java.
i need to calculate the real driving distance for the lat long stored in mysql 
databse
right now i am doing this in java using the simple mathematical formula


//
protected double distance(double pX, double pY) {
                        double dx=this.x - pX;
                        double dy=this.y - pY;
                        double distance=Math.sqrt(dx * dx + dy * dy);
                        return distance;
            }
//

and stores the result in a distance cache
can you tell me how can i implement the real driving distance to this one
any guidance or help would me much appreciated

--
Regards
Sameer
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to