ArcView Avenue Scripts

Mileage Maker

Introduction

This Avenue script creates mileage - that is, a new theme with equidistant points laying on the source polyline(s), which represents road/rail section. If the source theme is a PolyLine, then the distance calculation is done in two dimensions and the output theme is Point. If the source theme is a PolyLineZ, then the distance calculation is done in three dimensions and the output theme is PointZ.

You can specify the distance between points, the mileage on the start of the polyline(s) and the mileage of the first point to be displayed. If no feature is selected in the source theme, it will make mileage for all polylines, otherwise only for the selected ones. In new version, single dialogue as well as storing selected values are introduced for simpler use.

Installation: put the file in the ArcView extension directory (usually C:\ESRI\AV_GIS30\ARCVIEW\EXT32) and select Mileage Maker at File/Extension menu from the View.

Download: ZIP file, 6 kB

Tip for usage

This script could be used to determine the mileage of many features (e.g. from a point theme) along the road/rail section very easily in three simple steps.

First determine the precision of the mileage determination needed for your (point) theme (e.g. 5 m). Then, create mileage with that distance (5 m) between the mileage markers. Finally, make a Spatial Join between your (point) theme and mileage theme!

Author

Script was created by Marko Pinteric. Report bugs and suggestions using feedback form.

Poly Distance and Poly Connect

Introduction

These Avenue scripts works as kind of Spatial Join and find the minimal (Euclidean) distance between two PolyLine / Polygon themes. They take a feature of the main theme and find the closest feature of the joined theme.

If no feature is selected in the main theme, they will find the closest features of the joined theme for all features in the main theme, otherwise only for the selected ones. If no feature is selected in the joined theme, it will look for the closest feature out of all features in the joined theme, otherwise only out of the selected ones.

Poly Connect has several specifics. It is somewhat slower than Poly Distance, but enables getting other important information. It can:

One can select which of these information is desired in the process.

Installation: put the file in the ArcView extension directory (usually C:\ESRI\AV_GIS30\ARCVIEW\EXT32) and select Poly Distance at File/Extension menu from the View.

Download poly_distance: ZIP file, 5 kB

Euclidean distance

The Euclidean distance between any two geometric objects is defined as the minimum distance between any two of their points. PolyLine and Polygon features in general consist of infinite number of points, so the problem of finding Euclidean distance is not a trivial one.

The closest distance between two features can involve vertices of both segments or a vertex of the first feature and a line segment between two vertices of the second feature.

Euclidean distance

The Euclidean distance between any two geometric objects is defined as the minimum distance between any two of their points. PolyLine and Polygon features in general consist of infinite number of points, so the problem of finding Euclidean distance is not a trivial one.

The closest distance between two features can involve vertices of both segments or a vertex of the first feature and a line segment between two vertices of the second feature.

All calculations are exact (no approximation)!

Example

Here we have two themes. The first is a PolyLine and represents road network, of which each road is labelled with a number (field ROAD_ID). The second is a Polygon and represents buildings, which are labeled with letters (field BUILD_ID). Vertices of the road segments are emphasized for better understanding.

Poly Distance example

To find which road is closest to each building, we can use Poly Connect script. We select the buildings theme as the main theme, and the road network theme as the joined theme. The DISTANCE, MILEAGE and SIDE fields with appropriate values is added to the building theme table. If ROAD_ID field of the road network theme is selected as a reference field, then the ROAD_ID field is also added to the building theme table, filled with labels of the closest road, e.g. A-1, C-2.

Note that the shortest distance between the building A and the road 1 involves a line segment of the building and a vertex of the road. On the other hand the shortest distance between the building D and the road 1 involves a vertex of the building and a line segment of the road. Distance between the building B and the road 1 involves two vertices.

Poly Distance example

To find which building is closest to each road, we can use Poly Connect script. We select the road network theme as the main theme, and the buildings theme as the joined theme. The DISTANCE, MILEAGE and SIDE fields with appropriate values is added to the road theme table. If BUILD_ID field of the buildings theme is selected as a reference field, then the BUILD_ID field is also added to road theme table, filled with labels of the closest building, e.g. 1-A, 2-D.

Note that joining is not a bijection. That is, road 1 is closest to building D, but building A is closest to road 1, and building D to road 2.

Poly Distance example

Literature

Author

Script was created by Marko Pinteric. Report bugs and suggestions using feedback form.

Road Data

Introduction

This Avenue script is improved version of Poly Connect script. It works as kind of Spatial Join and finds the (Euclidean) distance between general (PolyLine/Polygon/Point) theme and road (PolyLine) theme. It takes a feature of the general theme, finds the closest feature of the road theme and calculates the distance from the road, mileage and side of the road. It can also append selected field value from the road theme table. One may also specify road theme field representing offset mileage of the road.

If none feature is selected in the general theme, it will find distance for all features in the theme, otherwise only for the selected ones. If none feature is selected in the road theme, it will look for the closest road out of all features in the theme, otherwise only out of the selected ones.

Note, all calculations used as well as the result are exact!

Road Data script can:

  1. return distance between general object and the road
  2. return the value of the selected field of the road network theme
  3. return information whether the general object is on the left or the right side of the road
  4. return position of the general object relative to road mileage
  5. can read mileage offset value from the road network theme field and add it to calculated relative mileage
  6. create a theme consisting of lines representing closest connection
  7. one can select which of the above capatibilities is desired in the process

Installation: put the file in the ArcView extension directory (usually C:\ESRI\AV_GIS30\ARCVIEW\EXT32) and select Road Data at File/Extension menu from the View.

Download road_data: ZIP file, 5 kB

Example

Using buildings theme and road network theme from the previous example, we can demonstrate the effect of Road Data.

Road Data example

Results in the main theme table after applying Road Data
build_idroad_iddistancemileageside
A12.3717.75right
B13.4924.72left
C27.1716.50right
D12.7140.48left
E32.96 8.93right
F32.7219.46left
G12.4355.76left

Known problems with Road Data

If two line segments of two features are completely parallel, script might fail. I have never encountered such case yet. Minor change to the script should be done to solve this problem.

If one of the features (PolyLine or Polygon) is completely contained within the other (Polygon), then the Euclidean distance is zero, but the script returns non-zero value. If only part of the feature is contained, there is no problem and script will return zero value. Minor change to the script should be done to solve this problem.

Script is somewhat slower than Poly Distance and other Spatial Joins, which are in-built in the ArcView.

Author

Script was created by Marko Pinteric. Report bugs and suggestions using feedback form.

Polyline Elevator

Introduction

This Avenue enables creation of 3D PolyLine (PolyLineZ) theme based on 2D PolyLine theme and separate elevation data.

Two sources are needed for script to work:

Usage: Select 2D PolyLine in View and start the script. The script asks you about the name of the output 3D PolyLine theme, the name of the reference field and the name of elevation data DBF file. If the 2D PolyLine name is matched by the field name in the elevation data DBF file, script will create 3D PolyLine.

Two fields are created in 3D PolyLine output theme: the reference field with PolyLine names, and a field that displays the number of PolyLine vertices (useful for troubleshooting).

Note: There might be some limitations to the name of DBF field names, so keep the names short and simple. There is no limitation on number of PolyLines.

Installation: put the file in the ArcView extension directory (usually C:\ESRI\AV_GIS30\ARCVIEW\EXT32) and select PolyLine Elevator at File/Extension menu from the View.

Download: ZIP file, 4 kB

Tip for usage

Digitalization of roads and railways includes creation of elevation lines. Only 2D PolyLines can be created in ArcView and AutoCAD, and the elevations of vertices must be assigned manually in other programs. The alternative is to inscribe elevations in program like Excel, export data to DBF and then automatically assign them to PolyLines in ArcView.

Polyline Reversal

Introduction

This is a very simple Avenue script that reverses PolyLine vertex order.

If no feature is selected in the source theme, it will reverse all features, otherwise only the selected ones.

Installation: put the file in the ArcView extension directory (usually C:\ESRI\AV_GIS30\ARCVIEW\EXT32) and select Polyline Reversal at File/Extension menu from the View.

Download: ZIP file, 4 kB

Tip for usage

French standard XPS 31-133 is to become European standard for noise mapping. According to this standard direction of traffic axes is important. Traffic axis in ArcView are represented by PolyLines, so direction of PolyLines is crucial. This script enables easy management of PolyLine direction.

Author

Script was created by Marko Pinteric. Report bugs and suggestions using feedback form.

Rotate

Introduction

This is a very simple Avenue script that rotates PolyLines and Polygons around the individual feature's centre. Script copies all field values from the original to the created feature.

You can specify the angle of CCW rotation and decide whether the original feature will be deleted. If no feature is selected in the source theme, it will rotate all features, otherwise only the selected ones. The source theme remains in the same edit/no-edit mode as before the script started.

Installation: put the file in the ArcView extension directory (usually C:\ESRI\AV_GIS30\ARCVIEW\EXT32) and select Rotate at File/Extension menu from the View.

Download: ZIP file, 4 kB

Author

Script was created by Marko Pinteric. Report bugs and suggestions using feedback form.

Created by Marko Pinteric: feedback form.

Updated . Web page has been read by visitors since July 2005.

Valid XHTML 1.0! Valid CSS!