Advertisement
Guest User

Untitled

a guest
Nov 10th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. $ cd /path/to/gdal-1.10.1
  2.  
  3. /* -------------------------------------------------------------------- */
  4. /* Use options process to get .my.cnf file contents. */
  5. /* -------------------------------------------------------------------- */
  6. int nPort = 0, i;
  7. char **papszTableNames=NULL;
  8. std::string oHost, oPassword, oUser, oDB;
  9. // char *apszArgv[2] = { (char*) "org", NULL };
  10. // char **papszArgv = apszArgv;
  11. // int nArgc = 1;
  12. // const char *client_groups[] = {"client", "ogr", NULL };
  13.  
  14. my_init(); // I hope there is no problem with calling this multiple times!
  15. // load_defaults( "my", client_groups, &nArgc, &papszArgv );
  16. //
  17. // for( i = 0; i < nArgc; i++ )
  18. // {
  19. // if( EQUALN(papszArgv[i],"--user=",7) )
  20. // oUser = papszArgv[i] + 7;
  21. // else if( EQUALN(papszArgv[i],"--host=",7) )
  22. // oHost = papszArgv[i] + 7;
  23. // else if( EQUALN(papszArgv[i],"--password=",11) )
  24. // oPassword = papszArgv[i] + 11;
  25. // else if( EQUALN(papszArgv[i],"--port=",7) )
  26. // nPort = atoi(papszArgv[i] + 7);
  27. // }
  28. //
  29. // // cleanup
  30. // free_defaults( papszArgv );
  31.  
  32. # make directory for build output
  33. $ mkdir ogr_plugins
  34.  
  35. # compile shared plugin, statically linking in libmysqlclient (multi-line, single command)
  36. $ g++ -Wall -g ogr/ogrsf_frmts/mysql/*.c*
  37. -shared -o ogr_plugins/ogr_MySQL.dylib /usr/local/mysql/lib/libmysqlclient.a
  38. -Iport -Igcore -Iogr -Iogr/ogrsf_frmts -Iogr/ogrsf_frmts/mysql
  39. -I/Library/Frameworks/GDAL.framework/Headers -I/usr/local/mysql/include
  40. -framework GDAL -lz -install_name ogr_MySQL.dylib
  41.  
  42. */ #just closing comment for SE syntax highlighting
  43.  
  44. # copy plugin to known GDAL_DRIVER_PATH (sudo needed)
  45. $ cd ogr_plugins
  46. $ sudo cp -f ogr_MySQL.dylib /Library/Application Support/GDAL/1.10/PlugIns/
  47.  
  48. $ cd /path/to/gdal-1.10.1
  49. $ otool -L ogr_plugins/ogr_MySQL.dylib
  50. ogr_plugins/ogr_MySQL.dylib:
  51. ogr_MySQL.dylib (...)
  52. /Library/Frameworks/GDAL.framework/Versions/1.10/GDAL (...)
  53. /usr/lib/libz.1.dylib (...)
  54. /usr/lib/libstdc++.6.dylib (...)
  55. /usr/lib/libSystem.B.dylib (...)
  56.  
  57. $ ogrinfo --formats | grep 'MySQL'
  58. -> "MySQL" (read/write)
  59.  
  60. from osgeo import ogr
  61. sorted([ogr.GetDriver(drv).name for drv in range(0,ogr.GetDriverCount())])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement