Matthias Basler a écrit :
I get a "DefaultFactory", also call 
factory.getAuthorityCodes(CoordinateReferenceSystem.class);
get 3534 (with HSQL) resp. 3325 (with Access) objects back in no time and check
each and every one if it can be instantiated, which takes some seconds. Indeed,
several objects fail this check ... so it is not in vain.

Note that HSQL and Access should returns an identical amount of object. If the number are not the same, this is probably because HSQL and Access are connected to different EPSG database versions. Current epsg-hsql plugin uses EPSG version 6.8.

Getting the list of codes with factory.getAuthorityCodes(...) should be reasonably fast. Instantiating each object is likely to be costly, no matter which EPSG factory is used (HSQL, Access or even the WKT one). It is also likely to consume a fair amount of memory.


Question 1:
  Why do they return a different number of Codes? Is this, because the WKT
  based factory only contains objects that can indeed be instantiated?

No. There is some objects in the WKT factory that can't be instantiated as well. The WKT based factory is a subset of the EPSG database derived indirectly from Proj4 (the original properties file was not created specifically for the Geotools project). It also contains some supplemental codes not found in the official EPSG database, and the axis order are not the same. Actually, epsg-wkt.jar is a particular factory which is a slight departure from the official EPSG database.


Question 2:
  Would it be possible to enhance the DefaultFactory to do some kind of
  (quicker!) check internally and return only objects that can indeed be
  instantiated. Maybe use a "validOnly" hint or sth. similar.

It would be hard to guess if a CRS can be instantiated before to try it. I don't see any other solution at this time other than try all CRS only once for ever, and write the list of valid codes in some text file. A problem is that it may depends on user configuration (available plugins in the class path, existence of JAI installation, etc.).


        Martin.


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to