use of com.revolsys.geometry.cs.ParameterValue in project com.revolsys.open by revolsys.
the class EsriCoordinateSystemsLoader method projected.
private void projected() {
final Map<ByteArray, Map<Integer, ProjectedCoordinateSystem>> csBymd5 = new LinkedHashMap<>();
try (RecordReader reader = RecordReader.newRecordReader(this.mainPath + "data/esri/esriProjectedCs.tsv");
final ChannelWriter writer = ChannelWriter.newChannelWriter(this.mainPath + "resources/CoordinateSystems/esri/Projected.cs")) {
for (final Record record : reader) {
final int id = record.getInteger("ID");
final String wkt = record.getString("WKT");
final ProjectedCoordinateSystem coordinateSystem = WktCsParser.read(wkt);
final byte[] digest = coordinateSystem.md5Digest();
Maps.addToMap(Maps::newTree, csBymd5, new ByteArray(digest), id, coordinateSystem);
final String csName = coordinateSystem.getCoordinateSystemName();
final GeographicCoordinateSystem geographicCoordinateSystem = coordinateSystem.getGeographicCoordinateSystem();
final String geographicCoordinateSystemName = geographicCoordinateSystem.getCoordinateSystemName();
final int geographicCoordinateSystemId = this.geographicIdByName.getOrDefault(geographicCoordinateSystemName, 0);
if (geographicCoordinateSystemId == 0) {
System.out.println(wkt);
}
final String projectionName = coordinateSystem.getCoordinateOperationMethod().getName();
final Map<ParameterName, ParameterValue> parameterValues = coordinateSystem.getParameterValues();
final LinearUnit linearUnit = coordinateSystem.getLinearUnit();
final String unitName = linearUnit.getName();
final double conversionFactor = linearUnit.getConversionFactor();
writer.putInt(id);
writer.putStringUtf8ByteCount(csName);
writer.putInt(geographicCoordinateSystemId);
writer.putStringUtf8ByteCount(projectionName);
writeParameters(writer, parameterValues);
writer.putStringUtf8ByteCount(unitName);
writer.putDouble(conversionFactor);
}
}
writeDigestFile(csBymd5, "Projected");
}
Aggregations