diff --git a/insert_sensor/wrapper.py b/insert_sensor/wrapper.py
index fdc85a3..bd85637 100644
--- a/insert_sensor/wrapper.py
+++ b/insert_sensor/wrapper.py
@@ -78,6 +78,9 @@ class SensorType:
elif type_ == "piezometer": # PIEZOMETER
self.pattern = {"name": "piezometer", "type": 'fixed', "attributes": [
("Elevation", "m")]}
+ elif type_ == "tachymeter": # TACHYMETER
+ self.pattern = {"name": "tachymeter", "type": 'mobile', "attributes": [
+ ("TachymeterLocation", "go")]}
elif type_ == "noise": # NOISE
self.pattern = {"name": "noise", "type": 'fixed', "attributes": [
("Battery level", "m"), ("Noise", "m")]}
diff --git a/notes.txt b/notes.txt
index c03d091..5b05bcd 100644
--- a/notes.txt
+++ b/notes.txt
@@ -32,6 +32,7 @@ d:/Software/geomon/.venv/Scripts/python.exe -m pip install -U autopep8
python -m pip install fdb
python -m pip install sqlalchemy-firebird
python -m pip uninstall psycopg2
+python -m pip install pyproj
Marshmallow provides functionality to serialize and deserialize Python objects as they flow out of and into our JSON-based REST API. Marshmallow converts Python class instances to objects that can be converted to JSON.
python -m pip install marshmallow-sqlalchemy marshmallow
diff --git a/voegelsberg/import_feature_sensor.py b/voegelsberg/import_feature_sensor.py
deleted file mode 100644
index 1dbafd7..0000000
--- a/voegelsberg/import_feature_sensor.py
+++ /dev/null
@@ -1 +0,0 @@
-# https://lists.ogc.org/pipermail/sensorml/2008-September/000573.html
\ No newline at end of file
diff --git a/voegelsberg/insert_sensors/ImportMobileSensor.xml b/voegelsberg/insert_sensors/ImportMobileSensor.xml
new file mode 100644
index 0000000..fd73916
--- /dev/null
+++ b/voegelsberg/insert_sensors/ImportMobileSensor.xml
@@ -0,0 +1 @@
+http://www.opengis.net/sensorml/2.0{procedure_identifier}longName{procedure_name}shortName{procedure_name}{offering_label}{offering_name}truetruefeaturesOfInterest{feature_id}{feature_name}{coordinates}{cord_x}{cord_y}{height}TachymeterLocationhttp://www.opengis.net/def/observationType/OGC-OM/2.0/OM_GeometryObservationhttp://www.opengis.net/def/samplingFeatureType/OGC-OM/2.0/SF_SamplingPoint
\ No newline at end of file
diff --git a/voegelsberg/insert_sensors/ImportMobileSensor_Example.xml b/voegelsberg/insert_sensors/ImportMobileSensor_Example.xml
new file mode 100644
index 0000000..af075d9
--- /dev/null
+++ b/voegelsberg/insert_sensors/ImportMobileSensor_Example.xml
@@ -0,0 +1,110 @@
+
+
+
+
+ http://www.opengis.net/sensorml/2.0
+
+
+ D5_1
+
+
+
+
+ longName
+ D5_1
+
+
+
+
+ shortName
+ D5_1
+
+
+
+
+
+
+
+
+ Vögelsberg Tachymeter
+ D5_1
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+
+
+ featuresOfInterest
+
+
+ D5_1
+ origin of D5_1
+
+
+
+
+ 11.597409730065536 47.27196543449542
+
+
+
+
+
+
+
+
+
+
+
+ 11.597409730065536
+
+
+
+
+
+ 47.27196543449542
+
+
+
+
+
+ 909.1935
+
+
+
+
+
+
+ TachymeterLocation
+
+
+ http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_GeometryObservation
+ http://www.opengis.net/def/samplingFeatureType/OGC-OM/2.0/SF_SamplingPoint
+
+
+
+
+
\ No newline at end of file
diff --git a/voegelsberg/insert_sensors/import_mobile_sensors.py b/voegelsberg/insert_sensors/import_mobile_sensors.py
new file mode 100644
index 0000000..34435d5
--- /dev/null
+++ b/voegelsberg/insert_sensors/import_mobile_sensors.py
@@ -0,0 +1,139 @@
+# https://lists.ogc.org/pipermail/sensorml/2008-September/000573.html
+import csv
+import requests
+from pyproj import Transformer
+from insert_sensor.wrapper import (Offering, FoI, Procedure, SensorType)
+
+class Sensor:
+ """
+ A class to represent an input sensor.
+ ...
+
+ Attributes
+ ----------
+ name : str
+ first name of the person
+ x : float
+ token to access soso service
+ y : float
+ token to access soso service
+ """
+
+ def __init__(self, name: str, x_coord: float, y_coord: float):
+ self.name = name
+ self.x_coord = x_coord
+ self.y_coord = y_coord
+
+# delimiter: it refers to the character used to separate values (or fields) in the CSV file. It defaults to comma (,)
+
+# quotechar : it refers to the single character string that will be used to quote values
+# if special characters (like delimiter) appears inside the field. It defaults to ".
+
+def main():
+ ''' main method '''
+ with open('voegelsberg/insert_sensors/sensors_origin.csv','rt') as csvfile:
+ spamreader = csv.DictReader(csvfile, delimiter=';', quotechar='"')
+ for row in spamreader:
+ # print(row)
+ proj = Transformer.from_crs(31254, 4326, always_xy=True)
+
+ x1, y1, z1 = (float(row['Y']), float(row['X']), float(row['H']))
+ x2, y2 = proj.transform(x1, y1)
+ print((x2, y2)) # (11.597409730065536, 47.27196543449542)
+ sensor_name = row['Punktnummer']
+
+ # platform ampflwang_kb1_inclinometer
+ offering = Offering(
+ "https://geomon.geologie.ac.at/52n-sos-webapp/api/offerings/",
+ sensor_name,
+ "Vögelsberg Tachymeter"
+ )
+
+ procedure = Procedure (sensor_name, sensor_name)
+
+ foi_name = "origin of " + sensor_name
+ foi = FoI("degree", "m", (x2, y2, z1),
+ sensor_name, foi_name)
+ # now insert sensor via rest service:
+ sensor_type=SensorType("tachymeter")
+
+ sos_url = 'https://geomon.geologie.ac.at/52n-sos-webapp/service'
+ headers = {'Content-Type': 'application/soap+xml'} # set what your server accepts
+ xml = get_xml(offering, procedure, foi, sensor_type)
+ # print(xml)
+ # exit()
+ request = requests.post(sos_url, data = xml, headers=headers)
+ print(request.text)
+
+def get_xml(offering, procedure, foi, sensor_type):
+ """
+ Prepares the body of a InsertSensor request for JSON biding.
+ :param offering: an instance of class Offering.Type object.
+ :param Procedure: instance of class Procedure. type object.
+ :param foi: feature of interest. Instance of FoI
+ :param sensor_type: SensorType object
+ :return: valid body for an InsertSensor request.
+ """
+
+ # shortName = offering.name # string
+ # longName = 'Sibratsgfall test' # string
+
+ # Offering values
+ gml_id='\"' + str(procedure.id) + '\"' # Offering name, double quoted
+ off_name = '\"' + str(offering.name) + '\"' # Offering name, double quoted
+ offering_name = offering.name
+ offering_label = offering.label
+ # offID = offering.fullId # URL format of full id
+
+ # featureName = featureID = cordX = cordY = height = h_unit = z_unit = coordinates = ""
+ if foi is not None: # check if feature of interest should be declare
+ # feature_id = 'https://geomon.geologie.ac.at/52n-sos-webapp/api/features/' + \
+ # str(foi.fid) # URL format
+ cord_x = str(foi.x) # longitude degrees, float
+ cord_y = str(foi.y) # latitude degrees, float
+ coordinates = cord_x + " " + cord_y
+ height = str(foi.z) # altitude in meters, float
+ # h_unit = foi.Hunit # units for horizontal coordinates
+ # z_unit = foi.Vunit # units for altitude
+ feature_id = foi.fid # "feature location"
+ feature_name = foi.name # "feature location"
+ else:
+ pass
+
+ procedure_name = procedure.name
+ procedure_identifier = procedure.id # URL,
+ obs_types = []
+ output_list = '' # output list element for describe procedure
+ properties_list = []
+ for attr in sensor_type.pattern["attributes"]:
+ obs_prop_name = '\"' + attr[0] + '\"' # attribute name
+ # print(obs_prop_name)
+ unit_name = sensor_type.om_types[attr[1]] # om type
+ # magnitud = a # ??
+
+ obs_name = obs_prop_name.replace('\"', '')
+ obs_name = "".join(obs_name.split()) # observable property name
+ output = ''
+ output_list = output_list + output
+ # add property identifier to the list.
+ properties_list.append(obs_name)
+ # prepare list of measurement types
+ # A sensor can not registry duplicated sensor types.
+ this_type = "http://www.opengis.net/def/observationType/OGC-OM/2.0/"+unit_name
+ if this_type not in obs_types: # when new type appears
+ obs_types.append(this_type)
+ else:
+ continue
+
+ # Unit of measurement:
+ unit_name = '\"' + procedure.name + '\"' # double quoted string
+ # unit = omType # one of the MO measurement types
+ xml = f'http://www.opengis.net/sensorml/2.0{procedure_identifier}longName{procedure_name}shortName{procedure_name}{offering_label}{offering_name}truetruefeaturesOfInterest{feature_id}{feature_name}{coordinates}{cord_x}{cord_y}{height}TachymeterLocationhttp://www.opengis.net/def/observationType/OGC-OM/2.0/OM_GeometryObservationhttp://www.opengis.net/def/samplingFeatureType/OGC-OM/2.0/SF_SamplingPoint'
+ return xml
+
+if __name__ == '__main__':
+ main()
+
+
\ No newline at end of file
diff --git a/voegelsberg/insert_sensors/sensors_origin.csv b/voegelsberg/insert_sensors/sensors_origin.csv
new file mode 100644
index 0000000..c878d9c
--- /dev/null
+++ b/voegelsberg/insert_sensors/sensors_origin.csv
@@ -0,0 +1,31 @@
+Punktnummer;Y;X;H
+D5_1;95675.3391;237785.1414;909.1935
+D5_2;95696.6153;237774.4089;909.7036
+D5_3;95677.525;237758.1408;918.655
+D5_4;95660.9035;237763.5671;918.3268
+D5_5;95699.3158;237775.079;907.6681
+D5_6;95703.8642;237767.2277;907.8379
+D5a_1;95691.3392;237738.9666;918.6065
+D5a_2;95673.6734;237739.4492;917.8516
+D7_1;95685.4347;237703.6357;933.123
+D7a_1;95747.6147;237672.6819;930.5737
+D7a_2;95720.7093;237694.181;930.5045
+D7a_3;95699.4549;237683.1964;933.3164
+D8_1;95646.3503;237636.8525;961.7559
+D37_2;95536.4016;237692.8418;954.2123
+M268-119J1;95809.8082;237592.3322;948.9804
+D11_2;95603.1758;237480.9831;1034.6149
+D26_1;95547.6455;237522.9762;1019.6538
+D28_1;95513.2751;237547.057;1016.6386
+D15_1;95138.0629;237729.2769;1036.1869
+D18_1;95321.7767;237932.6057;948.8271
+KB3_17;95712.3558;237914.1799;856.1474
+D_WS_1;95431.2387;237830.7249;922.1413
+D12a_1;95615.5822;237379.1464;1060.2257
+D13_2;95453.7142;237263.1551;1142.5906
+D14_1;95309.8206;237431.2252;1116.0777
+D31_1;95425.8945;237478.7819;1079.4518
+GNSS1_M;95221.0164;238158.8625;885.3358
+GNSS2_M;96079.1201;237157.2512;995.3009
+GNSS3_M;95480.9654;237105.8024;1194.5292
+M81018-18J1;96040.3146;237233.7806;994.132
diff --git a/voegelsberg/main.py b/voegelsberg/main.py
new file mode 100644
index 0000000..e69de29
diff --git a/voegelsberg/notes_mobile_sensors.txt b/voegelsberg/notes_mobile_sensors.txt
new file mode 100644
index 0000000..aed415e
--- /dev/null
+++ b/voegelsberg/notes_mobile_sensors.txt
@@ -0,0 +1,4 @@
+http://istsos.org/en/v3.0.0-Beta/systemtypes.html
+http://istsos.org/en/v3.0.0-Beta/insertsensor.html
+
+https://sist.pages.in2p3.fr/anf21-sos52north/04_o-and-m/#mobile-in-situ-sensors