Beate Stollberg ha scritto:
> Hi!
>
> I would like to transform Coordinates from EPSG:4326 to EPSG:3035. My
> aim is to calculate the area of a polygon and 3035 is area true.
This is more a question for geotools-users mailing list. I think
Martin Desriusseaux is not subscribed to the geoserver devel mailing
list, but he's the one to ask to for hard projection questions.
> The suggested solution on the geotools website is following:
>
>
> DefaultFactory df = (DefaultFactory)
> FactoryFinder.getCRSAuthorityFactory("EPSG",new
> Hints(Hints.CRS_AUTHORITY_FACTORY, DefaultFactory.class));
> CoordinateReferenceSystem sourceCRS =
> df.createCoordinateReferenceSystem("EPSG:4326");
> CoordinateReferenceSystem targetCRS =
> df.createCoordinateReferenceSystem("EPSG:3035");
> CoordinateOperationFactory coFactory =
> FactoryFinder.getCoordinateOperationFactory(null);
> CoordinateOperation op = coFactory.createOperation(sourceCRS,
> targetCRS); MathTransform oMathTransformer = op.getMathTransform();
Hum, I suggest to use CRS.decode(...) and CRS.findMathTransform(xxx)
instead. They are quicker and easier to user.
> Feature f = ...
>
> Geometry oGeometry = f.getGeometry(); oGeometry =
> JTS.transform(oGeometry,oMathTransformer);
Hmmm... you won't get good results in general. Transformation is
applied point by point, so long lines are projected into other straight
lines, whilst an accurate area computation would require long lines to
be split into smaller segments to allow for curvature (think projecting
a significant segment of a meridian or parallel).
>>> I included the epsg-hsql library in the classpath which also
>>> includes the required Bursa-Wolf-Parameter for the Datum-Shift
>>> (if I understood correct)
>
>>> I calculated so the area for Germany and became a completly wrong
>>> result >> 5.5E11 instead of 3.5E11
>
>
> If I do the same calculation based on the epsg-wkt library (what is
> not recommended) which does NOT include the required
> Bursa-Wolf-Parameter for the Datum-Shift I get the correct result for
> the calculated area!
Hum, this one I leave to Martin, don't really know why you're
getting such a big difference.
Cheers
Andrea
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users