Skip to main content

Hi all,

I try to access the GDAL library via python to use a format (namely esri personal geodatabase) which my FME installation / licencing doesn't support.

 

GDAL 2.4.0 and Python for GDAL are installed (everything under 32bit as my Microsoft Access driver is a 32bit installation, according to the manual https://sandbox.idre.ucla.edu/sandbox/tutorials/installing-gdal-for-windows). In my Command Prompt everything works, except the connection to a *.mdb. The error says:
ERROR 1: Unable to initialize ODBC connection to DSN for DRIVER=Microsoft Access Driver (*.mdb);DBQ=PGeo:electricite.mdb

If you have any advice on this, I'm grateful. Of course I'm checking my drivers, but couldn't find any inconsistencies yet.

Well, my main problem is to access the GDAL library within FME PythonCreator. How do I import it? I tried

from osgeo import gdal

but this doesn't work. Do I miss something?

Cheers,

 

Maria

I've only done this once a long time ago, so I hope my memory isn't too rusty...

You basically have to download and install a stand-alone Python interpreter from python.org (or, even better, if you can find a distribution that includes gdal out of the box) and point FME to it. If gdal isn't already included, you install it as per the instructions. It should then work in FME as well.

I do seem to remember, however, that getting the gdal Python bindings to work properly on Windows was a royal pain, but hopefully it's gotten better by now.

Regarding your dsn error, you may have better luck asking in gdal specific forums, I suspect.


@gpt_executer : did you get it working?


@gpt_executer : did you get it working?

No, unfortunatly not. As it wasn't too important I stopped working on that.

But still: any tips appreciated!


No, unfortunatly not. As it wasn't too important I stopped working on that.

But still: any tips appreciated!

Just wanted to add that the fmeobjects Python API now has full raster support, which makes it possible to manipulate e.g. pixel values directly in FME python scripts. It may not replace all the functionality of gdal, but it does make a lot of stuff possible.

Have a look at the excellent examples @takashi posted some time ago:

https://knowledge.safe.com/questions/38000/python-fme-objects-api-for-raster-manipulation.html


Reply