Re: [Jts-topo-suite-user] distance in meters
Brought to you by:
dr_jts
From: Martin D. <mtn...@te...> - 2011-08-26 15:11:28
|
JTS doesn't currently support geodetic computations, so you'll have to use external code to do this. There's lots of information about how to do this on the web. Try: http://www.movable-type.co.uk/scripts/latlong-vincenty.html He gives a function in Javascript, which should be easy to port to Java. If you do this, consider publishing on the list, so everyone can share. I'll add it to the JTS FAQ as well. Or maybe even to JTS... Martin On 8/26/2011 7:00 AM, Hans Rupp wrote: > Hello list, > > i'am using the following code to compute the distance between two > geographic points (with wgs84 coordinates). > > PrecisionModel precisionModel = new > PrecisionModel(PrecisionModel.FLOATING); > GeometryFactory factory = new GeometryFactory(precisionModel,WGS84SRID); > > Point startPoint = factory.createPoint(new > Coordinate(current.getWgslon(),current.getWgslat())); > > Point tmcPoint = factory.createPoint(new > Coordinate(tmcPosition.getWgslon(),tmcPosition.getWgslat())); > > return startPoint.distance(tmcPoint); > > this returns me small number like 1.7814631938367314E-4. > but i need to know the distance in meters. > can you please tell me how i can transform this jts-distance for WGS84 > into meters > > (the points lie within a distance < 300m so the planar distance should > be sufficient) > > |