Python problem using GDAL Unicorn Meta Zoo #1: Why another podcast? ...

As an international instructor, should I openly talk about my accent?

What’s with the clanks in Endgame?

"My boss was furious with me and I have been fired" vs. "My boss was furious with me and I was fired"

How can I wire a 9-position switch so that each position turns on one more LED than the one before?

Is a 5 watt UHF/VHF handheld considered QRP?

Implementing 3DES algorithm in Java: is my code secure?

Does Feeblemind produce an ongoing magical effect that can be dispelled?

How to get even lighting when using flash for group photos near wall?

Check if a string is entirely made of the same substring

What ability score does a Hexblade's Pact Weapon use for attack and damage when wielded by another character?

Align column where each cell has two decimals with siunitx

Expansion//Explosion and Siren Stormtamer

How would this chord from "Rocket Man" be analyzed?

std::is_constructible on incomplete types

Can you stand up from being prone using Skirmisher outside of your turn?

Multiple options vs single option UI

The art of proof summarizing. Are there known rules, or is it a purely common sense matter?

Multiple fireplaces in an apartment building?

How to avoid introduction cliches

What's the difference between using dependency injection with a container and using a service locator?

Why didn't the Space Shuttle bounce back into space as many times as possible so as to lose a lot of kinetic energy up there?

What is the best way to deal with NPC-NPC combat?

Where did Arya get these scars?

What is the least dense liquid under normal conditions?



Python problem using GDAL



Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar ManaraGDAL Python bindings not picking up OGR PostgreSQL driverUsing osgeo modules in ArcGIS10.1 and QGIS 1.8 python shellsogr.GetDriverByName('FileGDB') returns NoneWhy does OGR driver.Open() for File Geodatabase give AttributeError: NoneType object has no attribute Open?Install gdal executablesHow do I install the GDAL bindings for C#/.NET 4.5.1?Can't get the correct version of GDAL installed to use ReadAsArray without getting error in PythonDid GDAL install correctly in Winpython?Error of installing GDAL on python with windowsLooking for a specific release GDAL: 1.11.1 - Compiler: MSVC 2008 - Arch: x64





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















I used the instructions at https://pythongisandstuff.wordpress.com/2011/07/07/installing-gdal-and-ogr-for-python-on-windows/



I downloaded the following files:




  • GDAL-1.11.1.win-amd64-py2.7.msi

  • gdal-111-1800-x64-core.msi


Then I followed the above instructions. When I type



from osgeo import gdal



at the Python IDLE command line, everything appears to be OK. Then I type in



ds = gdal.Open( 'C:/testfile.DT1')



and again, it appears to be OK. However, when I type in



gt = ds.GetGeoTransform()



I get the following error message:



Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
gt = ds.GetGeoTransform()
AttributeError: 'NoneType' object has no attribute 'GetGeoTransform'


I have checked the DTED file and there is nothing wrong with it. I also tried the above with a tif and got the same result. I can get the GDAL executables to run, but not the GDAL Python scripts. Is there something that I should check regarding my install of GDAL?










share|improve this question
















bumped to the homepage by Community 2 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 6





    If gdal can't open your file for some reason it just returns None instead of raising an exception. To see the error, call gdal.UseExceptions() before attempting to open the file

    – user2856
    Jul 17 '15 at 23:08






  • 3





    the gdal.Open method returns None if no dataset is found, for some reason the dataset is invalid or GDAL can't open it. Try GDALinfo on the dataset to see if it's valid or incomplete/corrupt. As @Luke said, set the UseExceptions to find out what the error is. Is your python 64 bit as well? You can't mix 64/32 bit. Do you have more than one python install? Is your GDAL environment set up properly? (trac.osgeo.org/gdal/wiki/ConfigOptions) is DTED a core driver or do you need to get that separately?

    – Michael Stimson
    Jul 18 '15 at 0:12




















0















I used the instructions at https://pythongisandstuff.wordpress.com/2011/07/07/installing-gdal-and-ogr-for-python-on-windows/



I downloaded the following files:




  • GDAL-1.11.1.win-amd64-py2.7.msi

  • gdal-111-1800-x64-core.msi


Then I followed the above instructions. When I type



from osgeo import gdal



at the Python IDLE command line, everything appears to be OK. Then I type in



ds = gdal.Open( 'C:/testfile.DT1')



and again, it appears to be OK. However, when I type in



gt = ds.GetGeoTransform()



I get the following error message:



Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
gt = ds.GetGeoTransform()
AttributeError: 'NoneType' object has no attribute 'GetGeoTransform'


I have checked the DTED file and there is nothing wrong with it. I also tried the above with a tif and got the same result. I can get the GDAL executables to run, but not the GDAL Python scripts. Is there something that I should check regarding my install of GDAL?










share|improve this question
















bumped to the homepage by Community 2 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 6





    If gdal can't open your file for some reason it just returns None instead of raising an exception. To see the error, call gdal.UseExceptions() before attempting to open the file

    – user2856
    Jul 17 '15 at 23:08






  • 3





    the gdal.Open method returns None if no dataset is found, for some reason the dataset is invalid or GDAL can't open it. Try GDALinfo on the dataset to see if it's valid or incomplete/corrupt. As @Luke said, set the UseExceptions to find out what the error is. Is your python 64 bit as well? You can't mix 64/32 bit. Do you have more than one python install? Is your GDAL environment set up properly? (trac.osgeo.org/gdal/wiki/ConfigOptions) is DTED a core driver or do you need to get that separately?

    – Michael Stimson
    Jul 18 '15 at 0:12
















0












0








0


1






I used the instructions at https://pythongisandstuff.wordpress.com/2011/07/07/installing-gdal-and-ogr-for-python-on-windows/



I downloaded the following files:




  • GDAL-1.11.1.win-amd64-py2.7.msi

  • gdal-111-1800-x64-core.msi


Then I followed the above instructions. When I type



from osgeo import gdal



at the Python IDLE command line, everything appears to be OK. Then I type in



ds = gdal.Open( 'C:/testfile.DT1')



and again, it appears to be OK. However, when I type in



gt = ds.GetGeoTransform()



I get the following error message:



Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
gt = ds.GetGeoTransform()
AttributeError: 'NoneType' object has no attribute 'GetGeoTransform'


I have checked the DTED file and there is nothing wrong with it. I also tried the above with a tif and got the same result. I can get the GDAL executables to run, but not the GDAL Python scripts. Is there something that I should check regarding my install of GDAL?










share|improve this question
















I used the instructions at https://pythongisandstuff.wordpress.com/2011/07/07/installing-gdal-and-ogr-for-python-on-windows/



I downloaded the following files:




  • GDAL-1.11.1.win-amd64-py2.7.msi

  • gdal-111-1800-x64-core.msi


Then I followed the above instructions. When I type



from osgeo import gdal



at the Python IDLE command line, everything appears to be OK. Then I type in



ds = gdal.Open( 'C:/testfile.DT1')



and again, it appears to be OK. However, when I type in



gt = ds.GetGeoTransform()



I get the following error message:



Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
gt = ds.GetGeoTransform()
AttributeError: 'NoneType' object has no attribute 'GetGeoTransform'


I have checked the DTED file and there is nothing wrong with it. I also tried the above with a tif and got the same result. I can get the GDAL executables to run, but not the GDAL Python scripts. Is there something that I should check regarding my install of GDAL?







gdal python-2.7






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jul 17 '15 at 19:11









Chris W

14.8k22344




14.8k22344










asked Jul 17 '15 at 18:52









Renee CammarereRenee Cammarere

635618




635618





bumped to the homepage by Community 2 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 2 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.










  • 6





    If gdal can't open your file for some reason it just returns None instead of raising an exception. To see the error, call gdal.UseExceptions() before attempting to open the file

    – user2856
    Jul 17 '15 at 23:08






  • 3





    the gdal.Open method returns None if no dataset is found, for some reason the dataset is invalid or GDAL can't open it. Try GDALinfo on the dataset to see if it's valid or incomplete/corrupt. As @Luke said, set the UseExceptions to find out what the error is. Is your python 64 bit as well? You can't mix 64/32 bit. Do you have more than one python install? Is your GDAL environment set up properly? (trac.osgeo.org/gdal/wiki/ConfigOptions) is DTED a core driver or do you need to get that separately?

    – Michael Stimson
    Jul 18 '15 at 0:12
















  • 6





    If gdal can't open your file for some reason it just returns None instead of raising an exception. To see the error, call gdal.UseExceptions() before attempting to open the file

    – user2856
    Jul 17 '15 at 23:08






  • 3





    the gdal.Open method returns None if no dataset is found, for some reason the dataset is invalid or GDAL can't open it. Try GDALinfo on the dataset to see if it's valid or incomplete/corrupt. As @Luke said, set the UseExceptions to find out what the error is. Is your python 64 bit as well? You can't mix 64/32 bit. Do you have more than one python install? Is your GDAL environment set up properly? (trac.osgeo.org/gdal/wiki/ConfigOptions) is DTED a core driver or do you need to get that separately?

    – Michael Stimson
    Jul 18 '15 at 0:12










6




6





If gdal can't open your file for some reason it just returns None instead of raising an exception. To see the error, call gdal.UseExceptions() before attempting to open the file

– user2856
Jul 17 '15 at 23:08





If gdal can't open your file for some reason it just returns None instead of raising an exception. To see the error, call gdal.UseExceptions() before attempting to open the file

– user2856
Jul 17 '15 at 23:08




3




3





the gdal.Open method returns None if no dataset is found, for some reason the dataset is invalid or GDAL can't open it. Try GDALinfo on the dataset to see if it's valid or incomplete/corrupt. As @Luke said, set the UseExceptions to find out what the error is. Is your python 64 bit as well? You can't mix 64/32 bit. Do you have more than one python install? Is your GDAL environment set up properly? (trac.osgeo.org/gdal/wiki/ConfigOptions) is DTED a core driver or do you need to get that separately?

– Michael Stimson
Jul 18 '15 at 0:12







the gdal.Open method returns None if no dataset is found, for some reason the dataset is invalid or GDAL can't open it. Try GDALinfo on the dataset to see if it's valid or incomplete/corrupt. As @Luke said, set the UseExceptions to find out what the error is. Is your python 64 bit as well? You can't mix 64/32 bit. Do you have more than one python install? Is your GDAL environment set up properly? (trac.osgeo.org/gdal/wiki/ConfigOptions) is DTED a core driver or do you need to get that separately?

– Michael Stimson
Jul 18 '15 at 0:12












1 Answer
1






active

oldest

votes


















0














Maybe try to open like this:



from osgeo import gdal
driver = gdal.GetDriverByName( ’DTED’)
driver.Register()
file = gdal.Open( ’path/to/file’)


You may have to register your driver, in this case DTED.






share|improve this answer


























  • Thanks for this answer. However, I got the same resulting error.

    – Renee Cammarere
    Jul 17 '15 at 19:33











  • So maybe your path to file is wrong. Try: C:\testfile.dt1. A backslash instead of a slash.

    – dmh126
    Jul 17 '15 at 19:37








  • 3





    All drivers in the library are registered with from osgeo import gdal No need to register anything, unless you've deregistered.

    – user10353
    Jul 17 '15 at 21:32














Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "79"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f154870%2fpython-problem-using-gdal%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Maybe try to open like this:



from osgeo import gdal
driver = gdal.GetDriverByName( ’DTED’)
driver.Register()
file = gdal.Open( ’path/to/file’)


You may have to register your driver, in this case DTED.






share|improve this answer


























  • Thanks for this answer. However, I got the same resulting error.

    – Renee Cammarere
    Jul 17 '15 at 19:33











  • So maybe your path to file is wrong. Try: C:\testfile.dt1. A backslash instead of a slash.

    – dmh126
    Jul 17 '15 at 19:37








  • 3





    All drivers in the library are registered with from osgeo import gdal No need to register anything, unless you've deregistered.

    – user10353
    Jul 17 '15 at 21:32


















0














Maybe try to open like this:



from osgeo import gdal
driver = gdal.GetDriverByName( ’DTED’)
driver.Register()
file = gdal.Open( ’path/to/file’)


You may have to register your driver, in this case DTED.






share|improve this answer


























  • Thanks for this answer. However, I got the same resulting error.

    – Renee Cammarere
    Jul 17 '15 at 19:33











  • So maybe your path to file is wrong. Try: C:\testfile.dt1. A backslash instead of a slash.

    – dmh126
    Jul 17 '15 at 19:37








  • 3





    All drivers in the library are registered with from osgeo import gdal No need to register anything, unless you've deregistered.

    – user10353
    Jul 17 '15 at 21:32
















0












0








0







Maybe try to open like this:



from osgeo import gdal
driver = gdal.GetDriverByName( ’DTED’)
driver.Register()
file = gdal.Open( ’path/to/file’)


You may have to register your driver, in this case DTED.






share|improve this answer















Maybe try to open like this:



from osgeo import gdal
driver = gdal.GetDriverByName( ’DTED’)
driver.Register()
file = gdal.Open( ’path/to/file’)


You may have to register your driver, in this case DTED.







share|improve this answer














share|improve this answer



share|improve this answer








edited Jul 18 '15 at 5:00









Michael Stimson

21.8k22460




21.8k22460










answered Jul 17 '15 at 19:00









dmh126dmh126

4,90421431




4,90421431













  • Thanks for this answer. However, I got the same resulting error.

    – Renee Cammarere
    Jul 17 '15 at 19:33











  • So maybe your path to file is wrong. Try: C:\testfile.dt1. A backslash instead of a slash.

    – dmh126
    Jul 17 '15 at 19:37








  • 3





    All drivers in the library are registered with from osgeo import gdal No need to register anything, unless you've deregistered.

    – user10353
    Jul 17 '15 at 21:32





















  • Thanks for this answer. However, I got the same resulting error.

    – Renee Cammarere
    Jul 17 '15 at 19:33











  • So maybe your path to file is wrong. Try: C:\testfile.dt1. A backslash instead of a slash.

    – dmh126
    Jul 17 '15 at 19:37








  • 3





    All drivers in the library are registered with from osgeo import gdal No need to register anything, unless you've deregistered.

    – user10353
    Jul 17 '15 at 21:32



















Thanks for this answer. However, I got the same resulting error.

– Renee Cammarere
Jul 17 '15 at 19:33





Thanks for this answer. However, I got the same resulting error.

– Renee Cammarere
Jul 17 '15 at 19:33













So maybe your path to file is wrong. Try: C:\testfile.dt1. A backslash instead of a slash.

– dmh126
Jul 17 '15 at 19:37







So maybe your path to file is wrong. Try: C:\testfile.dt1. A backslash instead of a slash.

– dmh126
Jul 17 '15 at 19:37






3




3





All drivers in the library are registered with from osgeo import gdal No need to register anything, unless you've deregistered.

– user10353
Jul 17 '15 at 21:32







All drivers in the library are registered with from osgeo import gdal No need to register anything, unless you've deregistered.

– user10353
Jul 17 '15 at 21:32




















draft saved

draft discarded




















































Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f154870%2fpython-problem-using-gdal%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Щит и меч (фильм) Содержание Названия серий | Сюжет |...

is 'sed' thread safeWhat should someone know about using Python scripts in the shell?Nexenta bash script uses...

Meter-Bus Содержание Параметры шины | Стандартизация |...