use of com.revolsys.geometry.cs.ParameterName in project com.revolsys.open by revolsys.
the class EsriCsWktWriter method write.
public static void write(final Writer out, final VerticalCoordinateSystem coordinateSystem, final int indentLevel) throws IOException {
out.write("VERTCS[");
write(out, coordinateSystem.getCoordinateSystemName(), incrementIndent(indentLevel));
final VerticalDatum datum = coordinateSystem.getDatum();
if (datum != null) {
out.write(",");
indent(out, incrementIndent(indentLevel));
write(out, datum, incrementIndent(indentLevel));
}
for (final Entry<ParameterName, ParameterValue> parameter : coordinateSystem.getParameterValues().entrySet()) {
final ParameterName name = parameter.getKey();
final ParameterValue value = parameter.getValue();
write(out, name, value, incrementIndent(indentLevel));
}
final LinearUnit unit = coordinateSystem.getLinearUnit();
if (unit != null) {
write(out, unit, incrementIndent(indentLevel));
}
indent(out, indentLevel);
out.write(']');
}
use of com.revolsys.geometry.cs.ParameterName in project com.revolsys.open by revolsys.
the class EsriCsWktWriter method write.
public static void write(final Writer out, final ProjectedCoordinateSystem coordinateSystem, final int indentLevel) throws IOException {
out.write("PROJCS[");
write(out, coordinateSystem.getCoordinateSystemName(), incrementIndent(indentLevel));
final GeographicCoordinateSystem geoCs = coordinateSystem.getGeographicCoordinateSystem();
if (geoCs != null) {
out.write(",");
indent(out, incrementIndent(indentLevel));
write(out, geoCs, incrementIndent(indentLevel));
}
final CoordinateOperationMethod coordinateOperationMethod = coordinateSystem.getCoordinateOperationMethod();
if (coordinateOperationMethod != null) {
out.write(",");
indent(out, incrementIndent(indentLevel));
write(out, coordinateOperationMethod, incrementIndent(indentLevel));
}
for (final Entry<ParameterName, ParameterValue> parameter : coordinateSystem.getParameterValues().entrySet()) {
final ParameterName name = parameter.getKey();
final ParameterValue value = parameter.getValue();
write(out, name, value, incrementIndent(indentLevel));
}
final LinearUnit unit = coordinateSystem.getLinearUnit();
if (unit != null) {
write(out, unit, incrementIndent(indentLevel));
}
indent(out, indentLevel);
out.write(']');
}
use of com.revolsys.geometry.cs.ParameterName in project com.revolsys.open by revolsys.
the class EsriCoordinateSystemsLoader method vertical.
private void vertical() {
final Map<ByteArray, Map<Integer, VerticalCoordinateSystem>> csBymd5 = new LinkedHashMap<>();
try (RecordReader reader = RecordReader.newRecordReader(this.mainPath + "data/esri/esriVerticalCs.tsv");
final ChannelWriter writer = ChannelWriter.newChannelWriter(this.mainPath + "resources/CoordinateSystems/esri/Vertical.cs")) {
for (final Record record : reader) {
final int id = record.getInteger("ID");
final String wkt = record.getString("WKT");
final VerticalCoordinateSystem coordinateSystem = WktCsParser.read(wkt);
final byte[] digest = coordinateSystem.md5Digest();
Maps.addToMap(Maps::newTree, csBymd5, new ByteArray(digest), id, coordinateSystem);
final VerticalDatum datum = coordinateSystem.getDatum();
if (datum != null) {
final Map<ParameterName, ParameterValue> parameterValues = coordinateSystem.getParameterValues();
final LinearUnit linearUnit = coordinateSystem.getLinearUnit();
final String csName = coordinateSystem.getCoordinateSystemName();
this.geographicIdByName.put(csName, id);
final String datumName = datum.getName();
final String linearUnitName = linearUnit.getName();
final double conversionFactor = linearUnit.getConversionFactor();
writer.putInt(id);
writer.putStringUtf8ByteCount(csName);
writer.putStringUtf8ByteCount(datumName);
writeParameters(writer, parameterValues);
writer.putStringUtf8ByteCount(linearUnitName);
writer.putDouble(conversionFactor);
}
}
}
writeDigestFile(csBymd5, "Vertical");
}
use of com.revolsys.geometry.cs.ParameterName in project com.revolsys.open by revolsys.
the class EpsgCoordinateSystems method loadCoordOperationParamUsage.
private static void loadCoordOperationParamUsage(final IntHashMap<List<ParameterName>> paramOrderByMethodId, final IntHashMap<List<Byte>> paramReversal) {
try (ChannelReader reader = newChannelReader("coordOperationParamUsage")) {
while (true) {
final int methodId = reader.getInt();
final ParameterName parameterName = readCode(reader, PARAM_NAME_BY_ID);
final int sortOrder = reader.getInt();
final byte signReversal = reader.getByte();
Maps.addToList(paramOrderByMethodId, methodId, parameterName);
Maps.addToList(paramReversal, methodId, signReversal);
}
} catch (final NoSuchResourceException e) {
} catch (final WrappedException e) {
if (Exceptions.isException(e, EOFException.class)) {
} else {
Logs.error(EpsgCoordinateSystems.class, "Error loading coordOperationParamValue", e);
}
}
}
use of com.revolsys.geometry.cs.ParameterName in project com.revolsys.open by revolsys.
the class EpsgCoordinateSystems method newCoordinateSystemProjected.
private static ProjectedCoordinateSystem newCoordinateSystemProjected(final int id, final String name, final Area area, final CoordinateSystem sourceCoordinateSystem, final CoordinateOperation operation, final List<Axis> axis, final boolean deprecated) {
final EpsgAuthority authority = new EpsgAuthority(id);
final LinearUnit linearUnit = (LinearUnit) axis.get(0).getUnit();
final CoordinateOperationMethod method = operation.getMethod();
final Map<ParameterName, ParameterValue> parameterValues = operation.getParameterValues();
if (sourceCoordinateSystem instanceof GeographicCoordinateSystem) {
final GeographicCoordinateSystem geographicCoordinateSystem = (GeographicCoordinateSystem) sourceCoordinateSystem;
return new ProjectedCoordinateSystem(id, name, geographicCoordinateSystem, area, method, parameterValues, linearUnit, axis, authority, deprecated);
} else if (!Arrays.asList(5819, 5820, 5821).contains(id)) {
Logs.error(EpsgCoordinateSystems.class, id + " " + name + " has a projected coordinate system");
return null;
} else {
return null;
}
}
Aggregations