The first step is to set up the environment.
Following sites provide kind instruction what you have to do.
http://cartometric.com/blog/2011/10/17/install-gdal-on-windows/
https://pythongisandstuff.wordpress.com/2011/07/07/installing-gdal-and-ogr-for-python-on-windows/
These sites are helpful
http://www.gisinternals.com/release.php
* download site
------------------------------------------------------------
* Make sure the environment is established properly.
The next step is to install the 'ptvs' which helps you to use python into the visual studio. (In my case, the version is visual studio 2013)
Enter a keyword either 'python for visual studio' or 'ptvs'.
Then you can find certain website to help you :)
Choose the correct version of ptvs and install it.
Make new project and enter the following code.
"from osgeo import gdal"
If it works, you are ready to use gdal on visual studio.
Unless, please check followings.
- Does your project use proper python version that you set up the gdal environment?
- Does your ptvs version corresponds to your visual studio version?
- Does your python library DB updated? (if not you can do manually by clicking the "completion DB" button)
If you have any problem just leave some comments :)
------------------------------------------------------------------
I'm using gdal to convert IMG data into png data.
below is code example of it.
import gdal
import numpy as np
import matplotlib.pyplot as plt
from osgeo import gdal
from matplotlib import cm
gdal.UseExceptions()
geo_n = gdal.Open(r'D:\ChromeDownload\USGS_NED_one_meter_x24y459_IL_12_County_HenryCO_2009_IMG_2015\USGS_NED_one_meter_x24y459_IL_12_County_HenryCO_2009_IMG_2015.img')
geo_s = gdal.Open(r'D:\ChromeDownload\USGS_NED_one_meter_x24y460_IL_12_County_HenryCO_2009_IMG_2015\USGS_NED_one_meter_x24y460_IL_12_County_HenryCO_2009_IMG_2015.img')
drv = geo_n.GetDriver()
print(drv.GetMetadataItem('DMD_LONGNAME'))
north = geo_n.ReadAsArray()
south = geo_s.ReadAsArray()
#topo = np.vstack((north,south))
topo = np.vstack(south)
i,j = np.where(topo>0)
topo = topo[min(i):max(i)+1, min(j):max(j)+1]
topo[topo==0] = np.nan
print(topo.shape)
fig = plt.figure(frameon = False)
plt.imshow(topo, cmap=cm.BrBG_r)
plt.axis('off')
cbar = plt.colorbar(shrink=0.75)
cbar.set_label('meters')
plt.savefig('kauai.png', dpi=300, bbox_inches='tight')
plt.show()
'Cat.Storage > SubCat.Bufer' 카테고리의 다른 글
CMSC: 426 Computer Vision (aka Image Processing in the Catalog) (0) | 2016.10.21 |
---|---|
_GDAL_ARRAY Not found error (0) | 2016.08.03 |
One of my friends recommends me to use 'free paper site' (0) | 2016.02.29 |
[DX11 ERROR] DEVICE_DRAW_BOUND_RESOURCE_MAPPED (0) | 2016.01.27 |
[DX11 ERROR] The RenderTargetView at slot 0 is not compatable with the DepthStencilView (0) | 2016.01.27 |