Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a MODIS file and I want to

  1. Select random points within each land cover class
  2. Extract values of rasters to the sample points.
  3. Export attribute table

Could you please tell me what steps I need to follow to this and what tools I need to use? I am new to ARCGIS and would appreciate any help. I have read several papers on this but I am still confused as to how to actually get it done in GIS.

  • I have the latest version of ARC-GIS
  • Also have access to ENVI
  • Have all tools including Spatial Analyst
  • No idea about how many points would be sufficient.
share|improve this question

closed as unclear what you're asking by PolyGeo, whuber Oct 25 '13 at 15:52

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

    
I think you should tackle your questions one at a time. The first is "How to generate a point feature class with random locations?" For that I would need to know how many random points you are after and whether they occur in a rectangle or some sort of clipping polygon. You can then cursor through those points to use the Get Cell Value tool to interrogate your raster at those random locations. –  PolyGeo Oct 22 '13 at 8:07
    
What version of ArcGIS for Desktop are you using? A solution using cursors will need to know this because 10.1/10.2 has arcpy.da while 10.0 does not. –  PolyGeo Oct 23 '13 at 3:20
    
Thanks. I have access to latest version of ARC-GIS. I am reading up on the various things. Any help is great! :) –  Max Oct 24 '13 at 3:41
    
Do you have a min number of random points that need to be generated per raster land cover class? –  artwork21 Oct 24 '13 at 13:21
    
What license level of ArcGIS for Desktop do you have? And do you have Spatial Analyst? Be sure to edit into your Question to improve it rather than answering in Comments. –  PolyGeo Oct 25 '13 at 10:25
show 1 more comment

1 Answer 1

I'll leave the code below but, if I had found the Extract Multi Values To Points tool and had Spatial Analyst license, then that would be my first choice.

The code below should cover off on how to use any point feature class (which must have a field called RastVal) and any raster dataset to get the raster value for each point and write the value in the first band into the RastVal field of the point feature class. You just need to substitute in your own point feature class and raster dataset. I left in some commented out print statements that I found useful while testing the code.

I recommend trying this and seeing if you can get it to work and treat creating the random points feature class as a separate exercise (and Question).

import arcpy

arcpy.MakeRasterLayer_management("C:/Support/Max/test","testRaster","#","#","#")

# print arcpy.GetCellValue_management("testRaster","2.3 1.9","#")[0]

with arcpy.da.UpdateCursor("C:/Support/Max/testPoints.shp", ["SHAPE@XY","RastVal"]) as cursor:
    for row in cursor:
        coord = "{} {}".format(row[0][0],row[0][1])
        # print coord
        rastVal = arcpy.GetCellValue_management("testRaster",coord,"#")[0]
        # print rastVal
        row[1] = rastVal
        cursor.updateRow(row)
share|improve this answer
    
I was hoping to do it through the GUI. But I'll try. =( –  Max Oct 25 '13 at 20:41
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.