SQL SERVER 2012, Python subprocess, OGR

المشرف العام

Administrator
طاقم الإدارة
Need help with uploading shapefile with srid 102008 to SQL server 2012. I ran the ogr2ogr script in the ogr shell and it uploaded the shapefile within seconds but when i try using python subprocess to call ogr - i get an empty spatial_ref_sys and geometry column table added to SQL server 2012 database. I should add, that I have read write access to the database .

Here's my script-

import osimport sysimport subprocess

Set OGR2OGR environment

gdal = r'C:\Program Files (x86)\GDAL'gdalData = r'C:\Program Files (x86)\GDAL\gdal-data'os.environ['PATH'] = gdal + ';' + os.environ['PATH']os.environ['GDAL_DATA'] = gdalData

indriver = "MSSQL:server=;database=;trusted_connection=yes"ogr2ogr = r'C:\Program Files (x86)\GDAL\ogr2ogr.exe'cmd = '-f MSSQLSpatial'proj_cmd = '-a_srs'proj = "EPSG:102008"reName_cmd = '-nln'reName = 'NewName'shp = path = r'H:\NAWAT\20151226_L48_NAD83.shp'translateFile_tx =' '.join([ogr2ogr, cmd, indriver, shp])subprocess.call(translateFile_tx)print 'Done'

Thanks for any input



أكثر...
 
أعلى