Hi,

I want to convert points from "Gauss-Boaga Roma40" to "WGS84" using 
geotools. I have used the following java code:

========================================================================

CoordinateReferenceSystem sourceCRS = CRS.decode("epsg:3003"); // 
Gauss-Boaga Roma40
CoordinateReferenceSystem targetCRS = CRS.decode("epsg:4326"); // WGS84
MathTransform transform = CRS.findMathTransform(sourceCRS, targetCRS, 
false);
GeometryFactory geometryFactory = new GeometryFactory(new PrecisionModel());

Point point = geometryFactory.createPoint(new Coordinate(1664436, 5169278));
Point targetPoint = (Point) JTS.transform(point, transform);
System.out.println(targetPoint.getX());
System.out.println(targetPoint.getY());

========================================================================

but it looks like the resulting point has an error of about 10 meters 
both on lat and lon. The same happens with other
points. All points in my small area (30km x 30km) have all the same error.

I have converted the same source point using cs2cs and the result is 
much better (error < 1m)

========================================================================
echo "1664436 5169278" | cs2cs  +init=epsg:3003 
+towgs84=-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68  +to 
+init=epsg:4326 -f "%.8f"
========================================================================

With others tools I have similar result like cs2cs

Here a geojson with the resulting points

{ "type": "FeatureCollection", "features":[
     { "type": "Feature", "geometry": { "type": "Point", "coordinates": 
[11.14879437, 46.65668144] }, "properties": { "name": "cs2cs"  } }
    ,{ "type": "Feature", "geometry": { "type": "Point", "coordinates": 
[11.148995971698204, 46.65658930259459] }, "properties": { "name": 
"geotools"  } }
  ]}

Why there is such error/offset in geotools conversion?

Thanks in advance for any help!



------------------------------------------------------------------------------
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to