Search in sources :

Example 11 with UoM

use of org.n52.shetland.ogc.UoM in project series-rest-api by 52North.

the class ChartIoHandler method createRangeLabel.

protected String createRangeLabel(DatasetOutput<?> output) {
    DatasetParameters parameters = output.getDatasetParameters();
    ParameterOutput phenomenon = parameters.getPhenomenon();
    StringBuilder uom = new StringBuilder();
    uom.append(phenomenon.getLabel());
    String uomLabel = output.getUom();
    if (uomLabel != null && !uomLabel.isEmpty()) {
        uom.append(" [").append(uomLabel).append("]");
    }
    return uom.toString();
}
Also used : DatasetParameters(org.n52.io.response.dataset.DatasetParameters) ParameterOutput(org.n52.io.response.ParameterOutput)

Example 12 with UoM

use of org.n52.shetland.ogc.UoM in project series-rest-api by 52North.

the class ChartIoHandler method createRangeLabel.

protected String createRangeLabel(DatasetOutput timeseriesMetadata) {
    SeriesParameters parameters = timeseriesMetadata.getSeriesParameters();
    ParameterOutput phenomenon = parameters.getPhenomenon();
    StringBuilder uom = new StringBuilder();
    uom.append(phenomenon.getLabel());
    String uomLabel = timeseriesMetadata.getUom();
    if (uomLabel != null && !uomLabel.isEmpty()) {
        uom.append(" [").append(uomLabel).append("]");
    }
    return uom.toString();
}
Also used : SeriesParameters(org.n52.io.response.dataset.SeriesParameters) ParameterOutput(org.n52.io.response.ParameterOutput)

Example 13 with UoM

use of org.n52.shetland.ogc.UoM in project arctic-sea by 52North.

the class SweEnvelopeTest method should_create_valid_sosSweEnvelope_from_sosEnvelope.

@Test
public void should_create_valid_sosSweEnvelope_from_sosEnvelope() {
    final int srid = 52;
    final double x1 = 1;
    final double y1 = 2;
    final double y2 = 3;
    final double x2 = 4;
    final BigDecimal bx1 = new BigDecimal(x1);
    final BigDecimal by1 = new BigDecimal(y1);
    final BigDecimal by2 = new BigDecimal(y2);
    final BigDecimal bx2 = new BigDecimal(x2);
    final String uom = "deg";
    final ReferencedEnvelope sosEnvelope = new ReferencedEnvelope(new Envelope(x1, x2, y1, y2), srid);
    final SweEnvelope sweEnvelope = new SweEnvelope(sosEnvelope, uom, false);
    // srid
    assertThat(sweEnvelope.getReferenceFrame(), is(Integer.toString(srid)));
    // x1
    final List<? extends SweCoordinate<?>> lcCoordinates = sweEnvelope.getLowerCorner().getCoordinates();
    assertThat(((BigDecimal) lcCoordinates.get(0).getValue().getValue()), is(bx1));
    // y1
    assertThat(((BigDecimal) lcCoordinates.get(1).getValue().getValue()), is(by1));
    // x2
    final List<? extends SweCoordinate<?>> ucCoordinates = sweEnvelope.getUpperCorner().getCoordinates();
    assertThat(((BigDecimal) ucCoordinates.get(0).getValue().getValue()), is(bx2));
    // y2
    assertThat(((BigDecimal) ucCoordinates.get(1).getValue().getValue()), is(by2));
    // uom
    assertThat(((SweQuantity) lcCoordinates.get(0).getValue()).getUom(), is(uom));
    assertThat(((SweQuantity) lcCoordinates.get(1).getValue()).getUom(), is(uom));
    assertThat(((SweQuantity) ucCoordinates.get(0).getValue()).getUom(), is(uom));
    assertThat(((SweQuantity) ucCoordinates.get(1).getValue()).getUom(), is(uom));
    // northing
    assertThat(lcCoordinates.get(0).getName(), is(SweCoordinateNames.EASTING));
    assertThat(ucCoordinates.get(0).getName(), is(SweCoordinateNames.EASTING));
    // easting
    assertThat(lcCoordinates.get(1).getName(), is(SweCoordinateNames.NORTHING));
    assertThat(ucCoordinates.get(1).getName(), is(SweCoordinateNames.NORTHING));
}
Also used : ReferencedEnvelope(org.n52.shetland.util.ReferencedEnvelope) ReferencedEnvelope(org.n52.shetland.util.ReferencedEnvelope) Envelope(org.locationtech.jts.geom.Envelope) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Example 14 with UoM

use of org.n52.shetland.ogc.UoM in project arctic-sea by 52North.

the class SweEnvelope method createSweVector.

private static SweVector createSweVector(double x, double y, String uom) {
    SweQuantity xCoord = new SweQuantity().setAxisID(SweConstants.X_AXIS).setValue(x).setUom(uom);
    SweQuantity yCoord = new SweQuantity().setAxisID(SweConstants.Y_AXIS).setValue(y).setUom(uom);
    return new SweVector(new SweCoordinate<>(SweCoordinateNames.EASTING, xCoord), new SweCoordinate<>(SweCoordinateNames.NORTHING, yCoord));
}
Also used : SweQuantity(org.n52.shetland.ogc.swe.simpleType.SweQuantity)

Example 15 with UoM

use of org.n52.shetland.ogc.UoM in project arctic-sea by 52North.

the class FieldDecoderTest method testQuantityRange.

@Test
public void testQuantityRange() throws DecodingException {
    ObjectNode json = createField().put(JSONConstants.TYPE, JSONConstants.QUANTITY_RANGE_TYPE).put(JSONConstants.UOM, UOM);
    SweField field = checkCommon(json, false);
    assertThat(field.getElement(), is(instanceOf(SweQuantityRange.class)));
    SweQuantityRange swe = (SweQuantityRange) field.getElement();
    errors.checkThat(swe.getUom(), is(UOM));
    errors.checkThat(swe.getValue(), is(nullValue()));
}
Also used : SweQuantityRange(org.n52.shetland.ogc.swe.simpleType.SweQuantityRange) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) SweField(org.n52.shetland.ogc.swe.SweField) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)12 SweField (org.n52.shetland.ogc.swe.SweField)9 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)8 SweQuantity (org.n52.shetland.ogc.swe.simpleType.SweQuantity)4 ParameterOutput (org.n52.io.response.ParameterOutput)3 SweQuantityRange (org.n52.shetland.ogc.swe.simpleType.SweQuantityRange)3 SweTime (org.n52.shetland.ogc.swe.simpleType.SweTime)3 SweTimeRange (org.n52.shetland.ogc.swe.simpleType.SweTimeRange)3 BigDecimal (java.math.BigDecimal)2 DefaultTVPMeasurementMetadataDocument (net.opengis.waterml.x20.DefaultTVPMeasurementMetadataDocument)2 MeasurementTimeseriesDocument (net.opengis.waterml.x20.MeasurementTimeseriesDocument)2 MeasurementTimeseriesType (net.opengis.waterml.x20.MeasurementTimeseriesType)2 TVPDefaultMetadataPropertyType (net.opengis.waterml.x20.TVPDefaultMetadataPropertyType)2 TVPMeasurementMetadataType (net.opengis.waterml.x20.TVPMeasurementMetadataType)2 Envelope (org.locationtech.jts.geom.Envelope)2 OmObservableProperty (org.n52.shetland.ogc.om.OmObservableProperty)2 MeasurementTimeseriesMetadata (org.n52.shetland.ogc.om.series.wml.MeasurementTimeseriesMetadata)2 TimeseriesMetadata (org.n52.shetland.ogc.om.series.wml.TimeseriesMetadata)2 InterpolationType (org.n52.shetland.ogc.om.series.wml.WaterMLConstants.InterpolationType)2 ReferencedEnvelope (org.n52.shetland.util.ReferencedEnvelope)2