Geographic Information Systems Asked on January 13, 2021
I would like to achieve the same output as for GDAL using the GeoTools library:
CoordinateReferenceSystem crs = CRS.decode("EPSG:32632");
String wkt = crs.toWKT();
System.out.println(wkt);
GeoTools output:
PROJCS["WGS 84 / UTM zone 32N",
GEOGCS["WGS 84",
DATUM["World Geodetic System 1984",
SPHEROID["WGS 84", 6378137.0, 298.257223563, AUTHORITY["EPSG","7030"]],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]],
UNIT["degree", 0.017453292519943295],
AXIS["Geodetic latitude", NORTH],
AXIS["Geodetic longitude", EAST],
AUTHORITY["EPSG","4326"]],
PROJECTION["Transverse_Mercator", AUTHORITY["EPSG","9807"]],
PARAMETER["central_meridian", 9.0],
PARAMETER["latitude_of_origin", 0.0],
PARAMETER["scale_factor", 0.9996],
PARAMETER["false_easting", 500000.0],
PARAMETER["false_northing", 0.0],
UNIT["m", 1.0],
AXIS["Easting", EAST],
AXIS["Northing", NORTH],
AUTHORITY["EPSG","32632"]]
GDAL output:
PROJCS["WGS 84 / UTM zone 32N",
GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,
AUTHORITY["EPSG","9122"]],
AUTHORITY["EPSG","4326"]],
PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",9],
PARAMETER["scale_factor",0.9996],
PARAMETER["false_easting",500000],
PARAMETER["false_northing",0],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]],
AXIS["Easting",EAST],
AXIS["Northing",NORTH],
AUTHORITY["EPSG","32632"]]
There are some minor differences, including missing authority in some cases, indents, etc. For example,
GDAL:
UNIT["metre",1,
AUTHORITY["EPSG","9001"]],
GeoTools:
UNIT["m", 1.0],
Is is possible to tune GeoTools such that it outputs the same WKT as GDAL?
What are the other ways to print the same WKT output to GDAL but not using native GDAL libraries?
I'm still no clear as to why the formatting of the WKT matters to you, but if you switch to the gt-epsg-wkt
module you can edit the raw definition of your projection to match your requirements.
The indentation is a simple search and replace.
Answered by Ian Turton on January 13, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP