How can I get the distance between two Point?

Help
marksender
2004-12-17
2013-04-03
  • marksender
    marksender
    2004-12-17

    Hello, I'm a new-commer about GIS.....
    As we know, what an easy way to get distance between two GeotoolPoint by calculate manually ourself.  But when I try to use the method of Geotools:  Geometry.Distance(geo) then i will get an error exception at run-time.

    Details my error code:
    ----------------------------------
    GeometryFactory fact = new GeometryFactory();
    Geometry point1 = fact.CreateFromWKT('POINT(5 9)');
    Geometry point2 = fact.CreateFromWKT('POINT(9 3)');

    double distance = point1.Distance(point2);
    ------------------------------------------------

    Is that correct code ????
    Is there any problem ???
    May I have to create Geometry from the same Coordinate (SRID, PreciseModel..) from that code  ??????

    Please help me .....
    Thank u in advance....