Sunday, 30 October 2011

3D vector GIS with complex models

One of the last experiments we did regards the possibility to use a 3D graphic suite (Blender) to build 3D complex models, connect them to a database (PostgreSQL/Postgis) and visualize them inside a GIS (GRASS).
The image below is an example of the workflow:

  1. 3D documentation of an archaeological record (in this case a grave)
  2. 3D modeling of all the elements (artifacts and ecofacts) of the archaeological record (in this experiment just the skeleton)
  3. visualization inside the GIS of the 3D components of the archaeological record, connected with a DB



Actually we are following two different ways:
  1. build the model inside Blender, import the model in PostgreSQL/Postgis, connect GRASS and Postgres, visualize and interrogate the model in NVIZ
  2. build the model inside Blender, simply export it in a dxf file (without DB), import the DXF in GRASS, connect the 3D DXF to a DB in GRASS and visualize it
OPTION 1

We are testing some script done by Andrea Scianna (Dirap, University of Palermo; please not: broken link) which are able to connect Blender with PostgreSQL and store geometrical and topological informations of the 3D models inside Postgis. There is no license in the script, so i guess they are released in the Public Domain (also because they come from a project called "Management and use of distributed 3D data by open source Web-GIS software"). I found the script here (please note: broken link) and i did some test with Giuseppe Naponiello. We started with "script 3" (the simplest) which "allows to connect to a database and write informations using triangular face model". I had to modify a little bit the script to update something (change the connection to psycopg1 in psycopg2 and so on...) and customize it for my db . At the end the script looks like this one (please note: broken link); and it works for my operating system (ArcheOS 4). If you want to use it just remember to customize the script with the data of your db (line 8) and build the db following the schema you can find in this publication. We started the test with a simple model of a skull (as you see in the picture below; please note: broken link) and the script worked perfectly, storing all the data inside PostgreSQL/Postgis.


Then we started GRASS, we set the connection with the database (Postgres) and this is what we get:


Inside NVIZ we were able to visualize our data (connected with the info inside the db) just as 3D points. Our hypothesis is that the script stores the geometrical/topological informations of the 3D models in a way that works for Blender, but is not recognized by GRASS. In other words we think that the script assign the same (numerical?) code to each point of the same triangular face (of course a single point can have more than one of these codes), so that Blender can read the data in Postgis and redraw the 3D model, but this is not valid for GRASS. Anyway this is just our idea and can be wrong. Maybe someone can help us to understand better the script (we are not good enough with Python). Actually we are stuck at this point of the test...

OPTION 2

We simply exported a dxf from Blender and import it in GRASS. Our intention is to connect it with the db in a second time with an external key. We did not yet tried it, because we are still favoring the first option, which looks like more direct and promising, so we plan to spend a little bit more time playing with the python scripts written by Andrea Scianna. In the picture below is shown the result we get using directly a dxf file. The problem by now is that in this way we are not able to preserve a direct connection with a db.


CONCLUSION

If someone wants to help us in this kind of experiment we will be very happy. Do not hesitate to contact us, any kind of clue or information is welcome!

LAST UPDATED  2016-01-29

We are currently studying different solutions for this topic. Nevertheless the subject is still interesting for researchers of other academic fields (e.g. geography). Unfortunately the links to the scripts, which were hosted in the University of Palermo server, are broken. Since the author (+Andrea Scianna) released them in Public Domain (as there was no specific license and, as far as I know, the main topic of the PRIN was "Management and use of distributed 3D data by open source Web-GIS software”), I restored the archive in our server. Currently the scripts can be downloaded here. I strongly suggest to read related documentation (by Andrea Scianna) if you want to use them.
BlogItalia - La directory italiana dei blog Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.