Skip to main content
Question

Using GDAL in PythonCreator

  • August 21, 2018
  • 4 replies
  • 293 views

gpt_geoinfo
Contributor
Forum|alt.badge.img+2

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
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

david_r
Celebrity
  • 8391 replies
  • August 21, 2018

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.


harmen_kampinga
Forum|alt.badge.img+2

@gpt_executer : did you get it working?


gpt_geoinfo
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • 45 replies
  • February 4, 2019

@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!


david_r
Celebrity
  • 8391 replies
  • February 4, 2019

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