Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ cd /path/to/gdal-1.10.1
- /* -------------------------------------------------------------------- */
- /* Use options process to get .my.cnf file contents. */
- /* -------------------------------------------------------------------- */
- int nPort = 0, i;
- char **papszTableNames=NULL;
- std::string oHost, oPassword, oUser, oDB;
- // char *apszArgv[2] = { (char*) "org", NULL };
- // char **papszArgv = apszArgv;
- // int nArgc = 1;
- // const char *client_groups[] = {"client", "ogr", NULL };
- my_init(); // I hope there is no problem with calling this multiple times!
- // load_defaults( "my", client_groups, &nArgc, &papszArgv );
- //
- // for( i = 0; i < nArgc; i++ )
- // {
- // if( EQUALN(papszArgv[i],"--user=",7) )
- // oUser = papszArgv[i] + 7;
- // else if( EQUALN(papszArgv[i],"--host=",7) )
- // oHost = papszArgv[i] + 7;
- // else if( EQUALN(papszArgv[i],"--password=",11) )
- // oPassword = papszArgv[i] + 11;
- // else if( EQUALN(papszArgv[i],"--port=",7) )
- // nPort = atoi(papszArgv[i] + 7);
- // }
- //
- // // cleanup
- // free_defaults( papszArgv );
- # make directory for build output
- $ mkdir ogr_plugins
- # compile shared plugin, statically linking in libmysqlclient (multi-line, single command)
- $ g++ -Wall -g ogr/ogrsf_frmts/mysql/*.c*
- -shared -o ogr_plugins/ogr_MySQL.dylib /usr/local/mysql/lib/libmysqlclient.a
- -Iport -Igcore -Iogr -Iogr/ogrsf_frmts -Iogr/ogrsf_frmts/mysql
- -I/Library/Frameworks/GDAL.framework/Headers -I/usr/local/mysql/include
- -framework GDAL -lz -install_name ogr_MySQL.dylib
- */ #just closing comment for SE syntax highlighting
- # copy plugin to known GDAL_DRIVER_PATH (sudo needed)
- $ cd ogr_plugins
- $ sudo cp -f ogr_MySQL.dylib /Library/Application Support/GDAL/1.10/PlugIns/
- $ cd /path/to/gdal-1.10.1
- $ otool -L ogr_plugins/ogr_MySQL.dylib
- ogr_plugins/ogr_MySQL.dylib:
- ogr_MySQL.dylib (...)
- /Library/Frameworks/GDAL.framework/Versions/1.10/GDAL (...)
- /usr/lib/libz.1.dylib (...)
- /usr/lib/libstdc++.6.dylib (...)
- /usr/lib/libSystem.B.dylib (...)
- $ ogrinfo --formats | grep 'MySQL'
- -> "MySQL" (read/write)
- from osgeo import ogr
- sorted([ogr.GetDriver(drv).name for drv in range(0,ogr.GetDriverCount())])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement