Search in sources :

Example 1 with GeodeticDatum

use of com.revolsys.geometry.cs.datum.GeodeticDatum in project com.revolsys.open by revolsys.

the class EpsgCoordinateSystems method newCoordinateSystemGeocentric.

private static GeocentricCoordinateSystem newCoordinateSystemGeocentric(final int id, final String name, final Datum datum, final List<Axis> axis, final Area area, final boolean deprecated) {
    final EpsgAuthority authority = new EpsgAuthority(id);
    final LinearUnit linearUnit = (LinearUnit) axis.get(0).getUnit();
    final GeodeticDatum geodeticDatum = (GeodeticDatum) datum;
    return new GeocentricCoordinateSystem(id, name, geodeticDatum, linearUnit, axis, area, authority, deprecated);
}
Also used : GeocentricCoordinateSystem(com.revolsys.geometry.cs.GeocentricCoordinateSystem) LinearUnit(com.revolsys.geometry.cs.unit.LinearUnit) GeodeticDatum(com.revolsys.geometry.cs.datum.GeodeticDatum)

Example 2 with GeodeticDatum

use of com.revolsys.geometry.cs.datum.GeodeticDatum in project com.revolsys.open by revolsys.

the class EpsgCoordinateSystems method loadDatum.

private static void loadDatum() {
    final IntHashMap<Ellipsoid> ellipsoids = loadEllipsoid();
    try (ChannelReader reader = newChannelReader("datum")) {
        while (true) {
            final int id = reader.getInt();
            final String name = reader.getStringUtf8ByteCount();
            final int datumType = reader.getByte();
            final Ellipsoid ellipsoid = readCode(reader, ellipsoids);
            final PrimeMeridian primeMeridian = readCode(reader, PRIME_MERIDIAN_BY_ID);
            final Area area = readCode(reader, AREA_BY_ID);
            final boolean deprecated = readBoolean(reader);
            final EpsgAuthority authority = new EpsgAuthority(id);
            Datum datum;
            if (datumType == 0) {
                datum = new GeodeticDatum(authority, name, area, deprecated, ellipsoid, primeMeridian);
            } else if (datumType == 1) {
                datum = new VerticalDatum(authority, name, area, deprecated);
            } else if (datumType == 2) {
                datum = new EngineeringDatum(authority, name, area, deprecated);
            } else {
                throw new IllegalArgumentException("Unknown datumType=" + datumType);
            }
            DATUM_BY_ID.put(id, datum);
        }
    } catch (final NoSuchResourceException e) {
    } catch (final WrappedException e) {
        if (Exceptions.isException(e, EOFException.class)) {
        } else {
            throw e;
        }
    }
}
Also used : WrappedException(com.revolsys.util.WrappedException) Datum(com.revolsys.geometry.cs.datum.Datum) EngineeringDatum(com.revolsys.geometry.cs.datum.EngineeringDatum) GeodeticDatum(com.revolsys.geometry.cs.datum.GeodeticDatum) VerticalDatum(com.revolsys.geometry.cs.datum.VerticalDatum) GeodeticDatum(com.revolsys.geometry.cs.datum.GeodeticDatum) VerticalDatum(com.revolsys.geometry.cs.datum.VerticalDatum) ParameterValueString(com.revolsys.geometry.cs.ParameterValueString) PrimeMeridian(com.revolsys.geometry.cs.PrimeMeridian) NoSuchResourceException(com.revolsys.spring.resource.NoSuchResourceException) EngineeringDatum(com.revolsys.geometry.cs.datum.EngineeringDatum) Area(com.revolsys.geometry.cs.Area) ChannelReader(com.revolsys.io.channels.ChannelReader) EOFException(java.io.EOFException) Ellipsoid(com.revolsys.geometry.cs.Ellipsoid)

Example 3 with GeodeticDatum

use of com.revolsys.geometry.cs.datum.GeodeticDatum in project com.revolsys.open by revolsys.

the class EpsgCsWktWriter method write.

public static void write(final PrintWriter out, final GeographicCoordinateSystem coordinateSystem) {
    if (coordinateSystem != null) {
        out.print("GEOGCS[");
        write(out, coordinateSystem.getCoordinateSystemName());
        final GeodeticDatum geodeticDatum = coordinateSystem.getDatum();
        write(out, geodeticDatum);
        final PrimeMeridian primeMeridian = coordinateSystem.getPrimeMeridian();
        write(out, primeMeridian);
        final AngularUnit unit = coordinateSystem.getAngularUnit();
        write(out, unit);
        final Authority authority = coordinateSystem.getAuthority();
        write(out, authority);
        out.write(']');
    }
}
Also used : Authority(com.revolsys.geometry.cs.Authority) GeodeticDatum(com.revolsys.geometry.cs.datum.GeodeticDatum) PrimeMeridian(com.revolsys.geometry.cs.PrimeMeridian) AngularUnit(com.revolsys.geometry.cs.unit.AngularUnit)

Example 4 with GeodeticDatum

use of com.revolsys.geometry.cs.datum.GeodeticDatum in project com.revolsys.open by revolsys.

the class EsriCsWktWriter method write.

public static void write(final Writer out, final GeographicCoordinateSystem coordinateSystem, final int indentLevel) throws IOException {
    out.write("GEOGCS[");
    write(out, coordinateSystem.getCoordinateSystemName(), incrementIndent(indentLevel));
    final GeodeticDatum geodeticDatum = coordinateSystem.getDatum();
    if (geodeticDatum != null) {
        out.write(",");
        indent(out, incrementIndent(indentLevel));
        write(out, geodeticDatum, incrementIndent(indentLevel));
    }
    final PrimeMeridian primeMeridian = coordinateSystem.getPrimeMeridian();
    if (primeMeridian != null) {
        out.write(",");
        indent(out, incrementIndent(indentLevel));
        write(out, primeMeridian, incrementIndent(indentLevel));
    }
    final AngularUnit unit = coordinateSystem.getAngularUnit();
    if (unit != null) {
        write(out, unit, incrementIndent(indentLevel));
    }
    indent(out, indentLevel);
    out.write(']');
}
Also used : GeodeticDatum(com.revolsys.geometry.cs.datum.GeodeticDatum) PrimeMeridian(com.revolsys.geometry.cs.PrimeMeridian) AngularUnit(com.revolsys.geometry.cs.unit.AngularUnit)

Example 5 with GeodeticDatum

use of com.revolsys.geometry.cs.datum.GeodeticDatum in project com.revolsys.open by revolsys.

the class WktCsParser method processGeographicCoordinateSystem.

private GeographicCoordinateSystem processGeographicCoordinateSystem(final List<Object> values) {
    final String name = (String) values.get(0);
    final GeodeticDatum geodeticDatum = (GeodeticDatum) values.get(1);
    final PrimeMeridian primeMeridian = (PrimeMeridian) values.get(2);
    final AngularUnit angularUnit = (AngularUnit) values.get(3);
    int index = 4;
    List<Axis> axis = null;
    if (index < values.size() && values.get(index) instanceof Axis) {
        axis = Arrays.asList((Axis) values.get(index++), (Axis) values.get(index++));
    }
    Authority authority = null;
    if (index < values.size()) {
        authority = (Authority) values.get(index);
    }
    final int coordinateSystemId = getCoordinateSystemId(authority);
    return new GeographicCoordinateSystem(coordinateSystemId, name, geodeticDatum, primeMeridian, angularUnit, axis, authority);
}
Also used : GeodeticDatum(com.revolsys.geometry.cs.datum.GeodeticDatum) AngularUnit(com.revolsys.geometry.cs.unit.AngularUnit)

Aggregations

GeodeticDatum (com.revolsys.geometry.cs.datum.GeodeticDatum)9 PrimeMeridian (com.revolsys.geometry.cs.PrimeMeridian)6 AngularUnit (com.revolsys.geometry.cs.unit.AngularUnit)5 GeographicCoordinateSystem (com.revolsys.geometry.cs.GeographicCoordinateSystem)4 Area (com.revolsys.geometry.cs.Area)3 Authority (com.revolsys.geometry.cs.Authority)3 Ellipsoid (com.revolsys.geometry.cs.Ellipsoid)3 GeocentricCoordinateSystem (com.revolsys.geometry.cs.GeocentricCoordinateSystem)3 ParameterValueString (com.revolsys.geometry.cs.ParameterValueString)3 ChannelReader (com.revolsys.io.channels.ChannelReader)3 WrappedException (com.revolsys.util.WrappedException)3 EOFException (java.io.EOFException)3 Axis (com.revolsys.geometry.cs.Axis)2 CompoundCoordinateSystem (com.revolsys.geometry.cs.CompoundCoordinateSystem)2 CoordinateSystem (com.revolsys.geometry.cs.CoordinateSystem)2 EngineeringCoordinateSystem (com.revolsys.geometry.cs.EngineeringCoordinateSystem)2 ProjectedCoordinateSystem (com.revolsys.geometry.cs.ProjectedCoordinateSystem)2 VerticalCoordinateSystem (com.revolsys.geometry.cs.VerticalCoordinateSystem)2 Datum (com.revolsys.geometry.cs.datum.Datum)2 EngineeringDatum (com.revolsys.geometry.cs.datum.EngineeringDatum)2