Matthias Basler a écrit : > How to query all available units (length, angle) from an authority factory. > In particular I want all units supported by EPSG. > I have never been able to retrieve linear and angular units separately, but > with GeoTools 2.3 the following worked: > CSAuthorityFactory csFactory = ... > Set<String> codes = csFactory.getAuthorityCodes(Unit.class); > Now this method requires the interface "IdentifiedObject", which is not > supported by the Unit class.
You can still uses the above code by cheating with Java 5 generic type: Set<String> codes = csFactory.getAuthorityCodes((Class) Unit.class); You will get "unchecked cast" compiler warning, this is a deprecated practice, etc., but it will work for now. We have no undeprecated methods for fetching the units at this time. The main reason is that the unit system is a totally independant library that we can't retrofit in the "IdentifiedObject" hierarchy. An other reason (maybe not a valid one) is that in current GeoTools implementation, the list of units that are really supported is hard-coded anyway. Martin ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Geotools-devel mailing list Geotools-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-devel