HOW TO

Find and report the distance between two points along a route

Last Published: April 25, 2020

Procedure

Is it possible to measure the distance between two points along a route?

Answer:

Build a route system on the coverage making sure that the F-MEAS and T-MEAS have been populated with appropriate measure values. This can be done from the ARC prompt using the MEASUREROUTE command with the {ARC} option.

The usage for MEASUREROUTE at ARC/INFO 6.1.1 is:

Usage: MEASUREROUTE < cover > {in_route_item} {out_route_item} {measure_item} {UL | UR | LL | LR} {ROUTE | SECTION | ARC} {selection_file}

At version 7.X, the ARCROUTE command now exists and does the same job as MEASUREROUTE but much faster and in a more efficient manner.

The usage for ARCROUTE at ARC/INFO 7.0.3 is:

Usage: ARCROUTE < in_cover > {in_route_item} {out_route_item} {measure_item} {UL | UR | LL | LR} {BLANK | NOBLANK}

The following AML code returns the distance between two interactively selected points along the route:

Code:

/*----------------------------- Author --------------------------------------
/*
/*Original Coding: ESRI
/*
/*----------------------------- Name ----------------------------------------
/*
/*MEASURE_PT_DISTANCE.AML
/*Copyright, 1994, Environmental Systems Research, Institute, Inc.
/*
/*----------------------------- Purpose -------------------------------------
/*This AML will allow a user to interactively select two points along a
/*specified route and find the distance in coverage units between those
/*two points. In order for this to work properly, the route system must be
/*built already, and measures assigned.
/*
/*---------------------------- Usage ----------------------------------------
/*
/* MEASURE_PT_DISTANCE < COVERAGE >
/*
/*-------------------------- Disclaimer -------------------------------------
/*You may use, copy, modify, merge, distribute, alter, reproduce and/or
/*create derivative works of this AML for your own internal use. All rights
/*not specifically granted herein are reserved to ESRI.
/*
/*THIS AML IS PROVIDED "AS-IS" WITHOUT WARRANTY OF ANY KIND, EITHER
/*EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
/*WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
/*PURPOSE, WITH RESPECT TO THE AML.
/*
/*ESRI shall not be liable for any damages under any theory of law related
/*to your use of this AML, even if ESRI is advised of the possibilites of
/*such damage. This AML is not supported by ESRI.
/*---------------------------- Arguments ------------------------------------
/*
/* .cov input coverage
/* .rsys name of route system
/*
/*------------------------ Global Variables ---------------------------------
/*
/* .cov input coverage
/* .rsys name of route system
/*
/*------------------------ Local Variables ----------------------------------
/*
/* distA distance measured to first point along route
/* distB distance measured to second point along route
/* length distance between two points
/*
/*---------------- Input/Output Files, Coverages, etc. ----------------------
/*----------------- Detailed Remarks, Assumptions, etc. ---------------------
/*
/* [show measure route] returns key,route_number, measure_value
/*
/*----------- Other AMLs, Menus, or Programs Run from this AML --------------
/*----------- Other AMLs, Menus, or Programs which Run this AML -------------
/*-------------------- Operating System Dependencies ------------------------
&args .cov .rsys
measure route %.cov% %.rsys%
&s distA [extract 3 [show measure route]]
measure route %.cov% %.rsys%
&s distB [extract 3 [show measure route]]
&s length [calc %distB% - %distA%]
&type The distance between those points is, %length%...
&return
/*--------------------------------------------------------------------------
/*
&severity &error &routine bailout
&call exit
&return
/*
/* ---------------------------- Routine Usage --------------------------------
/*
&routine usage
&type Usage: &run MEASURE_PT_DISTANCE.AML
&return
/*
/* ---------------------------- Routine Exit ---------------------------------
/*
&routine exit
&return
/*
/* --------------------------- Routine Bailout -------------------------------
/*
&routine bailout
&severity &error &ignore
&call exit
&return; &return &error Bailing out of MEASURE_PT_DISTANCE.AML...
/* End of AML.

Article ID:000001259

Software:
  • Legacy Products

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic