Search in sources :

Example 11 with AbstractObservationValue

use of org.n52.shetland.ogc.om.AbstractObservationValue 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)6 SingleObservationValue (org.n52.shetland.ogc.om.SingleObservationValue)4 List (java.util.List)3 TVPDefaultMetadataPropertyType (net.opengis.waterml.x20.TVPDefaultMetadataPropertyType)3 AbstractObservationValue (org.n52.shetland.ogc.om.AbstractObservationValue)3 TimeLocationValueTriple (org.n52.shetland.ogc.om.TimeLocationValueTriple)3 TLVTValue (org.n52.shetland.ogc.om.values.TLVTValue)3 DefaultTVPMeasurementMetadataDocument (net.opengis.waterml.x20.DefaultTVPMeasurementMetadataDocument)2 MeasurementTimeseriesDocument (net.opengis.waterml.x20.MeasurementTimeseriesDocument)2 MeasurementTimeseriesType (net.opengis.waterml.x20.MeasurementTimeseriesType)2 TVPMeasurementMetadataType (net.opengis.waterml.x20.TVPMeasurementMetadataType)2 Geometry (org.locationtech.jts.geom.Geometry)2 PointValuePair (org.n52.shetland.ogc.om.PointValuePair)2 StreamingValue (org.n52.shetland.ogc.om.StreamingValue)2 TimeValuePair (org.n52.shetland.ogc.om.TimeValuePair)2 TVPValue (org.n52.shetland.ogc.om.values.TVPValue)2 QName (javax.xml.namespace.QName)1 MeasureOrNilReasonListType (net.opengis.gml.x32.MeasureOrNilReasonListType)1 QuantityListDocument (net.opengis.gml.x32.QuantityListDocument)1 CategoricalTimeseriesDocument (net.opengis.waterml.x20.CategoricalTimeseriesDocument)1