# Geotools // buffer using different CRS

I'm currently having a problem with Geotools.

I try to generate a buffer (in meter using Lambert 72) on a map that has WGS84 as it's coordinatesystem. (problem is a bit like this one: http://www.mail-archive.com/[email protected]/msg08046.html, however I can't manage to solve my problem with it).

I have a couple of points in a map (in WGS84), and I want to add buffers around it using meters. As said here ( http://docs.geotools.org/latest/userguide/library/jts/operation.html ) you should transform the Geometry into the other CRS, buffer and then go back.

So what I do:

``````CoordinateReferenceSystem WGS = DefaultGeographicCRS.WGS84;
CoordinateReferenceSystem lambert = CRS.decode("EPSG:31300");
MathTransform convertToMeter = CRS.findMathTransform(WGS, lambert,false);
MathTransform convertFromMeter = CRS.findMathTransform(lambert, WGS,false);

//Start
targetGeometry=(Point) simpleFeature.getDefaultGeometry();
//transform to meter
targetGeometry = JTS.transform(targetGeometry, convertToMeter);
targetGeometry= targetGeometry.buffer(1000d);
//go back to WGS 84
targetGeometry = JTS.transform(targetGeometry, convertFromMeter);
``````

So now I expect to get a buffer of 1000meters, however what I get is a buffer of around 750meter, and I don't have any clue why.

Anyone could give me some advice (or could tell me the stupid error I'm making)?

Browsing one of the given links a couple of times over and trying with a different file, I realised that the I did need to alter the:

``````CoordinateReferenceSystem WGS = CRS.decode("EPSG:4326");
CoordinateReferenceSystem lambert = CRS.decode("EPSG:31300");
``````

to:

``````CoordinateReferenceSystem WGS = CRS.decode("EPSG:4326",true);
CoordinateReferenceSystem lambert = CRS.decode("EPSG:31300",true);
``````

to alter the longitude to the first coordinate and then it comes out right. I expected that if the CRS was wrong the error would be bigger. Anyway solved now.