LinePoly              from Spatial Development
available through www.spatial-online.com
...determine the containing polygon for each line in your shape file

Table of Contents Overview

LinePoly determines the containing polygon(s) for each line in a shape file. This information is stored in the line database by copying attributes from the polygon shape file across to the line shape file. The percentage of the line that is in the polygon can also be transferred.

As a line may be in several polygons, the length of the line is calculated for each polygon it overlaps. The polygons are then ordered according to the percentage of the length of the line in each. Polygon attributes are then transferred to the line in accordance to the parameters set in the user interface.

If a line lies on the boundary of two polygons, half its length is considered to be in each polygon.

A table can be produced with a record for each line/polygon overlap by Spatial Development product OverlapPoly.

Return to Table of Contents

Installation Instructions

LinePoly, amongst other ArcView extensions, can be downloaded and installed for a free trial from www.spatial-online.com. The file that is downloaded is called LinePoly.exe. Double click on the file, and an Install Wizard will guide you through the installation.

After installation, the extension will be available through the usual ArcView extension directory. To load the extension,

After the extension is loaded, when the View Menu is visible, there will be a Polygon option. Beneath this button will be items The latter will bring up this help screen. It utilizes EvokeBrowser to evoke the standard browser with LinePoly.htm which will reside under the Help subdirectory of your ArcView installation.

When the required line and polygon files are visible, select LinePoly to run LinePoly.

Instructions on running LinePoly directly from your Avenue script or calling it from C++ code are provided below.

Return to Table of Contents

Run from ArcView

To run LinePoly from ArcView, make all line and polygon shape files that you are interested in visible in a view. Then choose Polygon > LinePoly.

If the product is still being evaluated, the registration screen below will appear next. Clicking the Purchase LinePoly button will evoke your browser with www.spatial-online.com to enable you to purchase the product on-line, through the Fax or via Purchase Order. When you purchase the product, you will be required to supply your site code (just below the Purchase button). In return, you will get a product key. Insert that key into the Edit Box next to Product Key and click OK to register the product. Once you have done this, this registration box will no longer appear.

To run the product in trial mode, click the Run in Demo Mode button. Below the button, the remaining trial period is shown.

Clicking the Cancel button will stop the process.

The LinePoly process will be evoked. It will provide the dialog below. The line files in your current view will be listed in the top combo box beside Line File with the first selected. The polygon files in your current view will be listed in the next combo box beside Polygon File with the first selected. The two combo boxes on the fourth line will be loaded with the attributes of the currently selected line file and polygon file.

Note: The text at the bottom of the box, "Click OK when parameters selected" in the diagram below, supplies instructions and error messages. If the process does not seem to be proceeding as expected, check the text and it will explain why.

Before clicking OK to run the process, the following must be specified:

Of the three remaining buttons, Help will evoke the browser with this help, Cancel will cancel the process, and OK will start the process.

After clicking the OK button, check the line of text at the bottom of the screen. If there is a problem, it will be identified there.

When the process is complete, the line table will be brought up in ArcView. The lines will have their attributes modified as specified in the rules.

Return to Table of Contents

Run from Avenue Script

Included with the LinePoly installation are two additional scripts. LinePoly.Run takes three or four parameters and calls the DLL. LinePoly.Sample provides a sample script that will evoke LinePoly.Run.

To call LinePoly directly from your Avenue script, open a script and choose Script > Load System Script. From the dialogue, scroll down to LinePoly.Sample, choose it and click OK. The sample code will be loaded into the open script. The meaning and format of the parameters is described in the script.

Alternately, choose LinePoly.Run to get details on running the required DLL's directly.

Note there is an additional boolean parameter. If it is set true, the program will run without user interaction. In this mode, the dialog will be presented to monitor progress, but the user will not be able to modify anything unless the parameters will not work, such as a file not being available.

Return to Table of Contents

Run from C++

To run LinePoly directly from C++, ensure that ssi07.dll is within your path and include the following code:

HINSTANCE hDllEvokeBrowser = NULL;
hDllEvokeBrowser = LoadLibrary("c:\\Esri\\Av_gis30\\Arcview\\Bin32\\EvokeBrowser.DLL");
if (!hDllEvokeBrowser) {
    AfxMessageBox("Could not Load EvokeBrowser");
    return 0;
}
typedef DWORD (CALLBACK *DWLPSSD)(LPSTR, LPSTR, LPSTR, LPSTR, BOOL);
HINSTANCE hDll = NULL;
DWLPSSD lpProc = NULL;
hDll = LoadLibrary("c:\\Esri\\Av_gis30\\Arcview\\Bin32\\LinePoly.DLL");
if (hDll) {
    lpProc = (DWLPSSD)GetProcAddress(hDll, "LinePoly");
} else {
    AfxMessageBox("Could not Load Library");
    return 0;
}
if (!lpProc) {
    AfxMessageBox("GetProcAddress Failed");
    FreeLibrary (hDll);
    return 0;
}
char * pzLineFile[_MAX_PATH];
CString osPolygonFile;
CString osAttributes;
// Set line file, polygon file and attributes if required
int nReturn = (*lpProc)("c:\Esri\gis_30\ArcView\Help\LinePoly.htm",
                                pzLineFile,
                                osPolygonFile.GetBuffer(),
                                osAttributes.GetBuffer(),
                                false);
FreeLibrary (hDll);
if (nReturn) AfxMessageBox("Run successful");
else AfxMessageBox("Run failed");
return nReturn;

The second parameter is used to return the name of the line file actually chosen by the user. It should thus be allocated sufficient room to hold the longest path length.

The format for the shape files, that is pzLineFile and osPolygonFile, is

    (path\\file1.shp)[(path\\file2.shp)...]
Zero or any number can be specified. All specified will be in the combo box and the first will be the default selection. The format for an attribute rule is
    (PolygonPrevelance|LineAttribute|PolygonAttribute)
Please see How to define a rule for the meaning of PolygonPrevelance. If the PolygonAttribute is blank, the percentage of the length of overlap will be used. Zero or any number can be specified. Combine more than one rule by concatenation.

The first parameter specifies the placement of the help file, and there is an additional final boolean parameter. If it is set true, the program will run without user interaction. In this mode, the dialog will be presented to monitor progress, but the user will not be able to modify anything unless the parameters will not work, such as a file not being found.

Return to Table of Contents

Frequently Asked Questions

  • I pressed Ok or chose a file and it did not continue or accept the file.
    • Look at the message along the bottom of the screen and it will tell you why.
  • I get the message back that it cannot open the file to write, but the table is open in ArcView.
    • That may be the problem. Line poly is run from a DLL, and sometimes ArcView grabs hold of the file and will not let other excutables write to it. Please make sure that you are not editing the point file with edits not yet saved. If that does not work, please close the table editing screen, and make sure in a shared environment that other people are not editing the table.
  • I recieved a message "Please connect to www.spatial-online.com for free software that will enable the jet database engine on this computer". What is the problem?
    • Many computers running ArcView have the Microsoft Jet Database already installed. For this reason, we do not include it in the product installation as it significantly increases the size of the download file. Click here to download and install Jet Database, after which you will not see this message again.

Return to Table of Contents

Other Spatial Development Products

Spatial Development offers other products for determining overlap with polygons.

  • PointPoly determines which polygon each point is in. Attributes of the polygon are transferred to the point database. Click here for more information about PointPoly or here to download a free evaluation of this product.
  • OverlapPoly determines the overlap of features with a polygon file. The end result is a table that links the features to all the polygons that contain them along with the type of overlap and a measure such as length for lines. Click here for more information about OverlapPoly or here to download a free evaluation of this product.
This help is provided from within ArcView by the assistance of a free utility called EvokeBrowser. This product enables one to evoke the default browser from within Avenue code. Click here to download a free copy EvokeBrowser.

Return to Table of Contents

About LinePoly

LinePoly Copyright ©1999 is a product of Spatial Development. All rights reserved.

Warning: This computer program is protected by copyright law and international treaties. Unauthorized reproduction of it, or any portion of it, may result in severe civil and criminal penalties, and will be prosecuted to the maximum extent possible under the law.

The software comes "as is". Neither Spatial Development nor www.spatial-online.com make any warranty, representation, promise or guarantee of any kind, either expressed or implied, statutory or otherwise, including, but not limited to the implied warranties of quality, performance, non-infringement, merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the software is with the user. We do not warrant that the functions contained in the software will meet your requirements or that the operation of the software will be uninterrupted or error free.

Return to Table of Contents