use of com.revolsys.geometry.cs.Authority in project com.revolsys.open by revolsys.
the class EpsgCsWktWriter method write.
public static void write(final PrintWriter out, final Ellipsoid ellipsoid) {
if (ellipsoid != null) {
out.print(",SPHEROID[");
write(out, ellipsoid.getName());
out.write(',');
final double semiMajorAxis = ellipsoid.getSemiMajorAxis();
write(out, semiMajorAxis);
out.print(',');
final double inverseFlattening = ellipsoid.getInverseFlattening();
write(out, inverseFlattening);
final Authority authority = ellipsoid.getAuthority();
write(out, authority);
out.write(']');
}
}
use of com.revolsys.geometry.cs.Authority in project com.revolsys.open by revolsys.
the class EpsgCsWktWriter method write.
public static void write(final PrintWriter out, final GeodeticDatum geodeticDatum) {
if (geodeticDatum != null) {
out.print(",DATUM[");
write(out, geodeticDatum.getName());
final Ellipsoid ellipsoid = geodeticDatum.getEllipsoid();
if (ellipsoid != null) {
write(out, ellipsoid);
}
final Authority authority = geodeticDatum.getAuthority();
write(out, authority);
out.write(']');
}
}
use of com.revolsys.geometry.cs.Authority in project com.revolsys.open by revolsys.
the class EsriCoordinateSystems method getProjectedCoordinateSystem.
public static ProjectedCoordinateSystem getProjectedCoordinateSystem(final int id) {
ProjectedCoordinateSystem coordinateSystem = (ProjectedCoordinateSystem) COORDINATE_SYSTEM_BY_ID.get(id);
if (coordinateSystem == null) {
try (final ChannelReader reader = ChannelReader.newChannelReader("classpath:CoordinateSystems/esri/Projected.cs")) {
while (true) {
final int coordinateSystemId = reader.getInt();
final String csName = reader.getStringUtf8ByteCount();
final int geographicCoordinateSystemId = reader.getInt();
final String projectionName = reader.getStringUtf8ByteCount();
final Map<ParameterName, ParameterValue> parameters = readParameters(reader);
final String unitName = reader.getStringUtf8ByteCount();
final double conversionFactor = reader.getDouble();
if (id == coordinateSystemId) {
LinearUnit linearUnit = LINEAR_UNITS_BY_NAME.get(unitName);
if (linearUnit == null) {
linearUnit = new LinearUnit(unitName, conversionFactor);
LINEAR_UNITS_BY_NAME.put(unitName, linearUnit);
}
final Authority authority = new BaseAuthority("ESRI", coordinateSystemId);
final GeographicCoordinateSystem geographicCoordinateSystem = getGeographicCoordinateSystem(geographicCoordinateSystemId);
coordinateSystem = new ProjectedCoordinateSystem(coordinateSystemId, csName, geographicCoordinateSystem, projectionName, parameters, linearUnit, authority);
COORDINATE_SYSTEM_BY_ID.put(id, coordinateSystem);
return coordinateSystem;
}
}
} catch (final WrappedException e) {
if (Exceptions.isException(e, EOFException.class)) {
return null;
} else {
Logs.error("Cannot load coordinate system=" + id, e);
throw e;
}
}
}
return coordinateSystem;
}
use of com.revolsys.geometry.cs.Authority in project com.revolsys.open by revolsys.
the class EsriCoordinateSystems method getGeographicCoordinateSystem.
public static GeographicCoordinateSystem getGeographicCoordinateSystem(final int id) {
GeographicCoordinateSystem coordinateSystem = (GeographicCoordinateSystem) COORDINATE_SYSTEM_BY_ID.get(id);
if (coordinateSystem == null) {
try (final ChannelReader reader = ChannelReader.newChannelReader("classpath:CoordinateSystems/esri/Geographic.cs")) {
while (true) {
final int coordinateSystemId = reader.getInt();
final String csName = reader.getStringUtf8ByteCount();
final String datumName = reader.getStringUtf8ByteCount();
final String spheroidName = reader.getStringUtf8ByteCount();
final double semiMajorAxis = reader.getDouble();
final double inverseFlattening = reader.getDouble();
final String primeMeridianName = reader.getStringUtf8ByteCount();
final double longitude = reader.getDouble();
final String angularUnitName = reader.getStringUtf8ByteCount();
final double conversionFactor = reader.getDouble();
if (id == coordinateSystemId) {
final Ellipsoid ellipsoid = new Ellipsoid(spheroidName, semiMajorAxis, inverseFlattening, null);
final PrimeMeridian primeMeridian = new PrimeMeridian(primeMeridianName, longitude, null);
final GeodeticDatum geodeticDatum = new GeodeticDatum(null, datumName, null, false, ellipsoid, primeMeridian);
AngularUnit angularUnit = ANGULAR_UNITS_BY_NAME.get(angularUnitName);
if (angularUnit == null) {
angularUnit = new AngularUnit(angularUnitName, conversionFactor, null);
ANGULAR_UNITS_BY_NAME.put(angularUnitName, angularUnit);
}
final Authority authority = new BaseAuthority("ESRI", coordinateSystemId);
coordinateSystem = new GeographicCoordinateSystem(coordinateSystemId, csName, geodeticDatum, primeMeridian, angularUnit, null, authority);
COORDINATE_SYSTEM_BY_ID.put(id, coordinateSystem);
return coordinateSystem;
}
}
} catch (final WrappedException e) {
if (Exceptions.isException(e, EOFException.class)) {
return null;
} else {
Logs.error("Cannot load coordinate system=" + id, e);
throw e;
}
}
}
return coordinateSystem;
}
Aggregations