FOSS4G 2023 Seoul Half-day workshop > OGC API – MF, an introduction with MF-API Server based on pygeoapi and MobilityDB > How to implement OGC API – MF with pygeoapi and MobilityDB? Each section describes the commands and sample data used.
- HDD:At least 20GB free space
- memory >= 6GB
- Install Docker on local PC (https://www.docker.com/get-started)
- (optional) Database Viewer DBeaver (https://dbeaver.io/)
<5 mins> A brief explanation of pygeoapi (overall architecture, etc.) and install MF-API Server (using Docker)
Execute the following three commands in order at the command prompt
Step1
docker pull ghcr.io/taehoonk/mf-api-server:1.1
Step2
docker run -p 8085:8085 -p 25432:5432 -d --name mf-api-server ghcr.io/taehoonk/mf-api-server:1.1
Step3
docker exec mf-api-server ./run.sh
<10 mins> A brief explanation of MobilityDB and the functions (and structure) used to handle TemporalGeometry and properties.
Note
- There are no commands or data to use.
<20 mins> Describe how you extended pygeoapi to support OGC API – MF (libraries to use OpenAPI and MobilityDB (pyMEOS, python-mobilitydb, etc.) and extension structure, etc.)
Note
- There are no commands or data to use.
Request body(application/json)
{
"title": "moving_feature_collection_sample1",
"updateFrequency": 1000,
"description": "FOSS4G2023 Seoul Workshop"
}
collectionID
collectionID : The last part of location
link when POST response
Request body(application/json)
{
"title": "moving_feature_collection_sample2",
"updateFrequency": 1000,
"description": "FOSS4G2023 Seoul Workshop PUT test"
}
Note
Skip the DELETE request for the next demonstration
collectionID : ID of the response at the time of MovingFeatureCollection
Request body(application/json) :
{
"type": "Feature",
"crs": {
"type": "Name",
"properties": {
"name": "urn:ogc:def:crs:OGC:1.3:CRS84"
}
},
"trs": {
"type": "Link",
"properties": {
"type": "OGCDEF",
"href": "http://www.opengis.net/def/uom/ISO-8601/0/Gregorian"
}
},
"temporalGeometry": {
"type": "MovingPoint",
"datetimes": [
"2011-08-14T22:10:00Z",
"2011-08-14T22:20:00Z",
"2011-08-14T22:30:00Z",
"2011-08-14T22:40:00Z",
"2011-08-14T23:00:00Z"
],
"coordinates": [
[
139.757083,
35.627701,
0.5
],
[
139.757399,
35.627701,
2
],
[
139.757555,
35.627688,
4
],
[
139.757651,
35.627596,
4
],
[
139.757716,
35.627483,
4
]
],
"interpolation": "Linear",
"base": {
"type": "glTF",
"href": "http://www.opengis.net/spec/movingfeatures/json/1.0/prism/example/car3dmodel.gltf"
},
"orientations": [
{
"scales": [
1,
1,
1
],
"angles": [
0,
0,
0
]
},
{
"scales": [
1,
1,
1
],
"angles": [
0,
355,
0
]
},
{
"scales": [
1,
1,
1
],
"angles": [
0,
0,
330
]
},
{
"scales": [
1,
1,
1
],
"angles": [
0,
0,
300
]
},
{
"scales": [
1,
1,
1
],
"angles": [
0,
0,
270
]
}
]
},
"temporalProperties": [
{
"datetimes": [
"2011-08-14T22:10:00Z",
"2011-08-14T22:30:00Z",
"2011-08-14T23:00:00Z"
],
"length": {
"type": "Measure",
"form": "http://www.qudt.org/qudt/owl/1.0.0/quantity/Length",
"values": [
1,
2.4,
1
],
"interpolation": "Linear"
},
"discharge": {
"type": "Measure",
"form": "MQS",
"values": [
3,
4,
5
],
"interpolation": "Step"
}
},
{
"datetimes": [
1465621816590,
1465711526300
],
"camera": {
"type": "Image",
"values": [
"http://www.opengis.net/spec/movingfeatures/json/1.0/prism/example/image1",
"iVBORw0KGgoAAAANSUhEU......"
],
"interpolation": "Discrete"
},
"labels": {
"type": "Text",
"values": [
"car",
"human"
],
"interpolation": "Discrete"
}
}
],
"geometry": {
"type": "LineString",
"coordinates": [
[
139.757083,
35.627701,
0.5
],
[
139.757399,
35.627701,
2
],
[
139.757555,
35.627688,
4
],
[
139.757651,
35.627596,
4
],
[
139.757716,
35.627483,
4
]
]
},
"properties": {
"name": "car1",
"state": "test1",
"video": "http://www.opengis.net/spec/movingfeatures/json/1.0/prism/example/video.mpeg"
},
"bbox": [
139.757083,
35.627483,
0,
139.757716,
35.627701,
4.5
],
"time": [
"2011-08-14T22:00:00Z",
"2011-08-14T23:00:00Z"
]
}
collectionID : ID of the response at the time of MovingFeatureCollection
Request body(application/json) :
{
"type": "Feature",
"crs": {
"type": "Name",
"properties": {
"name": "urn:ogc:def:crs:OGC:1.3:CRS84"
}
},
"trs": {
"type": "Link",
"properties": {
"type": "OGCDEF",
"href": "http://www.opengis.net/def/uom/ISO-8601/0/Gregorian"
}
},
"temporalGeometry": {
"type": "MovingPoint",
"datetimes": [
"2012-07-14T22:00:00Z",
"2012-07-14T22:10:00Z",
"2012-07-14T22:20:00Z",
"2012-07-14T22:30:00Z",
"2012-07-14T22:40:00Z"
],
"coordinates": [
[
138.757083,
34.627701,
0.5
],
[
138.757399,
34.627701,
2
],
[
138.757555,
34.627688,
4
],
[
138.757651,
34.627596,
4
],
[
138.757716,
34.627483,
4
]
],
"interpolation": "Linear",
"base": {
"type": "glTF",
"href": "http://www.opengis.net/spec/movingfeatures/json/1.0/prism/example/car3dmodel.gltf"
},
"orientations": [
{
"scales": [
1,
1,
1
],
"angles": [
0,
0,
0
]
},
{
"scales": [
1,
1,
1
],
"angles": [
0,
355,
0
]
},
{
"scales": [
1,
1,
1
],
"angles": [
0,
0,
330
]
},
{
"scales": [
1,
1,
1
],
"angles": [
0,
0,
300
]
},
{
"scales": [
1,
1,
1
],
"angles": [
0,
0,
270
]
}
]
},
"temporalProperties": [
{
"datetimes": [
"2011-07-14T22:00:00Z",
"2011-07-14T22:30:00Z",
"2011-07-14T23:00:00Z"
],
"length": {
"type": "Measure",
"form": "http://www.qudt.org/qudt/owl/1.0.0/quantity/Length",
"values": [
1,
2.4,
1
],
"interpolation": "Linear"
},
"discharge": {
"type": "Measure",
"form": "MQS",
"values": [
3,
4,
5
],
"interpolation": "Step"
}
},
{
"datetimes": [
1465621816590,
1465711526300
],
"camera": {
"type": "Image",
"values": [
"http://www.opengis.net/spec/movingfeatures/json/1.0/prism/example/image1",
"iVBORw0KGgoAAAANSUhEU......"
],
"interpolation": "Discrete"
},
"labels": {
"type": "Text",
"values": [
"car",
"human"
],
"interpolation": "Discrete"
}
}
],
"geometry": {
"type": "LineString",
"coordinates": [
[
138.757083,
34.627701,
0.5
],
[
138.757399,
34.627701,
2
],
[
138.757555,
34.627688,
4
],
[
138.757651,
34.627596,
4
],
[
138.757716,
34.627483,
4
]
]
},
"properties": {
"name": "car1",
"state": "test1",
"video": "http://www.opengis.net/spec/movingfeatures/json/1.0/prism/example/video.mpeg"
},
"bbox": [
138.757083,
34.627483,
0,
138.757716,
34.627701,
4.5
],
"time": [
"2012-07-14T22:00:00Z",
"2012-07-14T23:00:00Z"
]
}
collectionID : ID of the response at the time of MovingFeatureCollection
bbox : Empty
datetime : 2011-08-14T22:20:00Z
limit : 10
subTrajectory : --
collectionID : ID of the response at the time of MovingFeatureCollection
bbox : 138.757083
34.627483
138.757716
34.627701
datetime : 2010-01-01T00:00:00Z/..
limit : 10
subTrajectory : --
collectionID : ID of the response at the time of MovingFeatureCollection
bbox : Empty
datetime : 2011-08-14T22:15:00Z/2011-08-14T22:55:00Z
limit : 10
subTrajectory : true
collectionId : ID of the response at the time of MovingFeatureCollection
mFeatureId : ID of the response at the time of MovingFeature
Note
Skip the DELETE request for the next demonstration
collectionId : ID of the response at the time of MovingFeatureCollection
mFeatureId : ID of the response at the time of MovingFeatures
Request body(application/json) : Default Value
collectionId : ID of the response at the time of MovingFeatureCollection
mFeatureId : ID of the response at the time of MovingFeatures
leaf : 2011-08-14T22:30:00Z
bbox : Empty
datetime : 2010-01-01T00:00:00Z/..
limit : 10
collectionId : ID of the response at the time of MovingFeatureCollection
mFeatureId : ID of the response at the time of MovingFeatures
leaf : Empty
bbox : Empty
datetime : 2011-08-14T22:15:00Z/2011-08-14T22:55:00Z
limit : 10
subTrajectory : true
collectionId : ID of the response at the time of MovingFeatureCollection
mFeatureId : ID of the response at the time of MovingFeatures
tGeometryId : ID of the response at the time of TemporalGeometry
collectionId : ID of the response at the time of MovingFeatureCollection
mFeatureId : ID of the response at the time of MovingFeatures
Request body(application/json) :
{
"temporalProperties": [
{
"datetimes": [
"2015-07-14T22:01:01.450Z",
"2015-07-14T23:01:01.450Z",
"2015-07-15T00:01:01.450Z"
],
"length": {
"type": "Measure",
"form": "http://www.qudt.org/qudt/owl/1.0.0/quantity/Length",
"values": [
1,
2.4,
1
],
"interpolation": "Linear"
},
"discharge": {
"type": "Measure",
"form": "MQS",
"values": [
3,
4,
5
],
"interpolation": "Step"
}
},
{
"datetimes": [
1466380800000,
1466383800000
],
"camera": {
"type": "Image",
"values": [
"http://www.opengis.net/spec/movingfeatures/json/1.0/prism/example/image1",
"iVBORw0KGgoAAAANSUhEU......"
],
"interpolation": "Discrete"
},
"labels": {
"type": "Text",
"values": [
"car",
"human"
],
"interpolation": "Discrete"
}
}
]
}
collectionId : ID of the response at the time of MovingFeatureCollection
mFeatureId : ID of the response at the time of MovingFeatures
leaf : Empty
datetime : 2011-08-14T22:15:00Z/2011-08-14T22:55:00Z
limit : 10
subTemporalValue : true
collectionId : ID of the response at the time of MovingFeatureCollection
mFeatureId : ID of the response at the time of MovingFeatures
tPropertyName : length
leaf : Empty
datetime : 2010-01-01T00:00:00Z/..
subTemporalValue : true
collectionId : ID of the response at the time of MovingFeatureCollection
mFeatureId : ID of the response at the time of MovingFeatures
tPropertyName : length
Request body(application/json) :
{
"datetimes": [
"2011-12-15T08:00:00Z",
"2011-12-15T08:10:00Z",
"2011-12-15T08:20:00Z"
],
"values": [
0,
20,
50
],
"interpolation": "Linear"
}
[DELETE] TemporalProperty(/collections/{collectionId}/items/{mFeatureId}/tproperties/{tPropertyName})
collectionId : ID of the response at the time of MovingFeatureCollection
mFeatureId : ID of the response at the time of MovingFeatures
tPropertyName : length
MF-API Server based on pygeoapi https://github.com/aistairc/mf-api
OGC API – MovingFeatures official GitHub repository https://github.com/opengeospatial/ogcapi-movingfeatures
MobilityDB (and its Python driver, PyMEOS, and MEOS) https://github.com/MobilityDB
STINUUM(The installation of each program will use a Docker file.) https://github.com/aistairc/mf-cesium
OGC API – MF helpful information https://ogcapi.ogc.org/movingfeatures/