anthirini

Reading both shapefiles and grid files

Discussion created by anthirini on Nov 22, 2012
Latest reply on Nov 24, 2012 by anthirini
Hello everybody!

I have a grid file of 4x5 cells. This file contains values of water velocity.

I also have a polygon shapefile that contains the information of land use in the same region.

I am reading the velocity cell values one by one and according to these values and the type of land use, I want to solve a specific equation.

My problem is that I am reading the velocity values from the grid file and everything is ok, but how can I read simultaneously the respective types of landuse from the shapefile in the respective location of every grid cell?

I have managed to read a shapefile by the use of the following code:

import arcpy

LandUse="C:\\Python26\\ArcGIS10.0\\Python programming \\landuse shpfile\\landuse data_ypan.shp" 

#rows = arcpy.SearchCursor(featureClass)

rows = arcpy.SearchCursor(LandUse)
row = rows.next()

while row:
      
    print row.Land_Group
    row = rows.next()


But obviously these commands read the whole shapefile. I only need to read the respective values in the specific cells.

I imagine that a solution is to convert the land use shapefile to a grid file but is there any other way?

I am a new Python user and unfortunately I can???t imagine yet what Python can do???

Thank you very much for your time!!!

Outcomes