[gdal-dev] python filegdb problems

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[gdal-dev] python filegdb problems

Netherton, Kevin J FLNR:EX
Hello
 
I’m trying to get the python bindings to the ogr library working with esri file geodatabase (filegdb) support.  I am using the latest version of ms4w package that includes gdal/ogr 1.9.
 
I have created a esri file geodatabase driver, then from that created a data source, but am unable to access layers from the data source object.  Below is a quick summary of my code:
 
    drvrObj = osgeo.ogr.GetDriverByName(r'FileGDB') # print the driver retunrs a SWIG object
    path = str(r'C:\testdatadir\arc10geodb.gdb')
    mydataSrc = drvrObj.Open(path) # printing the data source prints a SWIG object
    lyrCnt = mydataSrc.GetLayerCount() # always returns 0 but there are many layers in the fgdb
    lyr = mydataSrc.GetLayer(0) # always returns null
 
The comments in the code above kind of summarize the situation.  It appears that I can create a valid datasource but am unable to read the layers inside the datasource.  Any ideas?
 
 
 

_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: python filegdb problems

Ari Jolma-2
Kevin,

Could you post the test database somewhere?

Ari

On 03/20/2012 08:57 PM, Netherton, Kevin J FLNR:EX wrote:
Hello
 
I’m trying to get the python bindings to the ogr library working with esri file geodatabase (filegdb) support.  I am using the latest version of ms4w package that includes gdal/ogr 1.9.
 
I have created a esri file geodatabase driver, then from that created a data source, but am unable to access layers from the data source object.  Below is a quick summary of my code:
 
    drvrObj = osgeo.ogr.GetDriverByName(r'FileGDB') # print the driver retunrs a SWIG object
    path = str(r'C:\testdatadir\arc10geodb.gdb')
    mydataSrc = drvrObj.Open(path) # printing the data source prints a SWIG object
    lyrCnt = mydataSrc.GetLayerCount() # always returns 0 but there are many layers in the fgdb
    lyr = mydataSrc.GetLayer(0) # always returns null
 
The comments in the code above kind of summarize the situation.  It appears that I can create a valid datasource but am unable to read the layers inside the datasource.  Any ideas?
 
 
 


_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev


_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: python filegdb problems

Stefano Iacovella
In reply to this post by Netherton, Kevin J FLNR:EX
Did you run ogrinfo arc10geodb.gdb on a shell?

Does it show the layers inside the fileGDB or it throws some error?

Stefano


2012/3/20 Netherton, Kevin J FLNR:EX <[hidden email]>:

> Hello
>
> I’m trying to get the python bindings to the ogr library working with esri
> file geodatabase (filegdb) support.  I am using the latest version of ms4w
> package that includes gdal/ogr 1.9.
>
> I have created a esri file geodatabase driver, then from that created a data
> source, but am unable to access layers from the data source object.  Below
> is a quick summary of my code:
>
>     drvrObj = osgeo.ogr.GetDriverByName(r'FileGDB') # print the driver
> retunrs a SWIG object
>     path = str(r'C:\testdatadir\arc10geodb.gdb')
>     mydataSrc = drvrObj.Open(path) # printing the data source prints a SWIG
> object
>     lyrCnt = mydataSrc.GetLayerCount() # always returns 0 but there are many
> layers in the fgdb
>     lyr = mydataSrc.GetLayer(0) # always returns null
>
> The comments in the code above kind of summarize the situation.  It appears
> that I can create a valid datasource but am unable to read the layers inside
> the datasource.  Any ideas?
>
>
>
>
> _______________________________________________
> gdal-dev mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

RE: python filegdb problems

Netherton, Kevin J FLNR:EX
Been playing around a bit more.  Originally when I ran ogrinfo it did not list any of the layers in the filegdb.  All the feature classes in the geodatabase came from SDE and have geometry columns named 'geometry'.  When I copied a shapefile feature class into the file geodatabase and then ran ogrinfo all of a sudden that layer was listed. The feature class that is getting listed has a geometry column called 'shape'.

Is there a switch or a parameter that will allow ogrinfo to see the other feature classes in the file geodatabase?  I suspect that its looking for a geometry column called 'shape' and isn't finding it.

I copied the geodatabase to the following location in case that helps.

ftp://ftp.geobc.gov.bc.ca/pub/outgoing/GeoBC_Regional/SIR/Kamloops/ogr/arc10gdb.zip




-----Original Message-----
From: Stefano Iacovella [mailto:[hidden email]]
Sent: Tuesday, March 20, 2012 2:04 PM
To: Netherton, Kevin J FLNR:EX
Cc: [hidden email]
Subject: Re: [gdal-dev] python filegdb problems

Did you run ogrinfo arc10geodb.gdb on a shell?

Does it show the layers inside the fileGDB or it throws some error?

Stefano


2012/3/20 Netherton, Kevin J FLNR:EX <[hidden email]>:

> Hello
>
> I'm trying to get the python bindings to the ogr library working with esri
> file geodatabase (filegdb) support.  I am using the latest version of ms4w
> package that includes gdal/ogr 1.9.
>
> I have created a esri file geodatabase driver, then from that created a data
> source, but am unable to access layers from the data source object.  Below
> is a quick summary of my code:
>
>     drvrObj = osgeo.ogr.GetDriverByName(r'FileGDB') # print the driver
> retunrs a SWIG object
>     path = str(r'C:\testdatadir\arc10geodb.gdb')
>     mydataSrc = drvrObj.Open(path) # printing the data source prints a SWIG
> object
>     lyrCnt = mydataSrc.GetLayerCount() # always returns 0 but there are many
> layers in the fgdb
>     lyr = mydataSrc.GetLayer(0) # always returns null
>
> The comments in the code above kind of summarize the situation.  It appears
> that I can create a valid datasource but am unable to read the layers inside
> the datasource.  Any ideas?
>
>
>
>
> _______________________________________________
> gdal-dev mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: python filegdb problems

Stefano Iacovella
Kevin

the ftp server doesn't seem to accept anonymous connection. Is there a
public role or a specific account to get the file you posted?

stefano

2012/3/20 Netherton, Kevin J FLNR:EX <[hidden email]>:

> Been playing around a bit more.  Originally when I ran ogrinfo it did not list any of the layers in the filegdb.  All the feature classes in the geodatabase came from SDE and have geometry columns named 'geometry'.  When I copied a shapefile feature class into the file geodatabase and then ran ogrinfo all of a sudden that layer was listed. The feature class that is getting listed has a geometry column called 'shape'.
>
> Is there a switch or a parameter that will allow ogrinfo to see the other feature classes in the file geodatabase?  I suspect that its looking for a geometry column called 'shape' and isn't finding it.
>
> I copied the geodatabase to the following location in case that helps.
>
> ftp://ftp.geobc.gov.bc.ca/pub/outgoing/GeoBC_Regional/SIR/Kamloops/ogr/arc10gdb.zip
>
>
>
>
> -----Original Message-----
> From: Stefano Iacovella [mailto:[hidden email]]
> Sent: Tuesday, March 20, 2012 2:04 PM
> To: Netherton, Kevin J FLNR:EX
> Cc: [hidden email]
> Subject: Re: [gdal-dev] python filegdb problems
>
> Did you run ogrinfo arc10geodb.gdb on a shell?
>
> Does it show the layers inside the fileGDB or it throws some error?
>
> Stefano
>
>
> 2012/3/20 Netherton, Kevin J FLNR:EX <[hidden email]>:
>> Hello
>>
>> I'm trying to get the python bindings to the ogr library working with esri
>> file geodatabase (filegdb) support.  I am using the latest version of ms4w
>> package that includes gdal/ogr 1.9.
>>
>> I have created a esri file geodatabase driver, then from that created a data
>> source, but am unable to access layers from the data source object.  Below
>> is a quick summary of my code:
>>
>>     drvrObj = osgeo.ogr.GetDriverByName(r'FileGDB') # print the driver
>> retunrs a SWIG object
>>     path = str(r'C:\testdatadir\arc10geodb.gdb')
>>     mydataSrc = drvrObj.Open(path) # printing the data source prints a SWIG
>> object
>>     lyrCnt = mydataSrc.GetLayerCount() # always returns 0 but there are many
>> layers in the fgdb
>>     lyr = mydataSrc.GetLayer(0) # always returns null
>>
>> The comments in the code above kind of summarize the situation.  It appears
>> that I can create a valid datasource but am unable to read the layers inside
>> the datasource.  Any ideas?
>>
>>
>>
>>
>> _______________________________________________
>> gdal-dev mailing list
>> [hidden email]
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
> _______________________________________________
> gdal-dev mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: python filegdb problems

Paolo Corti
On Wed, Mar 21, 2012 at 1:42 PM, Stefano Iacovella
<[hidden email]> wrote:
> Kevin
>
> the ftp server doesn't seem to accept anonymous connection. Is there a
> public role or a specific account to get the file you posted?
>
> stefano
>

ciao Stefano
I could download it earlier this morning, and I can confirm that OGR
is able to access to only one of the 6 feature classes.
So in my opinion it is worth opening a ticket and attach the sample
dataset to investigate further, Kevin would you mind doing that?

thanks
P

--
Paolo Corti
Geospatial software developer
web: http://www.paolocorti.net
twitter: @capooti
skype: capooti
_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev