Search in sources :

Example 1 with UtmRectangularMapGrid

use of com.revolsys.gis.grid.UtmRectangularMapGrid in project com.revolsys.open by revolsys.

the class MoepBinaryIterator method loadHeader.

private void loadHeader() throws IOException {
    this.fileType = (byte) read();
    if (this.fileType / 100 == 0) {
        this.coordinateBytes = 2;
    } else {
        this.fileType %= 100;
        this.coordinateBytes = 4;
    }
    String mapsheet = readString(11);
    mapsheet = mapsheet.replaceAll("\\.", "").toLowerCase();
    final Bcgs20000RectangularMapGrid bcgsGrid = new Bcgs20000RectangularMapGrid();
    final UtmRectangularMapGrid utmGrid = new UtmRectangularMapGrid();
    final double latitude = bcgsGrid.getLatitude(mapsheet) + 0.05;
    final double longitude = bcgsGrid.getLongitude(mapsheet) - 0.1;
    final int crsId = utmGrid.getNad83Srid(longitude, latitude);
    final CoordinateSystem coordinateSystem = EpsgCoordinateSystems.getCoordinateSystem(crsId);
    final String submissionDateString = readString(6);
    final double centreX = readLEInt(this.in);
    final double centreY = readLEInt(this.in);
    this.center = new PointDoubleXY(centreX, centreY);
    this.factory = GeometryFactory.fixed3d(coordinateSystem.getCoordinateSystemId(), 1.0, 1.0, 1.0);
    setProperty(IoConstants.GEOMETRY_FACTORY, this.factory);
}
Also used : Bcgs20000RectangularMapGrid(com.revolsys.gis.grid.Bcgs20000RectangularMapGrid) CoordinateSystem(com.revolsys.geometry.cs.CoordinateSystem) UtmRectangularMapGrid(com.revolsys.gis.grid.UtmRectangularMapGrid) LineString(com.revolsys.geometry.model.LineString) PointDoubleXY(com.revolsys.geometry.model.impl.PointDoubleXY) Point(com.revolsys.geometry.model.Point)

Aggregations

CoordinateSystem (com.revolsys.geometry.cs.CoordinateSystem)1 LineString (com.revolsys.geometry.model.LineString)1 Point (com.revolsys.geometry.model.Point)1 PointDoubleXY (com.revolsys.geometry.model.impl.PointDoubleXY)1 Bcgs20000RectangularMapGrid (com.revolsys.gis.grid.Bcgs20000RectangularMapGrid)1 UtmRectangularMapGrid (com.revolsys.gis.grid.UtmRectangularMapGrid)1