Possible Duplicate:
How to install GDAL with Python on windows?

I am trying to copy GDAL osgeo to my python library file to run my python program for gis function. following is code.

import osgeo.ogr

shapefile = osgeo.ogr.Open("tl_2009_us_state.shp") numLayers = shapefile.GetLayerCount()

print ("Shapefile contains %d layers" % numLayers) print

for layerNum in range(numLayers): layer = shapefile.GetLayer(layerNum) spatialRef = layer.GetSpatialRef().ExportToProj4() numFeatures = layer.GetFeatureCount() print ("Layer %d has spatial reference %s" % (layerNum, spatialRef)) print ("Layer %d has %d features:" % (layerNum, numFeatures)) print

for featureNum in range(numFeatures):
    feature = layer.GetFeature(featureNum)
    featureName = feature.GetField("NAME")

    print ("Feature %d has name %s" % (featureNum, featureName))

But u able to find missing .py file as some error. Can any one say step is write or any other steps for installing.

  • Done using .exe
    – Pari
    Jun 14, 2012 at 12:17


Browse other questions tagged or ask your own question.