Hi,

I am using GeoTools 2.5.0. I want to project data in another CRS to Google
Mercator CRS. I was previously using WKT to create the Google Mercator CRS.

Since now we have an official EPSG code for the same I want to switch over
to that. Please find below the code that I have written.

CRSAuthorityFactory   factory = CRS.getAuthorityFactory(true);

CoordinateReferenceSystem crs =
factory.createCoordinateReferenceSystem("EPSG:3785");

The same code worked when I used EPSG:4326.

I have added gt-epsg-extension-2.5.0.jar to the classpath. Even after doing
so I get the following exception:

Exception in thread "main"
org.opengis.referencing.NoSuchAuthorityCodeException: No code "EPSG:3785"
from authority "European Petroleum Survey Group" found for object of type
"CoordinateReferenceSystem".

      at
org.geotools.referencing.factory.AbstractAuthorityFactory.noSuchAuthorityCode(AbstractAuthorityFactory.java:949)

      at
org.geotools.referencing.factory.epsg.DirectEpsgFactory.createCoordinateReferenceSystem(DirectEpsgFactory.java:2000)

      at
org.geotools.referencing.factory.BufferedAuthorityFactory.createCoordinateReferenceSystem(BufferedAuthorityFactory.java:781)

      at
org.geotools.referencing.factory.AuthorityFactoryAdapter.createCoordinateReferenceSystem(AuthorityFactoryAdapter.java:798)

      at
org.geotools.referencing.factory.BufferedAuthorityFactory.createCoordinateReferenceSystem(BufferedAuthorityFactory.java:781)

      at
org.geotools.referencing.factory.AuthorityFactoryAdapter.createCoordinateReferenceSystem(AuthorityFactoryAdapter.java:798)

      at
org.geotools.referencing.factory.FallbackAuthorityFactory.createCoordinateReferenceSystem(FallbackAuthorityFactory.java:638)

      at
org.geotools.referencing.factory.AuthorityFactoryAdapter.createCoordinateReferenceSystem(AuthorityFactoryAdapter.java:798)

      at
org.geotools.referencing.factory.ThreadedAuthorityFactory.createCoordinateReferenceSystem(ThreadedAuthorityFactory.java:729)

      at
org.geotools.referencing.DefaultAuthorityFactory.createCoordinateReferenceSystem(DefaultAuthorityFactory.java:179)

      at
com.cognizant.clips.data.utils.ShapeFileTransformer.getCoordinateReferenceSystem(ShapeFileTransformer.java:233)

      at
com.cognizant.clips.data.utils.ShapeFileTransformer.main(ShapeFileTransformer.java:90)

I had a similar error when I used EPSG:900913.

I referred to other posts and there was a mention that epsg-ext jar had to
be added to the classpath for this. I am assuming that the jar referred to
is gt-epsg-extension-2.5.0.jar. I have not configured any EPSG databases. On
checking the esri.properties file in gt-epsg-extension-2.5.0.jar, I could
not find an entry for 3785 and 900913.

Please let me know if I am missing something.

Thanks and Regards,

Shyam Sundar.N
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to