📄 drv_pgeo.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN"><html><head> <meta name="generator" content= "HTML Tidy for Linux/x86 (vers 12 April 2005), see www.w3.org"> <title>ESRI Personal GeoDatabase</title></head><body bgcolor="#FFFFFF"> <h1>ESRI Personal GeoDatabase</h1> <p>OGR optionally supports reading ESRI Personal GeoDatabase .mdb files via ODBC. Personal GeoDatabase is a Microsoft Access database with a set of tables defined by ESRI for holding geodatabase metadata, and with geometry for features held in a BLOB column in a custom format (essentially Shapefile geometry fragments). This drivers accesses the personal geodatabase via ODBC but does not depend on any ESRI middle-ware.</p> <p>Personal Geodatabases are accessed by passing the file name of the .mdb file to be accessed as the data source name. No ODBC DSN is required.</p> <p>OGR treats all feature tables as layers. Most geometry types should be supported, including 3D data. Measures information will be discarded. Coordinate system information should be properly associated with layers.</p> <p>Currently the OGR Personal Geodatabase driver does not take advantage of spatial indexes for fast spatial queries, though that may be added in the future.</p> <h2>How to use PGeo driver with unixODBC and MDB Tools</h2> <p>This article gives step-by-step explanation of how to use OGR with unixODBC package and how to access Personal Geodatabase with PGeo driver.</p> <h3>Prerequisites</h3> <ol> <li>Install <a href="http://www.unixodbc.org">unixODBC</a> >= 2.2.11</li> <li>Install <a href="http://mdbtools.sourceforge.net/">MDB Tools</a> >= 0.6. I also tested with 0.5.99 (0.6 pre-release).</li> </ol> <h3>Configuration</h3> <p>There are two configuration files for unixODBC:</p> <ul> <li>odbcinst.ini - this file contains definition of ODBC drivers available to all users; this file can be found in /etc directory or location given as --sysconfdir if you did build unixODBC yourself.</li> <li>odbc.ini - this file contains definition of ODBC data sources (DSN entries) available to all users.</li> <li>~/.odbc.ini - this is the private file where users can put their own ODBC data sources.</li> </ul> <p>Format of configuration files is very simple:</p> <pre>[section_name]entry1 = valueentry2 = value</pre> <p>For more details, refer to <a href= "http://www.unixodbc.org/doc/">unixODBC manual</a>.</p> <h4>1. ODBC driver configuration</h4> <p>First, you need to configure ODBC driver to access Microsoft Access databases with MDB Tools. Add following definition to your odbcinst.ini file.</p> <pre>[Microsoft Access Driver (*.mdb)]Description = MDB Tools ODBC driversDriver = /usr/lib/libmdbodbc.so.0Setup =FileUsage = 1CPTimeout =CPReuse =</pre> <ul> <li>[Microsoft Access Driver (*.mdb)] - remember to use "Microsoft Access Driver (*.mdb)" as the name of section because PGeo driver composes ODBC connection string for Personal Geodatabase using "DRIVER=Microsoft Access Driver (*.mdb);" string.</li> <li>Description - put short description of this driver definition.</li> <li>Driver - full path of ODBC driver for MDB Tools.</li> </ul> <h4>2. ODBC data source configuration</h4> <p>In this section, I use 'sample.mdb' as a name of Personal Geodatabase, so replace this name with your own database.</p> <p>Create .odbc.ini file in your HOME directory:</p> <pre>$ touch ~/.odbc.ini</pre> <p>Put following ODBC data source definition to your .odbc.ini file:</p> <pre>[sample_pgeo]Description = Sample PGeo DatabaseDriver = Microsoft Access Driver (*.mdb)Database = /home/mloskot/data/sample.mdbHost = localhostPort = 1360User = mloskotPassword =Trace = YesTraceFile = /home/mloskot/odbc.log</pre> <p>Step by step explanation of DSN entry:</p> <ul> <li>[sample_pgeo] - this is name of ODBC data source (DSN). You will refer to your Personal Geodatabase using this name. You can use your own name here.</li> <li>Description - short description of the DSN entry.</li> <li>Driver - full name of driver defined in step 1. above.</li> <li>Database - full path to .mdb file with your Personal Geodatabase.</li> <li>Host, Port, User and Password entries are not used by MDB Tools driver.</li> </ul> <h3>Testing PGeo driver with ogrinfo</h3> <p>Now, you can try to access PGeo data source with ogrinfo.</p> <p>First, check if you have PGeo driver built in OGR:</p> <pre>$ ogrinfo --formatsSupported Formats: ESRI Shapefile ... PGeo ...</pre> <p>Now, you can access your Personal Geodatabase. As a data source use PGeo:<DSN> where <DSN> is a name of DSN entry you put to your .odbc.ini.</p> <pre>ogrinfo PGeo:sample_pgeoINFO: Open of `PGeo:sample_pgeo'using driver `PGeo' successful.1. ...</pre>After you run the command above, you should get list oflayers stored in your geodatabase. <p>Now, you can try to query details of particular layer:</p> <pre>ogrinfo PGeo:sample_pgeo <layer name>INFO: Open of `PGeo:sample_pgeo'using driver `PGeo' successful.Layer name: ...</pre> <p>If you have any comments or questions, don't hesitate to post them on the <a href= "mailto:gdal-dev@lists.maptools.org">gdal-dev@lists.maptools.org</a> mailing list.</p></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -