Search in sources :

Example 26 with ObservationValue

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

the class WmlTDREncoderv20 method getTimePositionList.

private TimePositionListDocument getTimePositionList(AbstractObservationValue<?> observationValue) throws EncodingException {
    TimePositionListDocument timePositionListDoc = TimePositionListDocument.Factory.newInstance();
    TimePositionListType timePositionList = timePositionListDoc.addNewTimePositionList();
    timePositionList.setId(TIME_POSITION_LIST_ID_PREFIX + observationValue.getObservationID());
    timePositionList.setTimePositionList(getTimeArray((MultiObservationValues<?>) observationValue));
    return timePositionListDoc;
}
Also used : TimePositionListDocument(net.opengis.watermlDr.x20.TimePositionListDocument) MultiObservationValues(org.n52.shetland.ogc.om.MultiObservationValues) TimePositionListType(net.opengis.watermlDr.x20.TimePositionListType)

Example 27 with ObservationValue

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

the class WmlTVPEncoderv20 method createMeasurementTimeseries.

private XmlObject createMeasurementTimeseries(AbstractObservationValue<?> observationValue) throws CodedException {
    MeasurementTimeseriesDocument measurementTimeseriesDoc = MeasurementTimeseriesDocument.Factory.newInstance();
    MeasurementTimeseriesType measurementTimeseries = measurementTimeseriesDoc.addNewMeasurementTimeseries();
    measurementTimeseries.setId(TIMESERIES_ID_PREFIX + observationValue.getObservationID());
    // Default value
    TimeseriesMetadata timeseriesMetadata = new MeasurementTimeseriesMetadata().setCumulative(false);
    if (observationValue.isSetValue() && observationValue.isSetMetadata() && observationValue.getMetadata().isSetTimeseriesMetadata()) {
        timeseriesMetadata = observationValue.getMetadata().getTimeseriesmetadata();
    }
    addTimeseriesMetadata(measurementTimeseries, observationValue.getPhenomenonTime().getGmlId(), timeseriesMetadata);
    TVPDefaultMetadataPropertyType xbMetaComponent = measurementTimeseries.addNewDefaultPointMetadata();
    DefaultTVPMeasurementMetadataDocument xbDefMeasureMetaComponent = DefaultTVPMeasurementMetadataDocument.Factory.newInstance();
    TVPMeasurementMetadataType defaultTVPMeasurementMetadata = xbDefMeasureMetaComponent.addNewDefaultTVPMeasurementMetadata();
    // Default value
    InterpolationType interpolationType = InterpolationType.Continuous;
    if (observationValue.isSetValue() && observationValue.isSetDefaultPointMetadata() && observationValue.getDefaultPointMetadata().isSetDefaultTVPMeasurementMetadata() && observationValue.getDefaultPointMetadata().getDefaultTVPMeasurementMetadata().isSetInterpolationType()) {
        interpolationType = observationValue.getDefaultPointMetadata().getDefaultTVPMeasurementMetadata().getInterpolationtype();
    }
    defaultTVPMeasurementMetadata.addNewInterpolationType().setHref(interpolationType.getIdentifier());
    xbDefMeasureMetaComponent.getDefaultTVPMeasurementMetadata().getInterpolationType().setTitle(interpolationType.getTitle());
    String unit = addValues(measurementTimeseries, observationValue);
    // set uom
    if (unit != null && !unit.isEmpty()) {
        defaultTVPMeasurementMetadata.addNewUom().setCode(unit);
    // } else {
    // OmObservableProperty observableProperty =
    // (OmObservableProperty)
    // sosObservation.getObservationConstellation().getObservableProperty();
    // if (observableProperty.isSetUnit()) {
    // defaultTVPMeasurementMetadata.addNewUom().setCode(observableProperty.getUnit());
    // }
    }
    xbMetaComponent.set(xbDefMeasureMetaComponent);
    return measurementTimeseriesDoc;
}
Also used : TimeseriesMetadata(org.n52.shetland.ogc.om.series.wml.TimeseriesMetadata) MeasurementTimeseriesMetadata(org.n52.shetland.ogc.om.series.wml.MeasurementTimeseriesMetadata) MeasurementTimeseriesType(net.opengis.waterml.x20.MeasurementTimeseriesType) TVPDefaultMetadataPropertyType(net.opengis.waterml.x20.TVPDefaultMetadataPropertyType) MeasurementTimeseriesMetadata(org.n52.shetland.ogc.om.series.wml.MeasurementTimeseriesMetadata) TVPMeasurementMetadataType(net.opengis.waterml.x20.TVPMeasurementMetadataType) DefaultTVPMeasurementMetadataDocument(net.opengis.waterml.x20.DefaultTVPMeasurementMetadataDocument) InterpolationType(org.n52.shetland.ogc.om.series.wml.WaterMLConstants.InterpolationType) MeasurementTimeseriesDocument(net.opengis.waterml.x20.MeasurementTimeseriesDocument)

Aggregations

MultiObservationValues (org.n52.shetland.ogc.om.MultiObservationValues)9 SingleObservationValue (org.n52.shetland.ogc.om.SingleObservationValue)9 Test (org.junit.Test)7 TimeInstant (org.n52.shetland.ogc.gml.time.TimeInstant)7 QuantityValue (org.n52.shetland.ogc.om.values.QuantityValue)6 List (java.util.List)5 TimeValuePair (org.n52.shetland.ogc.om.TimeValuePair)5 TVPValue (org.n52.shetland.ogc.om.values.TVPValue)5 Geometry (org.locationtech.jts.geom.Geometry)4 StreamingValue (org.n52.shetland.ogc.om.StreamingValue)4 TimeLocationValueTriple (org.n52.shetland.ogc.om.TimeLocationValueTriple)4 CountValue (org.n52.shetland.ogc.om.values.CountValue)4 GeometryValue (org.n52.shetland.ogc.om.values.GeometryValue)4 TVPDefaultMetadataPropertyType (net.opengis.waterml.x20.TVPDefaultMetadataPropertyType)3 OmObservableProperty (org.n52.shetland.ogc.om.OmObservableProperty)3 BooleanValue (org.n52.shetland.ogc.om.values.BooleanValue)3 TLVTValue (org.n52.shetland.ogc.om.values.TLVTValue)3 SweDataArray (org.n52.shetland.ogc.swe.SweDataArray)3 MeasureOrNilReasonListType (net.opengis.gml.x32.MeasureOrNilReasonListType)2 QuantityListDocument (net.opengis.gml.x32.QuantityListDocument)2