Thanks for your answer, solved my problem.
The gt-espg-hsql.jar was in the classpath but the postgresql one
was too, and because of this I've got some errors.
But now, I tryed to make some converstions from mercator to utm
and than convert back to mercator to see if the precision is good
using this code:
...
*
//tryed using coordinates lat,lon as x,y; and lat,lon as y,x
Coordinate[] coordinates = new Coordinate[] {
new Coordinate(-49.00, -16.683),
new Coordinate(-49.300, -16.675)};
Geometry g3 = new GeometryFactory().createLineString(coordinates);
*
*sourceCRS = CRS.decode("EPSG:**3785**"); // Mercator/google maps code*
*targetCRS = CRS.decode("EPSG:31982"); // UTM 22s code from *
http://www.epsg-registry.org/
*MathTransform tx = CRS.findMathTransform(CRSFrom, CRSTo, true);
Geometry transformed = JTS.transform(geom, transform) *
*
*
*The result is this:*
*utm coodinates:*
[(6120584.969417981, 1.0000023079023875E7, NaN),
(6120584.546247176, 1.0000023090352934E7, NaN)]
*convertion back to Mercator:*
[(-8997.836054457479, -17.077226626756676, NaN),
(-8998.130646014215, -17.069201880507137, NaN)]
Am I doing something wrong?
Thanks,
2011/10/23 Andrea Aime <[email protected]>
> On Sun, Oct 23, 2011 at 1:57 AM, Danilo Marques de Rezende <
> [email protected]> wrote:
>
>> Hello,
>> I work on a project using google maps and I need to
>> make a buffer on a route (array of latitude, longitude points)
>> with a specified meters.
>> I was using JTS buffer operation but I discovered that
>> this wouldn't work since google maps uses wgs 84.
>> As I saw on a post of Andrea Aime, from opengeo, I need to do
>> this:
>>
>> MathTransform tx = CRS.findMathTransform(CRSFrom, CRSTo, true);
>> Geometry transformed = JTS.transform(geom, transform)
>>
>> I try that but got some stacktrace, do I need the postgis
>> installed for this to work?
>>
>
> Nope, you only need gt-espg-hsql in the classpath.
>
> See the "user list posting guide" for indication on how make good questions
> (and hopefully get useful answers):
>
> http://docs.geotools.org/latest/userguide/welcome/userlistguide.html
>
> Cheers
> Andrea
>
> --
> -------------------------------------------------------
> Ing. Andrea Aime
> GeoSolutions S.A.S.
> Tech lead
>
> Via Poggio alle Viti 1187
> 55054 Massarosa (LU)
> Italy
>
> phone: +39 0584 962313
> fax: +39 0584 962313
>
> http://www.geo-solutions.it
> http://geo-solutions.blogspot.com/
> http://www.youtube.com/user/GeoSolutionsIT
> http://www.linkedin.com/in/andreaaime
> http://twitter.com/geowolf
>
> -------------------------------------------------------
>
--
Danilo Marques de Rezende
------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn
about Cisco certifications, training, and career opportunities.
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users