Title: RE: [Geotools-gt2-users] Geodetic Calculator crash

Martin,

Thank you for your reply on this.  Answers to your questions regarding the problem...

-I'm running GT2.2RC3.
-Downloaded the entire GT2 bin package from sourceforge and have it on the classpath.

The problem is handled as a Warning, and the code does continue to run.

I did not intentionally install an EPSG database.  So, the only way that I have one is if it is buried in
one of the GT2 jar's.

Using your recommendation on CRS referencing below, I tried the following snippet, which generated a similar Warning stack:

--------

import org.geotools.referencing.CRS;
import org.opengis.referencing.NoSuchAuthorityCodeException;
import org.opengis.referencing.crs.CoordinateReferenceSystem;

public class CRSDemo {

        public static void main(String[] args) {
                CoordinateReferenceSystem myCRS;
                  try {
                        myCRS = CRS.decode("EPSG:4326");
                } catch (NoSuchAuthorityCodeException e) {
                        e.printStackTrace();
                        System.exit(1);
                }
        }
}

------------

Oct 1, 2006 9:15:59 AM DefaultFactory isReady
WARNING: Unavailable authority factory: European Petroleum Survey Group
org.opengis.referencing.FactoryException: Failed to connect to the EPSG database.
        at org.geotools.referencing.factory.epsg.DefaultFactory.createBackingStore(DefaultFactory.java:335)
        at org.geotools.referencing.factory.DeferredAuthorityFactory.getBackingStore(DeferredAuthorityFactory.java:188)
        at org.geotools.referencing.factory.BufferedAuthorityFactory.isReady(BufferedAuthorityFactory.java:206)
        at org.geotools.referencing.factory.DeferredAuthorityFactory.isReady(DeferredAuthorityFactory.java:176)
        at org.geotools.factory.FactoryRegistry$1.filter(FactoryRegistry.java:86)
        at javax.imageio.spi.FilterIterator.advance(Unknown Source)
        at javax.imageio.spi.FilterIterator.<init>(Unknown Source)
        at javax.imageio.spi.ServiceRegistry.getServiceProviders(Unknown Source)
        at org.geotools.factory.FactoryRegistry.getServiceProviders(FactoryRegistry.java:126)
        ........etc...

If we assume that somehow, magically, my code always had this problem, how can I fix this problem with CRS referencing?

-Jeff





-----Original Message-----
From: Martin Desruisseaux [mailto:[EMAIL PROTECTED]]
Sent: Thu 9/28/2006 5:43 PM
To: Hyink, Jeffrey (LCDR)
Cc: [email protected]
Subject: Re: [Geotools-gt2-users] Geodetic Calculator crash

Hyink, Jeffrey (LCDR) a écrit :
> I've had a handful of classes that have implemented the Geodetic
> Calculator to compute distances that have worked fine for a few months. 
> On recent runs, I started getting a stack of errors when instantiating
> the calculator to the same CRS that I was using before.

I need a few more informations:

* Which Geotools version are you using?
* How did you get the JARs (download from Sourceforge, built with Maven, etc.)?
* Which Geotools JAR are in your classpath?


> WARNING: Unavailable authority factory: European Petroleum Survey Group
> org.opengis.referencing.FactoryException: Failed to connect to the EPSG database.
>
> [...snip...]
>
> at org.geotools.referencing.FactoryFinder.getCoordinateOperationFactory(FactoryFinder.java:280)
> at org.geotools.referencing.GeodeticCalculator.<init>(GeodeticCalculator.java:292)

This is a warning, it should not be a fatal error (does your program stopped to
run?). However this is not yet clear to me why this warning occurs.

In the above case, failure to connect to the EPSG database means that coordinate
operations may be less accurate than they could be, but Geotools should still be
able to fallback on some more approximative coordinate operations.


> calculator = new GeodeticCalculator();
>
> Is the previous constructor invoking a factory that is connecting to
> something?

No, it should not connect to any database.


> I don't think I altered any other code that would have
> involved this error.

Did you changed your classpath? Or do you have an EPSG database installed on you
system (for example de database in MS-Access format downloaded from
www.epsg.org) with a new setting?


> Also, for my own knowledge/testing purposes, is there a way to get an
> instance of various CRS's?  Right now, I'm pulling them from shapefile
> .prj files, but is there a way to generate an instance with a static
> reference of some kind?

You have a choice:

If you know the EPSG code (for example "EPSG:4326"), then you can use the
following convenience method (CRS is a convenience class documented here):

http://javadoc.geotools.fr/2.3/org/geotools/referencing/CRS.html

     CoordinateReferenceSystem myCRS = CRS.decode("EPSG:4326");

Or if you have the CRS definition as a Well Known Text (WKT), you can use the
following convenience method:

     CoordinateReferenceSystem myCRS = CRS.parseWKT(...);

You can also build the CRS programmatically, but this require more code and
knowledge.

        Martin

-------------------------------------------------------------------------
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

Reply via email to