Hello,
With a help of Mr. Jan Jezek I was finally able to resolve my problem.
The final solution looks like this:
Coordinate coord = new Coordinate(1038922.1, 735575.14);
GeometryFactory geometryFactory = new GeometryFactory();
final com.vividsolutions.jts.geom.Point geoPoint =
geometryFactory.createPoint(coord);
CoordinateReferenceSystem sourceCRS =
CRS.decode("EPSG:2065");//Krovak
CoordinateReferenceSystem targetCRS =
CRS.decode("EPSG:4326");//WGS-84
MathTransform transform = CRS.findMathTransform(sourceCRS,
targetCRS, false);
final com.vividsolutions.jts.geom.Geometry geometry =
JTS.transform(geoPoint, transform);
final Coordinate coordinate = geometry.getCoordinate();
System.out.println("coordinate = " + coordinate);
I used these maven dependencies:
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-referencing</artifactId>
<version>9.0-RC1</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-opengis</artifactId>
<version>9.0-RC1</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-geometry</artifactId>
<version>9.0-RC1</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-epsg-hsql</artifactId>
<version>9.0-RC1</version>
</dependency>
<dependency>
<groupId>com.vividsolutions</groupId>
<artifactId>jts</artifactId>
<version>1.13</version>
</dependency>
-Vity
2013/3/12 Mauricio Pazos <[email protected]>
> On Tuesday, March 12, 2013 08:58:36 AM Ladislav Vitásek wrote:
> > Hello,
> > I am just a regular Java developer and I know almost nothing about the
> real
> > world of cartography.
> > I am looking for a "simple" Java function to convert coordinates from
> > Krovak projection into WGS-84. I need to call this function dynamically
> > about 5000x.
> > I didn't found any unit test or description in the wiki showing how to do
> > it with geotools library. Is anybody able to help me?
> >
> > Example entry coordinates:
> > -735575,14;-1038922,1 (x,y)
> >
> > output coordinates (approx.)
> > 50°7'59.200"N, 14°30'48.852"E
> >
> > Thank you.
> >
> >
> > -Vity
> Have you read this tutorial?
>
> http://docs.geotools.org/stable/tutorials/geometry/geometrycrs.html
> Have a look at the "Export Reprojected Shapefile" section
>
> cheers
>
> --
> Mauricio Pazos
>
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users