- add TextObservation format for pechgraben fotos

This commit is contained in:
Arno Kaimbacher 2022-03-09 17:44:22 +01:00
parent edfff8bd84
commit 1b7cfa1586
4 changed files with 335 additions and 24 deletions

View File

@ -45,6 +45,9 @@ def main():
# "Inklinometer inclino1_02, Gschliefgraben Glasfaser" # "Inklinometer inclino1_02, Gschliefgraben Glasfaser"
# ) # )
# procedure = Procedure( "inclino1_02","inclino1_02") # procedure = Procedure( "inclino1_02","inclino1_02")
# foi = FoI("degree", "m", (13.774966, 47.910849, 0.0),
# "inclino1-glasfaser-gschliefgraben",
# "Glasfaser Untersuchungen am Gschliefgraben (Gmunden)")
# offering = Offering( # offering = Offering(
# "https://geomon.geologie.ac.at/52n-sos-webapp/api/offerings/", # "https://geomon.geologie.ac.at/52n-sos-webapp/api/offerings/",
@ -52,6 +55,19 @@ def main():
# "Inklinometer inclino1_05, Gschliefgraben Glasfaser" # "Inklinometer inclino1_05, Gschliefgraben Glasfaser"
# ) # )
# procedure = Procedure("inclino1_05", "inclino1_05") # procedure = Procedure("inclino1_05", "inclino1_05")
# foi = FoI("degree", "m", (13.774966, 47.910849, 0.0),
# "inclino1-glasfaser-gschliefgraben",
# "Glasfaser Untersuchungen am Gschliefgraben (Gmunden)")
# offering = Offering(
# "https://geomon.geologie.ac.at/52n-sos-webapp/api/offerings/",
# "inclino1_14",
# "Inklinometer inclino1_14, Gschliefgraben Glasfaser"
# )
# procedure = Procedure("inclino1_14", "inclino1_14")
# foi = FoI("degree", "m", (13.774966, 47.910849, 0.0),
# "inclino1-glasfaser-gschliefgraben",
# "Glasfaser Untersuchungen am Gschliefgraben (Gmunden)")
offering = Offering( offering = Offering(
"https://geomon.geologie.ac.at/52n-sos-webapp/api/offerings/", "https://geomon.geologie.ac.at/52n-sos-webapp/api/offerings/",
@ -59,9 +75,9 @@ def main():
"Inklinometer inclino1_06, Gschliefgraben Glasfaser" "Inklinometer inclino1_06, Gschliefgraben Glasfaser"
) )
procedure = Procedure("inclino1_06", "inclino1_06") procedure = Procedure("inclino1_06", "inclino1_06")
foi = FoI("degree", "m", (13.774966, 47.910849, 0.0),
foi = FoI("degree", "m", (47.910849, 13.774966, 0.0), "inclino1-glasfaser-gschliefgraben",
"FBGuard23", "Glasfaser Untersuchungen am Gschliefgraben (Gmunden)") "Glasfaser Untersuchungen am Gschliefgraben (Gmunden)")
sensor_type = SensorType("inclinometer") sensor_type = SensorType("inclinometer")
post_data = insert_sensor(offering, procedure, foi, sensor_type) post_data = insert_sensor(offering, procedure, foi, sensor_type)

View File

@ -0,0 +1,207 @@
https://portal.ogc.org/files/?artifact_id=64353
Seite 25
https://github.com/52North/SWE-Ingestion-Service/blob/dev/docs/ProcessDescription.md
<?xml version="1.0" encoding="UTF-8"?>
<sos:InsertObservation service="SOS" version="2.0.0"
xmlns:sos="http://www.opengis.net/sos/2.0"
xmlns:swes="http://www.opengis.net/swes/2.0"
xmlns:swe="http://www.opengis.net/swe/2.0"
xmlns:sml="http://www.opengis.net/sensorML/1.0.1"
xmlns:gml="http://www.opengis.net/gml/3.2"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:om="http://www.opengis.net/om/2.0"
xmlns:sams="http://www.opengis.net/samplingSpatial/2.0"
xmlns:sf="http://www.opengis.net/sampling/2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/sos/2.0 http://schemas.opengis.net/sos/2.0/sos.xsd http://www.opengis.net/samplingSpatial/2.0 http://schemas.opengis.net/samplingSpatial/2.0/spatialSamplingFeature.xsd">
<!-- <sos:offering>camera1</sos:offering> -->
<sos:observation>
<om:OM_Observation gml:id="ob5">
<!-- <om:type xlink:href="http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_TextObservation"/> -->
<om:type xlink:href="http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_CategoryObservation"/>
<om:phenomenonTime>
<gml:TimeInstant gml:id="phenomenonTime">
<gml:timePosition>2019-11-19T17:46:15.000+00:00</gml:timePosition>
</gml:TimeInstant>
</om:phenomenonTime>
<!-- <om:resultTime>
<gml:TimeInstant gml:id="resultTime">
<gml:timePosition>2019-11-19T13:50:00.000+00:00</gml:timePosition>
</gml:TimeInstant>
</om:resultTime> -->
<om:resultTime>
<gml:TimeInstant gml:id="resultTime">
<gml:timePosition>2019-11-19T13:50:00.000+00:00</gml:timePosition>
</gml:TimeInstant>
</om:resultTime>
<om:procedure xlink:href="camera1"/>
<om:observedProperty xlink:href="http://www.opengis.net/def/property/humanVisualPerception"/>
<om:featureOfInterest>
<sams:SF_SpatialSamplingFeature gml:id="ssf_instance">
<gml:identifier codeSpace="http://www.opengis.net/def/nil/OGC/0/unknown">pechgraben</gml:identifier>
<gml:name>Katastropheneinsatz in Pechgraben</gml:name>
<sf:type xlink:href="http://www.opengis.net/def/samplingFeatureType/OGC-OM/2.0/SF_SamplingPoint"/>
<sf:sampledFeature xlink:href="http://www.52north.org/test/featureOfInterest/1"/>
<sams:shape>
<gml:Point xmlns:ns="http://www.opengis.net/gml/3.2" ns:id="Point_ssf_b3a826dd44012201b013c90c51da28c041f7a92e0cc47260eb9888f6a4e9f747">
<gml:pos srsName="http://www.opengis.net/def/crs/EPSG/0/4326">14.54621, 47.92861</gml:pos>
</gml:Point>
</sams:shape>
</sams:SF_SpatialSamplingFeature>
</om:featureOfInterest>
<!-- <om:result xsi:type="xs:string">text_value</om:result> -->
<om:result xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">
https://www.flickr.com/photos/username/123456789/
</om:result>
<om:result xsi:type="gml:ReferenceType" xlink:href="https://www.flickr.com/photos/username/123456789/"/>
</om:OM_Observation>
</sos:observation>
</sos:InsertObservation>
<om:result xsi:type="swe:DataRecordPropertyType">
<swe:DataRecord>
<!-- <swe:field name="Time">
<swe:Time definition="urn:ogc:def:parameter:x-istsos:1.0:time:iso8601">
2014-06-03T14:10:00+0200
</swe:Time>
</swe:field> -->
<!-- <swe:field name="test_observable_property_9_8_2">
<swe:Category definition="http://www.52north.org/test/observableProperty/9_8_2">
<swe:codeSpace xlink:href="NOT_DEFINED"/>
<swe:value>sunny</swe:value>
</swe:Category>
</swe:field> -->
<!-- <swe:field name="test_observable_property_9_8_3">
<swe:Count definition="http://www.52north.org/test/observableProperty/9_8_3">
<swe:value>35</swe:value>
</swe:Count>
</swe:field> -->
<swe:field name="Url">
<swe:Text definition="Url">
<swe:value>I am text</swe:value>
</swe:Text>
</swe:field>
<swe:field name="Visibility">
<swe:Boolean definition="Visibility">
<swe:value>true</swe:value>
</swe:Boolean>
</swe:field>
</swe:DataRecord>
</om:result>
{
"request": "InsertObservation",
"service": "SOS",
"version": "2.0.0",
"offering": "camera1",
"observation": {
"identifier": {
"value": "ob_test",
"codespace": "http://www.opengis.net/def/nil/OGC/0/unknown"
},
"type": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement",
"procedure": "camera1",
"observedProperty": "Image",
"featureOfInterest": {
"identifier": {
"value": "pechgraben",
"codespace": "http://www.opengis.net/def/nil/OGC/0/unknown"
},
"name": [
{
"value": "Katastropheneinsatz in Pechgraben",
"codespace": "http://www.opengis.net/def/nil/OGC/0/unknown"
}
],
"sampledFeature": [
"http://www.52north.org/test/featureOfInterest/world"
],
"geometry": {
"type": "Point",
"coordinates": [
14.54621,
47.92861
],
"crs": {
"type": "name",
"properties": {
"name": "EPSG:4326"
}
}
}
},
"phenomenonTime": "2019-11-19T17:45:15+00:00",
"resultTime": "2019-11-19T17:45:15+00:00",
"result": {
"uom": "m",
"value": 0.28
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope
xmlns:env="http://www.w3.org/2003/05/soap-envelope"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2003/05/soap-envelope http://www.w3.org/2003/05/soap-envelope/soap-envelope.xsd">
<env:Body>
<sos:InsertObservation service="SOS" version="2.0.0"
xmlns:sos="http://www.opengis.net/sos/2.0"
xmlns:swes="http://www.opengis.net/swes/2.0"
xmlns:swe="http://www.opengis.net/swe/2.0"
xmlns:sml="http://www.opengis.net/sensorML/1.0.1"
xmlns:gml="http://www.opengis.net/gml/3.2"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:om="http://www.opengis.net/om/2.0"
xmlns:sams="http://www.opengis.net/samplingSpatial/2.0"
xmlns:sf="http://www.opengis.net/sampling/2.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="http://www.opengis.net/sos/2.0 http://schemas.opengis.net/sos/2.0/sos.xsd http://www.opengis.net/samplingSpatial/2.0 http://schemas.opengis.net/samplingSpatial/2.0/spatialSamplingFeature.xsd">
<!-- multiple offerings are possible -->
<sos:offering>camera1</sos:offering>
<sos:observation>
<om:OM_Observation gml:id="o1">
<om:type xlink:href="http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_TextObservation"/>
<om:phenomenonTime>
<gml:TimeInstant gml:id="phenomenonTime">
<gml:timePosition>2021-11-19T17:45:15.000+00:00</gml:timePosition>
</gml:TimeInstant>
</om:phenomenonTime>
<om:resultTime xlink:href="#phenomenonTime"/>
<om:procedure xlink:href="camera1"/>
<om:observedProperty xlink:href="Image"/>
<om:featureOfInterest>
<sams:SF_SpatialSamplingFeature gml:id="ssf_instance">
<gml:identifier codeSpace="">pechgraben</gml:identifier>
<gml:name>Katastropheneinsatz in Pechgraben</gml:name>
<sf:type xlink:href="http://www.opengis.net/def/samplingFeatureType/OGC-OM/2.0/SF_SamplingPoint"/>
<sf:sampledFeature xlink:href="http://www.52north.org/test/featureOfInterest/1"/>
<sams:shape>
<gml:Point gml:id="test_feature_9">
<gml:pos srsName="http://www.opengis.net/def/crs/EPSG/0/4326">14.54621 47.92861</gml:pos>
</gml:Point>
</sams:shape>
</sams:SF_SpatialSamplingFeature>
</om:featureOfInterest>
<om:result xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">
https://www.flickr.com/photos/username/55555555/
</om:result>
</om:OM_Observation>
</sos:observation>
</sos:InsertObservation>
</env:Body>
</env:Envelope>

View File

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<sos:InsertObservation
xmlns:gml="http://www.opengis.net/gml"
xmlns:om="http://www.opengis.net/om/1.0"
xmlns:sos="http://www.opengis.net/sos/1.0"
xmlns:swe="http://www.opengis.net/swe"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.opengis.net/sos/1.0.0/sosAll.xsd"
service="SOS" version="1.0.0">
<sos:AssignedSensorId>xxxxxxxxxxxxxxxxxxxxxxxxxxx</sos:AssignedSensorId>
<om:Observation>
<om:procedure xlink:href="urn:ogc:def:procedure:x-istsos:1.0:LOCARNO"/>
<om:samplingTime>
<gml:TimePeriod>
<gml:beginPosition>2014-06-03T15:08:00Z</gml:beginPosition>
<gml:endPosition>2014-06-03T15:48:00Z</gml:endPosition>
</gml:TimePeriod>
</om:samplingTime>
<om:observedProperty>
<swe:CompositePhenomenon dimension="5">
<swe:component xlink:href="urn:ogc:def:parameter:x-istsos:1.0:time:iso8601"/>
<swe:component xlink:href="urn:ogc:def:parameter:x-istsos:1.0:meteo:air:rainfall"/>
<swe:component
xlink:href="urn:ogc:def:parameter:x-istsos:1.0:meteo:air:rainfall:qualityIndex"/>
<swe:component
xlink:href="urn:ogc:def:parameter:x-istsos:1.0:meteo:air:temperature"/>
<swe:component
xlink:href="urn:ogc:def:parameter:x-istsos:1.0:meteo:air:temperature:qualityIndex"/>
</swe:CompositePhenomenon>
</om:observedProperty>
<om:featureOfInterest xlink:href="urn:ogc:def:feature:x-istsos:1.0:Point:LOCARNO"/>
<om:result>
<swe:DataArray>
<swe:elementCount>
<swe:value>5</swe:value>
</swe:elementCount>
<swe:elementType name="SimpleDataArray">
<swe:DataRecord definition="urn:ogc:def:dataType:x-istsos:1.0:timeSeries">
<swe:field name="Time">
<swe:Time definition="urn:ogc:def:parameter:x-istsos:1.0:time:iso8601"/>
</swe:field>
<swe:field name="air-rainfall">
<swe:Quantity definition="urn:ogc:def:parameter:x-istsos:1.0:meteo:air:rainfall">
<swe:uom code="mm"/>
</swe:Quantity>
</swe:field>
<swe:field name="air-rainfall:qualityIndex">
<swe:Quantity definition="urn:ogc:def:parameter:x-istsos:1.0:meteo:air:rainfall:qualityIndex">
<swe:uom code="-"/>
</swe:Quantity>
</swe:field>
<swe:field name="air-temperature">
<swe:Quantity definition="urn:ogc:def:parameter:x-istsos:1.0:meteo:air:temperature">
<swe:uom code="\xc2\xb0C"/>
</swe:Quantity>
</swe:field>
<swe:field name="air-temperature:qualityIndex">
<swe:Quantity definition="urn:ogc:def:parameter:x-istsos:1.0:meteo:air:temperature:qualityIndex">
<swe:uom code="-"/>
</swe:Quantity>
</swe:field>
</swe:DataRecord>
</swe:elementType>
<swe:encoding>
<swe:TextBlock blockSeparator="@" decimalSeparator="." tokenSeparator=","/>
</swe:encoding>
<swe:values>
2014-06-03T14:10:00+0200,0.000000,200,20.000000,200@
2014-06-03T14:20:00+0200,0.000000,200,20.100000,200@
2014-06-03T14:30:00+0200,0.000000,200,20.200000,200@
2014-06-03T14:40:00+0200,0.000000,200,20.500000,200@
2014-06-03T14:50:00+0200,0.000000,200,20.500000,200@
2014-06-03T15:00:00+0200,0.000000,200,20.400000,200@
2014-06-03T15:10:00+0200,0.000000,200,20.400000,200@
2014-06-03T15:20:00+0200,0.100000,200,19.600000,200@
2014-06-03T15:30:00+0200,0.100000,200,19.100000,200@
2014-06-03T15:40:00+0200,0.000000,200,19.000000,200@
2014-06-03T15:50:00+0200,0.000000,200,20.600000,200
</swe:values>
</swe:DataArray>
</om:result>
</om:Observation>
</sos:InsertObservation>

View File

@ -1,9 +1,16 @@
'''
Sqlalchemy version: 1.2.15
Python version: 3.7
'''
import os import os
from datetime import datetime, date, timedelta from datetime import datetime
from exif import Image from exif import Image
def main(): def main():
folder_path = 'C:/Users/arno/Documents/Fotos' ''' main method '''
folder_path = 'C:/Users/kaiarn/Documents/Fotos'
# img_filename = '_DSC9548.JPG' # img_filename = '_DSC9548.JPG'
# img_path = f'{folder_path}/{img_filename}' # img_path = f'{folder_path}/{img_filename}'
@ -11,9 +18,9 @@ def main():
directory = os.listdir(folder_path) directory = os.listdir(folder_path)
for files in directory: for files in directory:
if files.endswith (('jpg','JPG','png','PNG','tiff','TIFF')): if files.endswith(('jpg', 'JPG', 'png', 'PNG', 'tiff', 'TIFF')):
file_path = os.path.join(folder_path, files) file_path = os.path.join(folder_path, files)
print (file_path) # print(file_path)
img_file = open(file_path, 'rb') img_file = open(file_path, 'rb')
img: Image = Image(img_file) img: Image = Image(img_file)
if img.has_exif: if img.has_exif:
@ -27,10 +34,10 @@ def main():
datetime_original = img.get("datetime_original") datetime_original = img.get("datetime_original")
# print(datetime_original) # print(datetime_original)
# Grab the date # Grab the date
date_obj = datetime.strptime(datetime_original, '%Y:%m:%d %H:%M:%S') date_obj = datetime.strptime(
# print(date_obj) datetime_original, '%Y:%m:%d %H:%M:%S')
print(date_obj)
# print(f"Longitude: {img.get('gps_longitude')} {img.get('gps_longitude_ref')}\n")
# with open(img_path, 'rb') as img_file: # with open(img_path, 'rb') as img_file:
# img = Image(img_file) # img = Image(img_file)
@ -40,8 +47,6 @@ def main():
# info = "does not contain any EXIF information" # info = "does not contain any EXIF information"
# print(f"Image {img_file.name}: {info}") # print(f"Image {img_file.name}: {info}")
# print(img.list_all()) # print(img.list_all())
# print(img.has_exif) # print(img.has_exif)
# # Make of device which captured image: NIKON CORPORATION # # Make of device which captured image: NIKON CORPORATION
@ -66,7 +71,6 @@ def main():
# print("---------------------") # print("---------------------")
# print(f"Latitude: {img.copyright} {img.get('gps_latitude_ref')}") # print(f"Latitude: {img.copyright} {img.get('gps_latitude_ref')}")
# print(f"Longitude: {img.get('gps_longitude')} {img.get('gps_longitude_ref')}\n") # print(f"Longitude: {img.get('gps_longitude')} {img.get('gps_longitude_ref')}\n")
if __name__ == "__main__": if __name__ == "__main__":
# load_dotenv(find_dotenv()) # load_dotenv(find_dotenv())
# print('sensors: {}'.format(os.environ.get( # print('sensors: {}'.format(os.environ.get(