## Re: [Jts-topo-suite-user] distance in meters

 Re: [Jts-topo-suite-user] distance in meters From: Michael Bedward - 2011-08-31 09:09:20 ```How quick and dirty do you want to be ? :) If your study area is very small (ie. local scale) one thing you could do is fudge the conversion by first calculating the distances corresponding to each of 1 degree shift in longitude and latitude. You could use the simple spherical distance formula to do this: http://en.wikipedia.org/wiki/Geographical_distance#Spherical_Earth_projected_to_a_plane That formula turned into Java (not tested) is below. For my part of the world (Sydney, Australia) this method gives a value with < 1% error on the distance between meridians (for comparison or as an alternative, you could use the online Geod utility at http://geographiclib.sourceforge.net/cgi-bin/Geod). Using the two metres / degree values from above you could compute a single distance in decimal degrees based on the orientation of your line by simple linear interpolation. That's pretty nasty but for a small area away from the poles it would be ok. However, if you have to do a lot of this I'd recommend converting your input data into a more convenient map projection where metres are the distance unit, constructing your Geometry objects in that projection, and converting back if you need to for reporting or drawing. Michael On 31 August 2011 17:51, Hans Rupp wrote: > But one thing i still don't understand. > I want to create buffer for a line between two points (wgs84 coordinates). > > LineString gpsLine = > factory.createLineString(getCoordinateArray(current,last)); >         /* >          * create buffer around that line >          */ > >         Geometry gpsBuffer = gpsLine.buffer(distance); > How can i compute the value for distance that corresponds to e.g. 100m > geodetic distance? > > Hans > > 2011/8/31 Hans Rupp >> >> Thanks for your support, >> >> Hans >> >> >> 2011/8/29 Michael Bedward >>> >>> Hello Hans, >>> >>> If you need something pronto or don't want to write your own code, >>> there is the GeodeticCalculator class in GeoTools which uses the >>> Vincenty method: >>> >>> >>> http://docs.geotools.org/latest/userguide/library/referencing/calculator.html >>> >>> Michael >>> >>> >>> ------------------------------------------------------------------------------ >>> EMC VNX: the world's simplest storage, starting under \$10K >>> The only unified storage solution that offers unified management >>> Up to 160% more powerful than alternatives and 25% more efficient. >>> Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev >>> _______________________________________________ >>> Jts-topo-suite-user mailing list >>> Jts-topo-suite-user@... >>> https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user >> > > ```