Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I currently have a DEM raster stored in an ESRI geodatabase. I've been asked to create a purely python (e.g., no arcpy functions) program that works with the values. Therefore, I need to convert the raster into something that can be read by python as an array. What file format would that be?

(Alternatively, is this a terrible idea and should I argue for sticking with arcpy functions?)

share|improve this question
Hi, are you allowed to use third party libraries like GDAL or PIL? – R.K. May 1 '13 at 16:11
If they're open-source and can be easily included with the final python script, then yes :) – Erica May 1 '13 at 16:14
Okay, what are you supposed to do with the file once you've loaded it btw? – R.K. May 1 '13 at 16:15
Doing some distance and elevation calculations to build sight lines -- the math isn't particularly hard, as long as I can find out (1) where I am in the array and (2) what the value is there. – Erica May 1 '13 at 16:22
up vote 4 down vote accepted

I'd recommend using the GDAL Pytho API as a substitute for ArcPy, which will give you an extensive range of functions. If you are using GDAL then you have quite an extensive list of possible formats but GeoTiff is always a popular choice but there are plenty of other options (check the GDAL documentation).

Alternatively, if you don't want to use GDAL, then you will still need some serious array-crunching modules, so NumPy and SciPy spring to mind (in fact you will probably want these tools even with GDAL). If you are going down this route you will find it easiest to save your DEM as an image (so again GeoTiff is still a good choice).

share|improve this answer

I agree with MappaGnosis. GeoTiff is a safe choice as GDAL and most other Python image processing library work with it. Aside from GDAL, you can also use PyRaster. It's a collection of Python tools for processing raster data as NumPy arrays. The project site has examples which should get your started. Good luck!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.