private List<OmObservation> mergeObservations(List<OmObservation> observationCollection) { return new ObservationMerger() .mergeObservations(observationCollection, ObservationMergeIndicator .defaultObservationMergerIndicator().setObservationType(false)); }
private String getUnit(OmObservation o) { if (o.getObservationConstellation().getObservableProperty() instanceof OmObservableProperty && ((OmObservableProperty)o.getObservationConstellation().getObservableProperty()).isSetUnit()) { return ((OmObservableProperty)o.getObservationConstellation().getObservableProperty()).getUnit(); } else if (o.getValue().isSetValue() && o.getValue().getValue().isSetUnit()) { return o.getValue().getValue().getUnit(); } return null; }
/** * Get the geometry value from the featureOfInterest of the * {@link OmObservation} * * @param observation * The {@link OmObservation} to get the geometry from * @return The geometry */ protected Geometry getGeometryFromFeature(OmObservation observation) { return ((AbstractSamplingFeature) observation.getObservationConstellation().getFeatureOfInterest()).getGeometry(); }
private String getObservationType(OmObservation o) throws OwsExceptionReport { if (o.getObservationConstellation().isSetObservationType()) { return o.getObservationConstellation().getObservationType(); } else { return OMHelper.getObservationTypeFor(o.getValue().getValue()); } }
private void mergeValues(OmObservation combinedSosObs, OmObservation sosObservation) { SweDataArray combinedValue = (SweDataArray) combinedSosObs.getValue().getValue().getValue(); SweDataArray value = (SweDataArray) sosObservation.getValue().getValue().getValue(); if (value.isSetValues()) { combinedValue.addAll(value.getValues()); } }
/** * Check if the {@link OmObservation} has a featureOfInterest with geometry * value * * @param observation * {@link OmObservation} to check * @return <code>true</code>, if the {@link OmObservation} has a * featureOfInterest with geometry value */ protected boolean checkForFeatureGeometry(OmObservation observation) { if (observation.getObservationConstellation().isSetFeatureOfInterest() && observation.getObservationConstellation().getFeatureOfInterest() instanceof AbstractSamplingFeature) { return ((AbstractSamplingFeature) observation.getObservationConstellation().getFeatureOfInterest()) .isSetGeometry(); } return false; }
private void writeStreamingValueValues(FileWriter fw, OmObservation omObservation, String lineEnding) throws CodedException, OwsExceptionReport, IOException { StreamingValue observationValue = (StreamingValue) omObservation.getValue(); while (observationValue.hasNextValue()) { TimeValuePair timeValuePair = observationValue.nextValue(); if (timeValuePair != null) { writeSingleObservationValue(fw, timeValuePair.getTime(), timeValuePair.getValue(), lineEnding); } } }
@Override public void setValue(ObservationValue<?> value) { if (value.getValue() instanceof MultiPointCoverage) { super.setValue(value); } else { MultiPointCoverage multiPointCoverage = new MultiPointCoverage(getObservationID()); multiPointCoverage.setUnit(((AbstractObservationValue<?>) value).getUnit()); multiPointCoverage.addValue(new PointValuePair(getPoint(), value.getValue())); super.setValue(new SingleObservationValue<>(value.getPhenomenonTime(), multiPointCoverage)); } }
private String checkObservationType(OmObservation sosObservation) throws OwsExceptionReport { if (sosObservation.isSetResultType()) { return sosObservation.getResultType(); } else if (sosObservation.getValue() instanceof SingleObservationValue) { SingleObservationValue<?> observationValue = (SingleObservationValue<?>) sosObservation.getValue(); return OMHelper.getObservationTypeFor(observationValue.getValue()); } return OmConstants.OBS_TYPE_OBSERVATION; }
private void encodeObservableProperty(OmObservation o, ObjectNode json) { json.put(JSONConstants.OBSERVABLE_PROPERTY, o.getObservationConstellation().getObservableProperty().getIdentifier()); }
private JsonNode encodeResult(OmObservation o) throws OwsExceptionReport { Value<?> value = o.getValue().getValue(); String type = getObservationType(o); if (value instanceof TVPValue) { // if (type.equals(OmConstants.OBS_TYPE_SWE_ARRAY_OBSERVATION)) { return encodeTVPValue(o); // } } else { return encodeValue(value); } // throw new UnsupportedEncoderInputException(this, value); }
private void encodeFeatureOfInterest(OmObservation o, ObjectNode json) throws OwsExceptionReport { OmObservationConstellation oc = o.getObservationConstellation(); json.put(JSONConstants.FEATURE_OF_INTEREST, encodeObjectToJson(oc.getFeatureOfInterest())); }
public OmObservationConstellation parseObservationConstellation(JsonNode node) throws OwsExceptionReport { OmObservationConstellation oc = new OmObservationConstellation(); oc.setProcedure(parseProcedure(node)); oc.setObservableProperty(parseObservableProperty(node)); oc.setObservationType(parseObservationType(node)); oc.setFeatureOfInterest(parseFeatureOfInterest(node)); return oc; }
@Override protected void checkAndWriteIdentifier() throws OwsExceptionReport, XMLStreamException { if (getObservation().getObservationConstellation().isSetIdentifier()) { writeIdentifier(getObservation().getObservationConstellation().getIdentifierCodeWithAuthority()); writeNewLine(); } else { super.checkAndWriteIdentifier(); } }
private void writeMessStellennummer(FileWriter fw, OmObservation o, String lineEnding) throws IOException { String featureOfInterestIdentifier = o.getObservationConstellation().getFeatureOfInterestIdentifier(); if (featureOfInterestIdentifier != null && !featureOfInterestIdentifier.isEmpty()) { featureOfInterestIdentifier = ensureIdentifierLength(featureOfInterestIdentifier, UVFConstants.MAX_IDENTIFIER_LENGTH); } writeToFile(fw, String.format("$sb Mess-Stellennummer: %s", featureOfInterestIdentifier), lineEnding); }
private void writeMessGroesse(FileWriter fw, OmObservation o, String lineEnding) throws IOException { String observablePropertyIdentifier = o.getObservationConstellation().getObservablePropertyIdentifier(); observablePropertyIdentifier = ensureIdentifierLength(observablePropertyIdentifier, UVFConstants.MAX_IDENTIFIER_LENGTH); writeToFile(fw, String.format("$sb Mess-Groesse: %s", observablePropertyIdentifier), lineEnding); }
private void addResultToObservation(XmlObject xbResult, OmObservation sosObservation, List<OmObservableProperty> phenComponents) throws OwsExceptionReport { // TODO if OM_SWEArrayObservation and get ResultEncoding and // ResultStructure exists, if (sosObservation.getValue() instanceof SingleObservationValue) { addSingleObservationToResult(xbResult, sosObservation); } else if (sosObservation.getValue() instanceof MultiObservationValues) { addMultiObservationValueToResult(xbResult, sosObservation); } }
@Override protected void checkAndWriteName() throws OwsExceptionReport, XMLStreamException { if (getObservation().getObservationConstellation().isSetName()) { for (CodeType name : getObservation().getObservationConstellation().getName()) { writeName(name); writeNewLine(); } } else { super.checkAndWriteName(); } }
@Override protected void checkAndWriteDescription() throws XMLStreamException { if (getObservation().getObservationConstellation().isSetDescription()) { writeDescription(getObservation().getObservationConstellation().getDescription()); writeNewLine(); } else { super.checkAndWriteDescription(); } }
/** * constructor * * @param observation * {@link OmObservation} to convert */ public AbstractInspireObservation(OmObservation observation) { this(); observation.copyTo(this); if (getObservationConstellation().getFeatureOfInterest() instanceof AbstractSamplingFeature) { AbstractSamplingFeature sf = (AbstractSamplingFeature) getObservationConstellation().getFeatureOfInterest(); sf.setEncode(true); } }