[gdal-dev] mdb to shape conversion: no geometry exported

Boris.Vasiliev at forces.gc.ca Boris.Vasiliev at forces.gc.ca
Wed Nov 25 10:19:53 EST 2009


>  Boris.Vasiliev at forces.gc.ca
<http://lists.osgeo.org/mailman/listinfo/gdal-dev>  wrote:
> > Hi,
> > 
> > I would like to convert an ArcGIS .mdb database to shape files but,
> > unfortunately, the geometry is not exported.  This issue was raised
> > before in this mailing list, but I could not find a solution. Hence,
a
> > new post.
> ...
> > The .dbf file contains the correct data; however, when I load the
.shp
> > file into QGIS the layer is empty.  Similarly, when I import the
shape
> > file into GRASS, GRASS shows 0 lines, polygons and points.  I tried
> > setting the new layer type option, -nlt, to GEOMETRY, POLYGON, and
> > LINESTRING but this did not help - shape files contain no geometry.
> > 
> > The ogr2ogr version is 1.6.2, released 2009/07/31.
> > 
> > Is this a known issue with .mdb files?  Are there any diagnostic
tools
> > which may indicate what is wrong with the .mdb file and why geometry
is
> > not exported?  Is anybody aware of possible fixes?

> Boris,

> There are some geometry types in personal geodatabases which are known
not
> to translate.  A review of open personal geodatabase tickets should
turn up
> some information on this. I see the following potentially related
tickets:
>
>   http://trac.osgeo.org/gdal/ticket/3100
>   http://trac.osgeo.org/gdal/ticket/2991
>   http://trac.osgeo.org/gdal/ticket/2702
>   http://trac.osgeo.org/gdal/ticket/2643
>   http://trac.osgeo.org/gdal/ticket/1918

> It looks like, from 2991, that fixes may be in trunk and 1.6.3 that
would
> be helpful.

> Running ogrinfo with the "--debug on" flag might give additional
diagnostic
> information.

> Chaitanya, could you review the status of all the above tickets and
see if
> your fixes for 2991 address the others?  Please close tickets when you
are
> reasonably confident they are dealt with (including notes such as
pointers
> to 2991).

> Best regards,
> -- 
>
---------------------------------------+--------------------------------
------
> I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at
pobox.com <http://lists.osgeo.org/mailman/listinfo/gdal-dev> 
> light and sound - activate the windows | http://pobox.com/~warmerdam
> and watch the world go round - Rush    | Geospatial Programmer for
Rent

Thank you for quick reply.  I run ogrinfo with the "--debug on" 

ogrinfo Pgeo:polling_geo Districts

and got the following output. (The listing is truncated to one feature
of the map.)

# PGeo: MDB Tools driver: /usr/lib/libmdbodbc.so.0
# ODBC: HOME=/home/vasiliev
# ODBC: ODBCSYSINI=/home/vasiliev
# PGeo: MDB Tools driver installed successfully!
# PGeo: EstablishSession(polling_geo)
# ODBC: SQLConnect(polling_geo)
# ERROR 1: importFromWKT() failed on SRS 'GEOGCS["GCS_'.
# PGeo: Districts: no primary key
# ERROR 1: importFromWKT() failed on SRS 'GEOGCS["GCS_'.
# PGeo: KC_Districts: no primary key
# PGEO: Ignoreing GUID SRTEXT: {B286C06B-08
# PGeo: Highway: no primary key
# OGR: OGROpen(Pgeo:polling_geo/0x8051a90) succeeded as PGeo.
# OGR: GetLayerCount() = 3
# 
# Error at Line : syntax error near (
# ERROR 1: GetFeatureCount() failed on query SELECT COUNT(*) FROM
Districts.
# 
# INFO: Open of `Pgeo:polling_geo'
#       using driver `PGeo' successful.
# 
# Layer name: Districts
# Geometry: Unknown (any)
# Feature Count: 18
# Extent: (60.872970, 29.377130) - (68.112780, 34.411050)
# Layer SRS WKT:
# (unknown)
# OBJECTID: Integer (0.0)
# FID_1: Integer (0.0)
# Id: Integer (0.0)
# FID_2: Integer (0.0)
# ID_1: Integer (0.0)
# PROVINCE_N: String (0.0)
# DISTRICT_N: String (0.0)
# AREA_SQKM: Real (0.0)
# Distance: Real (0.0)
# Shape_Length: Real (0.0)
# Shape_Area: Real (0.0)
# OGRFeature(Districts):0
#   OBJECTID (Integer) = 5
#   FID_1 (Integer) = 31
#   Id (Integer) = 0
#   FID_2 (Integer) = 58
#   ID_1 (Integer) = 58
#   PROVINCE_N (String) = ABC
#   DISTRICT_N (String) = def
#   AREA_SQKM (Real) = 1229.33
#   Distance (Real) = 20200
#   Shape_Length (Real) = 1.700229
#   Shape_Area (Real) = 0.117263

It appears that ogrinfo does not recognize the geometry type because of
the  "Geometry: Unknown (any)" line. However, I checked the geometry
type in ArcGIS and it seems to be "Polygon". 

The issue may be related to the tickets you mentioned above; however
they seem to deal with the more complicated cases of PolygonZ (ticket
2991) whereas I think I have a map that contains several polygons.

At this time, I managed to export the map to a shape file with ArcMap;
however, it would be wonderful if the conversion could be done with
ogr2ogr from command line.

Regards,
Boris.



More information about the gdal-dev mailing list