Main Page/Stuff/Luc's AML

From phurvitz
< Main Page‎ | Stuff
Revision as of 07:16, 6 November 2007 by Phil Hurvitz (talk | contribs)
Jump to: navigation, search
/* change dir
w D:\SAPRP_Working_Files\Raster_Calculations\Sample_Frame\costd

/* start grid
grid

/* gridpoint
if ^[exists frameg -grid] &then
  framep = gridpoint (..\frame4)
/* add an area and count field to the frame points
&if [exists ...field]

&sv maxdist 100


/* count points
&describe framep
&sv numpoints = dsc$points

/* go!
&do i = 1 &to %numpoints%
  /* select the point i
  reselect framep point framep# = %i%
  /* save the selection
  writeselect pts.sel framep point
  /* reselect from framep to create p1 
  reselect framep p1 point pts.sel

  /* delete the selection file
  &sv d [delete pts.sel -file]

  /* create a grid from the one selected point  
  pointg = pointgrid(p1)
  
  /* run the costdistance
  outg = con(costdistance(p1, ..\frame4, #, #, %maxdist%) > 0, 1, 0)

  /* get the cell count
  LIST <info_file> INFO {range} {item...item}
  /* cell count * 9 = area

  /* create a polygon from the costdistance grid
  poly1 = gridpoly (outg)
  
  /* reselect needle points that overlap
  /* RESELECT <cover> <feature_class> OVERLAP <overlap_cover>
         /* <overlap_feature> {selection_distance}
         /* {PASSTHRU | WITHIN}
  reselect needles point overlap poly1 poly 

  /* count of selection
  
  /* write selection and area back onto frameg point
  calculate

  /* kill intermediate files
  kill pointg
  kill outg
  kill poly1