Filter returned referencing codes, f.e. 2D only -----------------------------------------------
Key: GEOT-813 URL: http://jira.codehaus.org/browse/GEOT-813 Project: GeoTools Type: Improvement Components: referencing Versions: 2.2-RC0 Reporter: Matthias Basler Assigned to: Martin Desruisseaux When using a coordinate authoritty factory (f.e. for EPSG) to query the available codes there is currently no possibility to tell the factory to restrict the returned codes. However ofthen only 2D or 3D CRS or CS are needed, or the returned objects must be valid in a certain area (f.e. US, Canada or between 5 and 12 degree east). Currently one typical workflow is: CRSAuthorityFactory crsAFactory = FactoryFinder.getCRSAuthorityFactory("EPSG", null); Set<String> codes = crsAFactory.getAuthorityCodes(cl); Martin wrote: > We would have to figure out an API in order to specify shuch hint. Allowing > user to specify a SQL > "WHERE" clause may not be the most appropriate way, since not all factories > are SQL backed. We could > consider something like regular expression however. One possibility is to add a function "crsAFactory.getAuthorityCodes(Class, Hints)". However since the "getAuthorityCodes" function is part of GeoAPI this interface is not likely to change in the near future. The second possibility is to send the hints via the hint infrastructure of the FactoryFinder: Hints hints = new Hints(Hints.DIMENSION, "2D"); //or: new Hints(Hints.DIMENSION, 2); CRSAuthorityFactory crsAFactory = FactoryFinder.getCRSAuthorityFactory("EPSG", hints); Set<String> codes = crsAFactory.getAuthorityCodes(cl); In this case the FactoryFinder would return a factory that would return only a certain subset of codes. The 2D/3D functionality should be fairly easy to integrate into all database driven factories (Access, HSQL, ...) One other typical query will involve objects of a certain area to be returned. EPSG describes most areas by their lat/lon boundaries. Hence the easiest solution seems to be: Hints hints = new Hints(Hints.AREA, new Rectangle2D.Double( ... )); CRSAuthorityFactory crsAFactory = FactoryFinder.getCRSAuthorityFactory("EPSG", hints); ... The factory would then only return "supported codes" that intersect with the specified rectangle. One thing to note about this is, that not all (but most) area codes have their bounds specified in the EPSG database (as for EPSG6.7). Other filters could follow the same principle. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira ------------------------------------------------------- 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&kid=110944&bid=241720&dat=121642 _______________________________________________ Geotools-devel mailing list Geotools-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-devel