我有很多人向我提供使用ESRI工具生成的ESRI ASC网格化数据文件。当他们这样做时,PRJ文件包含以下类型的信息。如果根据当然的预测而不同,例如, UTM,ALBERS等..
GeoTools是否有一个可以从这种投影定义格式创建CoordinateReferenceSystem的解析器?
Projection ALBERS
Datum NAD83
Spheroid GRS80
Units METERS
Zunits NO
Xshift 0.0
Yshift 0.0
Parameters
29 30 0.0 /* 1st standard parallel
45 30 0.0 /* 2nd standard parallel
-96 0 0.0 /* central meridian
23 0 0.0 /* latitude of projection's origin
0.0 /* false easting (meters)
0.0 /* false northing (meters)
答案 0 :(得分:0)
不直接,因为它似乎不是standard (or ESRI variant) WKT projection file。但是,可能有足够的信息来创建Coordinate Reference System,如here所述。
MathTransformFactory mtFactory = ReferencingFactoryFinder.getMathTransformFactory(null);
CRSFactory crsFactory = ReferencingFactoryFinder.getCRSFactory(null);
GeographicCRS geoCRS = org.geotools.referencing.crs.DefaultGeographicCRS.WGS84;
CartesianCS cartCS = org.geotools.referencing.cs.DefaultCartesianCS.GENERIC_2D;
ParameterValueGroup parameters = mtFactory.getDefaultParameters("Transverse_Mercator");
parameters.parameter("central_meridian").setValue(-111.0);
parameters.parameter("latitude_of_origin").setValue(0.0);
parameters.parameter("scale_factor").setValue(0.9996);
parameters.parameter("false_easting").setValue(500000.0);
parameters.parameter("false_northing").setValue(0.0);
Conversion conversion = new DefiningConversion("Transverse_Mercator", parameters);
Map<String, ?> properties = Collections.singletonMap("name", "WGS 84 / UTM Zone 12N");
ProjectedCRS projCRS = crsFactory.createProjectedCRS(properties, geoCRS, conversion, cartCS);