Search in sources :

Example 16 with ChannelWriter

use of com.revolsys.io.channels.ChannelWriter in project com.revolsys.open by revolsys.

the class EpsgCoordinateSystemsLoader method loadCoordinateReferenceSystem.

private void loadCoordinateReferenceSystem() throws IOException {
    final Map<Integer, List<Record>> recordByKind = new TreeMap<>();
    try (final RecordReader reader = newReader("/public/epsg_coordinatereferencesystem", "coord_ref_sys_code")) {
        for (final Record record : reader) {
            final String code = record.getValue("coord_ref_sys_kind");
            final int kind = COORDINATE_REFERENCE_SYSTEM_TYPES.indexOf(code);
            Maps.addToList(recordByKind, kind, record);
        }
    }
    try (ChannelWriter writer = newWriter("coordinateReferenceSystem")) {
        for (final List<Record> records : recordByKind.values()) {
            for (final Record record : records) {
                final int id = writeInt(writer, record, "coord_ref_sys_code");
                writeString(writer, record, "coord_ref_sys_name");
                writeInt(writer, record, "area_of_use_code");
                writeCodeByte(writer, record, "coord_ref_sys_kind", COORDINATE_REFERENCE_SYSTEM_TYPES);
                writeInt(writer, record, "coord_sys_code", 0);
                writeInt(writer, record, "datum_code", 0);
                writeInt(writer, record, "source_geogcrs_code", 0);
                writeInt(writer, record, "projection_conv_code", 0);
                writeInt(writer, record, "cmpd_horizcrs_code", 0);
                writeInt(writer, record, "cmpd_vertcrs_code", 0);
                writeDeprecated(writer, record);
            }
        }
    }
}
Also used : RecordReader(com.revolsys.record.io.RecordReader) List(java.util.List) Record(com.revolsys.record.Record) TreeMap(java.util.TreeMap) ChannelWriter(com.revolsys.io.channels.ChannelWriter)

Example 17 with ChannelWriter

use of com.revolsys.io.channels.ChannelWriter in project com.revolsys.open by revolsys.

the class EpsgCoordinateSystemsLoader method loadCoordinateAxis.

private void loadCoordinateAxis() {
    try (final RecordReader reader = newReader("/public/epsg_coordinateaxis", "coord_sys_code", "coord_axis_order");
        ChannelWriter writer = newWriter("coordinateAxis")) {
        for (final Record record : reader) {
            writeInt(writer, record, "coord_sys_code");
            writeInt(writer, record, "coord_axis_name_code");
            writeString(writer, record, "coord_axis_orientation");
            final String abbreviation = record.getValue("coord_axis_abbreviation");
            writer.putByte((byte) abbreviation.charAt(0));
            writeInt(writer, record, "uom_code");
        }
    }
}
Also used : RecordReader(com.revolsys.record.io.RecordReader) Record(com.revolsys.record.Record) ChannelWriter(com.revolsys.io.channels.ChannelWriter)

Example 18 with ChannelWriter

use of com.revolsys.io.channels.ChannelWriter in project com.revolsys.open by revolsys.

the class EpsgCoordinateSystemsLoader method loadCoordinateAxisName.

private void loadCoordinateAxisName() {
    try (final RecordReader reader = newReader("/public/epsg_coordinateaxisname", "coord_axis_name_code");
        ChannelWriter writer = newWriter("coordinateAxisName")) {
        for (final Record record : reader) {
            writeInt(writer, record, "coord_axis_name_code");
            writeString(writer, record, "coord_axis_name");
        }
    }
}
Also used : RecordReader(com.revolsys.record.io.RecordReader) Record(com.revolsys.record.Record) ChannelWriter(com.revolsys.io.channels.ChannelWriter)

Example 19 with ChannelWriter

use of com.revolsys.io.channels.ChannelWriter in project com.revolsys.open by revolsys.

the class EpsgCoordinateSystemsLoader method loadCoordOperationMethod.

private void loadCoordOperationMethod() {
    try (RecordReader reader = newReader("/public/epsg_coordoperationmethod");
        ChannelWriter writer = newWriter("coordOperationMethod")) {
        for (final Record record : reader) {
            writeInt(writer, record, "coord_op_method_code");
            writeString(writer, record, "coord_op_method_name");
            writeByte(writer, record, "reverse_op");
            writeDeprecated(writer, record);
        }
    }
}
Also used : RecordReader(com.revolsys.record.io.RecordReader) Record(com.revolsys.record.Record) ChannelWriter(com.revolsys.io.channels.ChannelWriter)

Example 20 with ChannelWriter

use of com.revolsys.io.channels.ChannelWriter in project com.revolsys.open by revolsys.

the class EpsgCoordinateSystemsLoader method loadEllipsoid.

private void loadEllipsoid() throws IOException {
    try (final RecordReader reader = newReader("/public/epsg_ellipsoid", "ellipsoid_code");
        ChannelWriter writer = newWriter("ellipsoid")) {
        for (final Record record : reader) {
            writeInt(writer, record, "ellipsoid_code");
            writeString(writer, record, "ellipsoid_name");
            writeInt(writer, record, "uom_code");
            writeDouble(writer, record, "semi_minor_axis");
            writeDouble(writer, record, "semi_major_axis");
            writeDouble(writer, record, "inv_flattening");
            writeByte(writer, record, "ellipsoid_shape");
            writeDeprecated(writer, record);
        }
    }
}
Also used : RecordReader(com.revolsys.record.io.RecordReader) Record(com.revolsys.record.Record) ChannelWriter(com.revolsys.io.channels.ChannelWriter)

Aggregations

ChannelWriter (com.revolsys.io.channels.ChannelWriter)27 Record (com.revolsys.record.Record)19 RecordReader (com.revolsys.record.io.RecordReader)19 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)5 HashMap (java.util.HashMap)4 LinkedHashMap (java.util.LinkedHashMap)4 Map (java.util.Map)4 Maps (com.revolsys.collection.map.Maps)3 GeographicCoordinateSystem (com.revolsys.geometry.cs.GeographicCoordinateSystem)2 ParameterName (com.revolsys.geometry.cs.ParameterName)2 ParameterValue (com.revolsys.geometry.cs.ParameterValue)2 LinearUnit (com.revolsys.geometry.cs.unit.LinearUnit)2 BoundingBox (com.revolsys.geometry.model.BoundingBox)2 IOException (java.io.IOException)2 List (java.util.List)2 TreeMap (java.util.TreeMap)2 Ellipsoid (com.revolsys.geometry.cs.Ellipsoid)1 PrimeMeridian (com.revolsys.geometry.cs.PrimeMeridian)1 ProjectedCoordinateSystem (com.revolsys.geometry.cs.ProjectedCoordinateSystem)1 VerticalCoordinateSystem (com.revolsys.geometry.cs.VerticalCoordinateSystem)1