From: Martin D. <mar...@no...> - 2005-12-02 10:37:36
|
Peter Zankl a =E9crit : > I need to transform some given data from "Lambert 2 =E9tendu" to WGS84. > [...snip...] Further reading: there is the EPSG database describing coo= rdinate=20 > systems containing an entry > INSERT INTO epsg_alias VALUES ( [...snip...], 'NTF (Paris) / Lambert zo= ne II etendu'); > which is the closest match I can find. >=20 > 2 questions: > a) can anyone confirm that relating "Lambert 2 =E9tendu" to the EPSG en= try=20 > does make sense ? > b) where do I find the WKT string? Do I really have to install the whol= e=20 > EPSG thing (including MS Access) to extract this single line of text ? WKT and EPSG are two unrelated things. In order to get yours Coordinate=20 Reference System (CRS) objects, you need to describe the CRS as a "Well=20 Known Text" (WKT), or you need its EPSG code. But you don't need both. WKT is flexible and do not requires any database at all. EPSG codes put=20 more constraints (you need an EPSG database, and you can't create a CRS=20 which is not defined in this database), but is easier to use if you know=20 the CRS code. In some cases, it allows more accurate transformations=20 than WKT. The EPSG database is available in various forms. You can download it in=20 MS-Access format from http://www.epsg.org (MS-Access is the primary=20 distribution format for this database). You can also install it on a=20 PostgreSQL database, etc. Geotools provides different EPSG plugins, each of them for a different=20 connection mechanism to an EPSG database. The "epsg-access" plugin=20 search for an MS-Access database registered under the "EPSG" name in the=20 "ODBC Sources" folder in the control panel. If you have a MS-Access=20 software on yours machine, I recommand this approach since it allows you=20 to browse the EPSG database in order to find the EPSG code for yours CRS. An other Geotools plugin is "epsg-hsql", which is bundled with a copy of=20 the EPSG 6.7 database. Using the "epsg-hsql" plugin, you don't need to=20 download the EPSG database. Just put the "epsg-hsql.jar" file in yours=20 classpath, and everything should work. But you need to download the HSQL=20 database engine first... For searching an EPSG code for a CRS, "Alias" is not the right table to=20 look into. You need to search in the "Coordinate Reference System"=20 table. For example the code 27572 is for "NTF (Paris) / Lambert zone=20 II". But there is a lot of "NTF (Paris)" CRS. Maybe you should look in=20 the EPSG database by yours self in order to be sure to pick the one you=20 want. You can tests yours EPSG code with the following line from the command=20 line (assuming that the Geotools JAR are in yours classpath, including=20 at least one of the EPSG plugins): java org.geotools.referencing.factory.epsg.DefaultFactory 27572 You should get the WKT for the EPSG:27572 CRS, which is: PROJCS["NTF (Paris) / Lambert zone II", GEOGCS["NTF (Paris)", DATUM["Nouvelle Triangulation Francaise (Paris)", SPHEROID["Clarke 1880 (IGN)", 6378249.2, 293.4660212936269,=20 AUTHORITY["EPSG","7011"]], AUTHORITY["EPSG","6807"]], PRIMEM["Paris", 2.5969213, AUTHORITY["EPSG","8903"]], UNIT["grade", 0.015707963267948967], AXIS["Geodetic latitude", NORTH], AXIS["Geodetic longitude", EAST], AUTHORITY["EPSG","4807"]], PROJECTION["Lambert Conic Conformal (1SP)", AUTHORITY["EPSG","9801"]], PARAMETER["central_meridian", 0.0], PARAMETER["latitude_of_origin", 52.0], PARAMETER["scale_factor", 0.99987742], PARAMETER["false_easting", 600000.0], PARAMETER["false_northing", 2200000.0], UNIT["m", 1.0], AXIS["Easting", EAST], AXIS["Northing", NORTH], AUTHORITY["EPSG","27572"]] But you don't really need this WKT. In yours code, just write: CRSAuthorityFactory f =3D FactoryFinder.getCRSAuthorityFactory("EPSG"= ); CoordinateReferenceSystem crs =3D=20 f.createCoordinateReferenceSystem("27572"); and you got yours CRS. Martin. |