Connecting to Webodm database


#1

Is there a way that I could connect to webodm database using gdal-python api. Something similar to the example in the link. https://pcjericks.github.io/py-gdalogr-cookbook/vector_layers.html#get-all-postgis-layers-in-a-postgresql-database
Currently I’m running webodm latest version in development environment in Windows 10 with docker.
I did try to connect but was unsuccessful. The result I got was none. As far as I understand the db is inside docker container but it should be accessible via localhost with port 5432 right.?

image

image

image


#2

The database is not exposed outside of the docker environment by default, but you can make it so by modifying https://github.com/OpenDroneMap/WebODM/blob/master/docker-compose.yml#L12 with:

- "5432:5432"

And restarting WebODM.


#3

I did try as you mention but got error as below. Even I tried with different port number but the error I got was same in all the cases.
image

One thing that I noticed with default settings is that the db container is already mapped to 5432 port of server
so do I need to do “5432:5432” in https://github.com/OpenDroneMap/WebODM/blob/master/docker-compose.yml#L12
image


#4

Finally I was able to connect to webodm database.:sweat_smile: The problem was the 5432 port was already allocated to a user that I created when installing PostgresSql in my local machine. First number is for <host_port>:and Second is for <container_port> so I was doing the opposite. Kept on changing the container port number and wondered why it wasn’t working :rofl: Anyways thank you for helping :innocent:

One more thing is that at present I am installing GDAL-Python bindings inside the docker container by building it from source. But is there a way that I can add this to the build process so that it also gets installed when the container is created.