VCityTeam / UD-SV

7 stars 3 forks source link

Realize timestamp based versioned CityGML files and populate database #23

Closed EricBoix closed 4 years ago

EricBoix commented 7 years ago

EBO as lead

General description

This issue can be divided in two parts:

What must be done:

Implementation notes:

Input data

We shall consider Lyon first burrough as the territory as given through three snapshots: 2009, 2012 and 2015. The respective datasets can be obtained with

wget https://download.data.grandlyon.com/files/grandlyon/localisation/bati3d/LYON_1ER_2009.zip
wget https://download.data.grandlyon.com/files/grandlyon/localisation/bati3d/LYON_1ER_2012.zip
wget https://download.data.grandlyon.com/files/grandlyon/localisation/bati3d/LYON_1ER_2015.zip
unzip LYON_1ER_2009.zip
unzip LYON_1ER_2012.zip
unzip LYON_1ER_2015.zip

Constraints and design notes (theoretical level)

From time stamps to duration (encoding time uncertainties?)

Assume that we extracted, with the help of the above described geometric comparisons, the following table

BuildingId 2009 2012 2015
Build_1 X
Build_2 X X
Build_3 X X
Build_4 X X X
Build_5 X

For each building, we now need to convert such a vintage based table into duration encoded at the CityObject level (i.e. CityGML fields creationDate, terminationDate).

Initial design

The purpose for establishing the following set of rules (use case) is for example for having an illustrative visual when browsing the data with the slider.

We apply the following rule for setting the respective dates of the buildings:

  1. When a building is present in the first year of the considered set of years (e.g. 2009) then its Year_Of_Construction shall be -infinity (e.g. Build_1, Build_2 and Build_4).
  2. When a building appears (i.e. it as was not present at the previous timestamps and this appearance is not the first year of the considered set of dates for which the above rules applies) at year YYYY then the buildingYear_Of_Construction shall be 01/01/YYYY (e.g. Build_3 will have a Year_Of_Construction of 01/01/2012.
  3. When a building is present in the last year of the considered set of years (e.g. 2015) then its Year_Of_Demolition shall be +infinity (e.g. Build_3 and Build_4).
  4. When a building does not appear anymore (i.e. it was previously present) at year yyyy and this year is not the date of the set of considered set of years (for which rule 3 appears) then the buildingYear_Of_Demolition shall be 01/01/yyyy.

Motivation for introducing a distinction between the first year of the considered set of years (rule 1) from the following years (rule 2):

If we know apply the above rules to the initial timestamps table we obtain the following table:

BuildingId Year_Of_Construction Year_Of_Demolition
Build_1 -infinity 01/01/2012
Build_2 -infinity 01/01/2015
Build_3 01/01/2012 31/12/2015
Build_4 -infinity 31/12/2015
Build_5 -infinity +infinity

Building Build_5 illustratres a paradoxical (and undersirable?) side effect of rule 1 together with 4 since Build_5 appears within a time interval of [ -infinity, +infinity] (it existed at some point) when we know that it existed in 2012 (and this information is lost).

Furthermore we make the assumption that the same building (a building with the same ID) exists in continuity of time i.e. in the considered example, we can not have

| BuildingId   | 2009 | 2012 | 2015 |
| ----------- |:-----:|:-----:|:-----:|
| Build_6       |    X    |          |     X   |

Second design: Year+ and Year-

Implementation notes

When working on UDV-Server::extract_city_data.py we came out with the following implementation good practice when working with dates (refer to StackOverflow's "how to represent end of time in adatabase and sql and date ranges : dont use null):

jailln commented 6 years ago

The second part of this issue can be done using / modifying ChangeDetection filter of 3DUSE .

The documentation of this filter is currently located in VCity repository:

EricBoix commented 6 years ago

Worked started on local (to desktop) master branch of 3DUSE...

EricBoix commented 4 years ago

For the time being we base the versioned work on 3DCityDB usage (as opposed to files). We won't do the "Create versionned CityGML files" item

EricBoix commented 4 years ago

Sorted as won't do in weekly minutes.