English

How To: Find extent min and max values for one or many coverages

Summary

This document show how to return the extent of an individual coverage, or the common extent among many coverages.

Procedure

  • For an individual coverage use the DESCRIBE command to report the extent to the screen, or the &DESCRIBE directive to populate reserved coverage extent variables:

    %DSC$XMIN%, %DSC$YMIN%, %DSC$XMAX%, %DSC$YMAX%

  • For a group of coverages, the bounding extent can be determined by comparing each coverage's &DESCRIBE variable values to those of the previous coverage. This can be automated in an AML using an &DO &LIST loop on the list of desired coverages.

    /* EXTENTS.AML
    /*
    /* USAGE: &RUN EXTENTS <cover_1,cover_2,...,cover_n>
    /*
    /* PURPOSE: This AML determines the lowest XMIN, the lowest YMIN,
    /* the highest XMAX, and the highest YMAX among a group of
    /* coverages.
    /*
    /* NOTES: The <cover_1,cover_2,...,cover_n> argument has a limit
    /* of 4096 characters.
    /*
    /* This is not an ESRI supported AML. Please use at your own risk.
    /* Also, please make a backup of your data before running this AML
    /* and carefully check the output. This is just a skeleton AML with
    /* no real error checking. It is meant only as a guide to developing an
    /* AML specific to your data inputs and desired outputs.
    /*Capture the comma delimited list of coverages from &RUN command ...
    &args covlist:REST

    /*Check proper usage ...
    &if [null %covlist%] &then
    &call usage
    &else
    &call analyze
    &return
    /**************
    &routine analyze
    /**************

    /*Get extents of first coverage ...
    &sv covlist = [unquote %covlist%]
    &describe [extract 1 %covlist%]
    &sv .xmin = %DSC$XMIN%
    &sv .ymin = %DSC$YMIN%
    &sv .xmax = %DSC$XMAX%
    &sv .ymax = %DSC$YMAX%

    /*Create a list omitting first coverage ...
    &sv covlist2 = [unquote [after [quote %covlist%] [extract 1 %covlist%]]]

    /*Compare each coverage to previous to determine the lowest extent
    /*minimums and highest maximums ...
    &do i &list %covlist2%
    &describe %i%
    &if %.xmin% > %DSC$XMIN% &then &sv .xmin = %DSC$XMIN%
    &if %.ymin% > %DSC$YMIN% &then &sv .ymin = %DSC$YMIN%
    &if %.xmax% < %DSC$XMAX% &then &sv .xmax = %DSC$XMAX%
    &if %.ymax% < %DSC$YMAX% &then &sv .ymax = %DSC$YMAX%
    &end
    &ty The extents for all input datasets are:
    &ty %.xmin% %.ymin% %.xmax% %.ymax%
    &return

    /**************
    &routine usage
    /**************
    &ty No input coverage(s) specified.
    &ty USAGE: &RUN EXTENTS <cover_1,cover_2,...,cover_n>
    &return