From: Martin D. <mar...@ge...> - 2006-08-19 17:21:32
|
Andrea Aime a =E9crit : > I'm wondering if there's any way to get a validity area for a generic=20 > transform, > that is, a bbox in source coordinates telling me where the transform=20 > works, and > were it starts failing. If all the following conditions are meet: * epsg-hsql, epsg-access or epsg-postgresql is available in the classpath= ; * The source and target CRS contain their EPSG code in their metadata (it should always be the case if the CRS were created from an EPSG factory= , even if this factory was epsg-wkt); * The "sourceCRS to targetCRS" transform is one of those that are explici= tly defined in the EPSG database (in the "Coordinate_Operation" table); Then the "area of validity" should be defined as part of the CoordinateOp= eration metadata. This area=20 of validity can be defined in various way, including string, geographic b= ounding box, envelope or=20 arbitrary polygon (all this flexibility is provided by the ISO 19115 "Ext= ent" object). It sound like=20 that I didn't wrote a convenience method for extracting an envelope from = a CoordinateOperation - we=20 should probably open a JIRA task as a remainder that we should add such c= onvenience method. In the main time, there is a convenience method for extracting an envelop= e or a geographic bounding=20 box from a CRS. So the easier way to check the "area of validity" of a tr= ansform is probably to invoke: Envelope areaOfValidity =3D CRS.getEnvelope(operation.getTargetCRS()= ); Javadoc: http://javadoc.geotools.fr/snapshot/org/geotools/referencing/CRS.html#get= Envelope(org.opengis.referencing.crs.CoordinateReferenceSystem) Reminder: just in case you wonder what is the difference between an Envel= ope (from ISO 19107) and a=20 GeographicBoundingBox (from ISO 19115): the Envelope can be in arbitrary = CRS. The=20 GeographicBoundingBox is garantee to be (longitude,latitude) in something= close to WGS84. All the above work only for CRS or CoordinateOperation explicitly defined= in the EPSG database. If=20 we want a general mechanism for computing the area of validity of an unkn= own coordinate operation,=20 this require some though. There is no such general mechanism right now in= Geotools. Martin. |