[Gdal-dev] GDAL v1.3.2 on linux - no PGEO driver

Mateusz Loskot mateusz at loskot.net
Sat May 20 04:39:00 EDT 2006


Hi Stuart,

It seems I've managed to run ogrinfo against PGeo datasets.

Stuart Eve wrote:
> The system that I had it set up on is Suse 10, with unixODBC 2.2.10 and
> I started out with mdbtools 0.5 and gdal 1.3.1

I have Ubuntu 5.10 + unixODBC 2.2.4 + mdbtools 0.5.99.0.6pre1.0.
I installed all these tools from Ubuntu packages.

> 1. The PGeo is currently set up to look for a driver called Microsoft
> Access Driver (*.mdb) - this of course doesn't exist by default (but it
> may be possible to set a driver up in the odbcinst.ini - I was going to
> try that but then upgraded my gdal and 'lost' the pGeo driver)

I thikn, this is because of portability.
On Windows, the driver is called that way.

> 2. I set up a new driver (in odbcinst.ini) called MDBToolsODBC - and
> pointed it at the mdbtools driver (libmdbodbc.so.0)
>
> 3. I then went into the source code and changed
> ogr/ogrsf_frmts/pgeo/ogrpgeodatasource.cpp Line 104 to read: sprintf(
> pszDSN, "DRIVER=MDBToolsODBC;DBQ=%s", pszNewName).

I think this is not necessary. Simply, you can use the driver name used
by OGR.
Here is my /etc/odbcinst.ini file:

[Microsoft Access Driver (*.mdb)]
Description = MDB Tools ODBC drivers
Driver     = /usr/lib/libmdbodbc.so.0
Setup      =
FileUsage  = 1
CPTimeout  =
CPReuse    =

Here is my $HOME/.odbc.ini file with DSN's:

[stuart_pgeo]
Description = Stuart PGeo Database
Driver      = Microsoft Access Driver (*.mdb)
Database    = /home/mloskot/data/samples/pgeo/stuart.mdb
Host        = localhost
Port        = 1360
User        = mloskot
Password    =
Trace       = Yes
TraceFile   = /home/mloskot/tmp/odbc.log

And with this configuration ogrinfo works!

> 4. I ran ogrinfo (pointing it at my geodatabase) and Bingo it connected!
> However, I then got a message saying that 'table GDB is not a table'. It
> turns out that the current stable version 0.5 of mdbtools has a bug in
> it that doesn't recognise underscores in table names - so all of the GDB
> tables were getting rejected!

Here is output I got from ogrinfo running against your database:

#---------------------------------------------------------------
mloskot:~$ ogrinfo PGeo:stuart_pgeo
ERROR 1: importFromWKT() failed on SRS 'PROJCS["Brit'.
ERROR 1: importFromWKT() failed on SRS 'PROJCS["Brit'.
ERROR 1: importFromWKT() failed on SRS 'PROJCS["Brit'.
ERROR 1: importFromWKT() failed on SRS 'PROJCS["Brit'.
ERROR 1: importFromWKT() failed on SRS 'PROJCS["Brit'.
INFO: Open of `PGeo:stuart_pgeo'
using driver `PGeo' successful.
1: cxt_gtb_levels
2: cxt_gtb_cxt_schm
3: cxt_gtb_cxt_pg
4: pln_gtb_trunc
5: cxt_gtb_cxt_pl
6: cxt_labels
#---------------------------------------------------------------

As you see, layers are recognized (almost) well.
Here is output for sample layer from your database:

#---------------------------------------------------------------
mloskot:~/data/samples$ ogrinfo PGeo:stuart_pgeo pln_gtb_trunc
ERROR 1: importFromWKT() failed on SRS 'PROJCS["Brit'.
ERROR 1: importFromWKT() failed on SRS 'PROJCS["Brit'.
ERROR 1: importFromWKT() failed on SRS 'PROJCS["Brit'.
ERROR 1: importFromWKT() failed on SRS 'PROJCS["Brit'.
ERROR 1: importFromWKT() failed on SRS 'PROJCS["Brit'.
INFO: Open of `PGeo:stuart_pgeo'
using driver `PGeo' successful.

Layer name: pln_gtb_trunc
Geometry: Unknown (any)
Error at Line : syntax error near (
ERROR 1: GetFeatureCount() failed on query SELECT COUNT(*) FROM
pln_gtb_trunc.

Feature Count: -1
Extent: (531907.600000, 181008.500000) - (531945.000000, 181037.200000)
Layer SRS WKT:
(unknown)
OBJECTID: Integer (4.0)
symbol: Integer (4.0)
source: String (12.0)
comments: String (12.0)
SHAPE_Length: Real (0.0)
cxt_no: Integer (4.0)
OGRFeature(pln_gtb_trunc):1
  OBJECTID (Integer) = 1
  symbol (Integer) = 3
  source (String) = PLNFBN05_0012
  comments (String) = (null)
  SHAPE_Length (Real) = 0.99333
  cxt_no (Integer) = (null)

.......
#---------------------------------------------------------------


The only problem is with projection WKT.
I suppose it's because this WKT is ESRI-style WKT, but I'm not sure if
this the case here.

> 5. I upgraded my mdbtools to 0.6 - the CVS version (with the underscore
> bugfix) - and then at the same time upgraded my gdal and hence lost the
> PGeo driver - so haven't been able to test a PGeo connection. However, I
> can now read the geodatabase using the ODBC driver and list the tables,
> etc. so the underscore bug is definitely fixed. So close!!

Yup, I think so.


> Ok since starting this email  I have just set up a driver in my
> odbcinst.ini called [Microsoft Access Driver (*.mdb)] and ran an ogrinfo
> ODBC:/path/to/geodb and it connected just fine (but of course didn't
> recognise it as a geodatbase - but the ODBC connection read it).

As you can see from details above, PGeo drivers works.
I also tried to run with ODBC driver:

mloskot:~/data/samples$ ogrinfo ODBC:stuart_pgeo
geometry_columns is not a table in this database
ERROR 1: No column definitions found for table 'MSysACEs', layer not usable.
...
INFO: Open of `ODBC:stuart_pgeo'
using driver `ODBC' successful.
1: MSysObjects

and - no surprise - the database is open but not recognized as PGeo.

> So in conclusion (sorry for long email) - I think that if you manage to
> get PGeo installing for gdal1.3.2 - all a linux user would have to do to
> get it to access geodatabases (at least with unixODBC) is to install
> mdbtools 0.6 and set up a Driver in their odbcinst.ini called [Microsoft
> Access Driver (*.mdb)] pointing at libmdbodbc.so.0.
> 
> So I look forward to your bugfix so I can try it out!

I think I can say the PGeo driver is working.
I have not tested any serious data exploitation using PGeo driver so
there may be problems hidding there.

Frank:
What do you think? What should I test else?

Cheers
-- 
Mateusz Łoskot
http://mateusz.loskot.net



More information about the Gdal-dev mailing list