Search in sources :

Example 21 with RecordReader

use of com.revolsys.record.io.RecordReader 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 22 with RecordReader

use of com.revolsys.record.io.RecordReader 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 23 with RecordReader

use of com.revolsys.record.io.RecordReader 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 24 with RecordReader

use of com.revolsys.record.io.RecordReader 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 25 with RecordReader

use of com.revolsys.record.io.RecordReader 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

RecordReader (com.revolsys.record.io.RecordReader)43 Record (com.revolsys.record.Record)34 ChannelWriter (com.revolsys.io.channels.ChannelWriter)19 RecordDefinition (com.revolsys.record.schema.RecordDefinition)11 Identifier (com.revolsys.identifier.Identifier)5 ArrayRecord (com.revolsys.record.ArrayRecord)5 ListRecordReader (com.revolsys.record.io.ListRecordReader)5 Query (com.revolsys.record.query.Query)5 HashMap (java.util.HashMap)5 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)4 BaseCloseable (com.revolsys.io.BaseCloseable)4 Transaction (com.revolsys.transaction.Transaction)4 ArrayList (java.util.ArrayList)4 Maps (com.revolsys.collection.map.Maps)3 Ellipsoid (com.revolsys.geometry.cs.Ellipsoid)3 Geometry (com.revolsys.geometry.model.Geometry)3 RecordWriter (com.revolsys.record.io.RecordWriter)3 RecordStore (com.revolsys.record.schema.RecordStore)3 Resource (com.revolsys.spring.resource.Resource)3 LinkedHashMap (java.util.LinkedHashMap)3