Thanks Jody, it is working now. I had to add gt-epsg-hsql-2.7-M0.jar and hsqldb-1.8.0.7.jar
I installed the Quickstart quit but, as you know, GeoTools used libraries are many and when we go through the API docs there are lots of deprecated stuff and externally used classes (as the Vividsolutions ones). So, it is a bit overwhelming for those that are not familiar with GeoTools and all the docs... The good thing is that you really give a good help through the users-list. Everytime I needed I've got the right answer. So, thanks again and keep up with the good work!!! Jose -----Original Message----- From: Jody Garnett [mailto:[email protected]] Sent: January 31, 2011 4:35 PM To: Lopes, Jose (AAFC-AAC) Cc: [email protected] Subject: Re: [Geotools-gt2-users] Transforming CRS projections in GeoJSON Better take a moment to read the user guide. You need to have access to the definitions of the epsg codes; by including *one* of the epsg plugins listed on this page: - http://docs.codehaus.org/display/GEOTDOC/07+Referencing I recommend gt-epsg-hsql Jody On 01/02/2011, at 6:49 AM, Lopes, Jose (AAFC-AAC) wrote: > Hi Jody, > > I found some interesting examples from GeoTools 2.1, 2.2, 2.6 and 2.7 > and they are quite different. > I am using Geotools 2.7 and the code I came up with is this: > > //Vividsolutions classes > GeometryFactory geoFact = new GeometryFactory(); > Coordinate coordinate = new Coordinate(577147.49750272d, > 1252040.3464034d); > Point point = geoFact.createPoint(coordinate); > > //GeoTools classes > CoordinateReferenceSystem epsg26913CRS = CRS.decode("EPSG:26913"); > CoordinateReferenceSystem epsg4326CRS = CRS.decode("EPSG:4326", true); > > boolean lenient = true; // allow for some error due to different datums > MathTransform transform = CRS.findMathTransform(epsg26913CRS, > epsg4326CRS, lenient); > Point newPoint = (Point) JTS.transform(point, transform); > > The problem is that I am getting this exception on the CRS.decode > method: > > org.opengis.referencing.NoSuchAuthorityCodeException: Authority "EPSG" > is unknown or doesn't match the supplied hints. Maybe it is defined in > an unreachable JAR file? > > It compiles and run ok but it looks like I might be missing some > dependencies. > I have the following libraries in my app: > > gt-api-2.7-SNAPSHOT.jar > gt-main-2.7-SNAPSHOT.jar > gt-metadata-2.7-SNAPSHOT.jar > gt-referencing-2.7-SNAPSHOT.jar > gt-shapefile-2.7-SNAPSHOT.jar > gt-swing-2.7-SNAPSHOT.jar > > I need to use as few libraries as possible... So cannot download all > the Maven Geotools repository. > Do you know what gt jar am I missing? > > Thanks > > -----Original Message----- > From: Jody Garnett [mailto:[email protected]] > Sent: January 29, 2011 7:01 PM > To: Lopes, Jose (AAFC-AAC) > Cc: [email protected] > Subject: Re: [Geotools-gt2-users] Transforming CRS projections in > GeoJSON > > > There is code to parse GeoJSON; not sure how much it is used however. > > > To get up to speed with coordinate reference systems and so on check out > the tutorials: > - http://docs.geotools.org/latest/tutorials/ > > > (Most of the time there are two helper classes that do the work for you > "JTS" and "CRS"). > > > Jody > > > > > On 29/01/2011, at 7:22 AM, Lopes, Jose (AAFC-AAC) wrote: > > > Hi, > > I have a set of supported CRS projections (EPSG) and I want to > transform them to longitude-latitude (EPSG:4326), the information is > presented in a GeoJson file. > > In JS with OpenLayers I could do this in one line > (OpenLayers.Projection.transform(point, projFrom, projTo). > > Is there a simple way to do this in Java with GeoTools? (I have not > worked with GeoTools referencing libraries yet...) > > Thanks for any help-tips... > > Jose > > > > ------------------------------------------------------------------------ > ------ > Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! > Finally, a world-class log management solution at an even better > price-free! > Download using promo code Free_Logger_4_Dev2Dev. Offer expires > February 28th, so secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsight-sfd2d______________________________________ > _________ > Geotools-gt2-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users ------------------------------------------------------------------------------ Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
