User Tools

Site Tools



CommonSeries – dataitem, successor of Series. This dataitem intended to represent set of tetragonal cells or points. Regular tetragonal grid can be considered as set of cells, so it also can be represented by CommonSeries.

    public static int DEFAULT_LONGITUDE_ZONE = 33;
    public static char DEFAULT_LATITUDE_ZONE = 'N';
    private int longitudeZone;
    private char latitudeZone;
    private Unit<Length> unit;

Coordinates should be given as UTM coordinates in longitudeZone and latitudeZone zone in unit unit (instanse of javax.measure.unit.Unit<javax.measure.quantity.Length> class). If this parameters are not specified default values are used. Default unit is SI.METER. For more information about UTM see Universal Transverse Mercator coordinate system

Each cell is defined by coordinates of a cell's center and area, which this cell is covered. Coordinates are given in unit unit, area in square unit. Cell shape is square in longitudeZone, latitudeZone UTM zone or point if area is zero. The shape can be corrupted if coordinates are reprojected in another UTM zone.

CommonSeries, created in 33N and displayed in 33NCommonSeries, created in 32N and displayed in 33N

CommonSeries should contain three columns (com.env.jrodos.core.series.Column) with names x1), y2), square3). All parameters type are float[].class. Also it should contain one row (com.env.jrodos.core.series.Row). Three float arrays (for easting values, for northing values, for areas) should fill this row in x, y, square columns respectively. These arrays should be the same length, and this length is cells number.

    private transient List<GridSeries> values = new ArrayList<GridSeries>();

Instanses of GridSeries can use CommonSeries to put data in cells. GridSeries should contain at least one column with type float[].class, int[].class, byte[].class, String[].class, … and one row. Array with the same length as easting (northing, areas) length represents values of some quantity in cells. The order of values is the same as order in coordinates and areas. GridSerieses which is used CommonSeries cells should be put to values via setter.


Example of creating grid:

        // Creating CommonSeries and specifying UTM zone and unit 
        CommonSeries grid = new CommonSeries("Test",
                MapConstants.LONGITUDE_ZONE, MapConstants.LATITUDE_ZONE, SI.METER);
        // Creating columns
        grid.createColumn(SeriesConstants.x, float[].class);
        grid.createColumn(SeriesConstants.y, float[].class);
        grid.createColumn(SeriesConstants.square, float[].class);
        // Creating row
        int row = grid.appendRow();
        // Creating arrays. Please note, that the array lengths are identical (nsquares)
        float[] x = new float[nsquares];
        float[] y = new float[nsquares];
        float[] area = new float[nsquares];
        // Filling arrays with coordiantes and areas
        int index;
        float startValueX = 20000.0f;
        float startValueY = 5600000.0f;
        for (int yi = 0; yi < nrow; yi++){
            for (int xi = 0; xi < ncol; xi++){
                index = xi  + ncol * yi;
                x[index] = (float)(startValueX + resolution * xi);
                y[index] = (float)(startValueY + resolution * yi);
                area[index] = (float)(resolution*resolution);
        // Puting arrays to CommonSeries
        grid.setValue(row, SeriesConstants.x, x);
        grid.setValue(row, SeriesConstants.y, y);
        grid.setValue(row, SeriesConstants.square, area);
        // Grid is created       

Example of using CommonSeries:

        // Creating GridSeries and binding it to our CommonSeries grid
        GridSeries envCells = new GridSeries("Breakdowns", grid);
        // Creating column
        envCells.createColumn(SeriesConstants.value, String[].class);
        // Creating row
        int row = envCells.appendRow();
        // Creating array for values.
        // Please note, that the array length is the same nsquares
        String[] envassign = new String[nsquares];
        // Filling with some values
        for (int i=0; i<nsquares; i++)
            if((i % ncol)< 2) envassign[i]="env1";
            else envassign[i]="env2";
        // Puting values to GridSeries 
        envCells.setValue(row, SeriesConstants.value, envassign);
1) you can use SeriesConstants.x final variable
2) you can use SeriesConstants.y final variable
3) you can use SeriesConstants.square final variable
jrodos/technical_notes/dataitems/commonseries.txt · Last modified: 2015/03/24 15:32 (external edit)