Search in sources :

Example 1 with Authority

use of com.revolsys.geometry.cs.Authority in project com.revolsys.open by revolsys.

the class EpsgCoordinateSystems method loadArea.

private static void loadArea() {
    try (ChannelReader reader = newChannelReader("area")) {
        while (true) {
            final int code = reader.getInt();
            final String name = reader.getStringUtf8ByteCount();
            final double minX = reader.getDouble();
            final double minY = reader.getDouble();
            final double maxX = reader.getDouble();
            final double maxY = reader.getDouble();
            final boolean deprecated = readBoolean(reader);
            final Authority authority = new EpsgAuthority(code);
            BoundingBox boundingBox;
            if (Double.isFinite(minX) || Double.isFinite(minX) || Double.isFinite(minX) || Double.isFinite(minX)) {
                boundingBox = new BoundingBoxDoubleXY(minX, minY, maxX, maxY);
            } else {
                boundingBox = BoundingBox.empty();
            }
            final Area area = new Area(name, boundingBox, authority, deprecated);
            AREA_BY_ID.put(code, area);
        }
    } catch (final NoSuchResourceException e) {
    } catch (final WrappedException e) {
        if (Exceptions.isException(e, EOFException.class)) {
        } else {
            throw e;
        }
    }
}
Also used : WrappedException(com.revolsys.util.WrappedException) Authority(com.revolsys.geometry.cs.Authority) ParameterValueString(com.revolsys.geometry.cs.ParameterValueString) BoundingBoxDoubleXY(com.revolsys.geometry.model.impl.BoundingBoxDoubleXY) NoSuchResourceException(com.revolsys.spring.resource.NoSuchResourceException) Area(com.revolsys.geometry.cs.Area) ChannelReader(com.revolsys.io.channels.ChannelReader) BoundingBox(com.revolsys.geometry.model.BoundingBox) EOFException(java.io.EOFException)

Example 2 with Authority

use of com.revolsys.geometry.cs.Authority in project com.revolsys.open by revolsys.

the class EpsgCoordinateSystems method getCrsId.

public static int getCrsId(final CoordinateSystem coordinateSystem) {
    final Authority authority = coordinateSystem.getAuthority();
    if (authority != null) {
        final String name = authority.getName();
        final String code = authority.getCode();
        if (name.equals("EPSG")) {
            return Integer.parseInt(code);
        }
    }
    return 0;
}
Also used : Authority(com.revolsys.geometry.cs.Authority) ParameterValueString(com.revolsys.geometry.cs.ParameterValueString)

Example 3 with Authority

use of com.revolsys.geometry.cs.Authority in project com.revolsys.open by revolsys.

the class EpsgCoordinateSystems method getCrsName.

public static String getCrsName(final CoordinateSystem coordinateSystem) {
    final Authority authority = coordinateSystem.getAuthority();
    final String name = authority.getName();
    final String code = authority.getCode();
    if (name.equals("EPSG")) {
        return name + ":" + code;
    } else {
        return null;
    }
}
Also used : Authority(com.revolsys.geometry.cs.Authority) ParameterValueString(com.revolsys.geometry.cs.ParameterValueString)

Example 4 with Authority

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 PrimeMeridian primeMeridian) {
    if (primeMeridian != null) {
        out.print(",PRIMEM[");
        write(out, primeMeridian.getName());
        out.write(',');
        final double longitude = primeMeridian.getLongitude();
        write(out, longitude);
        final Authority authority = primeMeridian.getAuthority();
        write(out, authority);
        out.write(']');
    }
}
Also used : Authority(com.revolsys.geometry.cs.Authority)

Example 5 with Authority

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 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)

Aggregations

Authority (com.revolsys.geometry.cs.Authority)14 GeographicCoordinateSystem (com.revolsys.geometry.cs.GeographicCoordinateSystem)4 ParameterValueString (com.revolsys.geometry.cs.ParameterValueString)4 LinearUnit (com.revolsys.geometry.cs.unit.LinearUnit)4 ChannelReader (com.revolsys.io.channels.ChannelReader)4 WrappedException (com.revolsys.util.WrappedException)4 EOFException (java.io.EOFException)4 BaseAuthority (com.revolsys.geometry.cs.BaseAuthority)3 ParameterName (com.revolsys.geometry.cs.ParameterName)3 PrimeMeridian (com.revolsys.geometry.cs.PrimeMeridian)3 GeodeticDatum (com.revolsys.geometry.cs.datum.GeodeticDatum)3 Area (com.revolsys.geometry.cs.Area)2 CoordinateOperationMethod (com.revolsys.geometry.cs.CoordinateOperationMethod)2 Ellipsoid (com.revolsys.geometry.cs.Ellipsoid)2 ParameterValue (com.revolsys.geometry.cs.ParameterValue)2 ProjectedCoordinateSystem (com.revolsys.geometry.cs.ProjectedCoordinateSystem)2 SingleParameterName (com.revolsys.geometry.cs.SingleParameterName)2 VerticalCoordinateSystem (com.revolsys.geometry.cs.VerticalCoordinateSystem)2 AngularUnit (com.revolsys.geometry.cs.unit.AngularUnit)2 IntHashMap (com.revolsys.collection.map.IntHashMap)1