|
While trying to figure out where property lines should be drawn on a neighborhood map, I found that some of the property lines followed township/section lines. So I downloaded the free PLSS data provided by DeLorme and loaded it into XMap 5.2 Pro. But there was a problem, the PLSS data didn't seem to match with the aerial imagery or the county plot maps. So, either the PLSS data was wrong, or the aerial imagery and county plot maps where wrong. I choose the PLSS being wrong. So I I started my search for another source of PLSS data.
While I did find other sources of PLSS data (as well as all types of other data), it was all stored in ESRI Shapefile format. The problem was, none of the DeLorme programs I have (Topo USA, Street Atlas, and XMap Pro) can read a shapefile. Actually, XMap Pro 6.2 can now read shapefiles, but I'm waiting for 7.x to come out before upgrading, so I haven't tried this new feature. Although I have a feeling that while the newer versions of XMap will allow me to import shapefiles, they won't allow the shapefile data to be exported and viewed in Topo USA or Street Atlas.
To solve this problem, I wrote an application that can read a shapefile and then generate a .TXT file that can then be imported into Topo USA, Street Atlas, or XMap. I call this application SHP2DRAW. The application can be downloaded from the Downloads page.
Online Help for SHP2DRAW
When you're searching for shapefiles, the files will normally be contained within a ZIP file. Within this ZIP file can be some or all of the following file types:
- .SHP - This is the Main Shapefile. You must have this one.
- .SHX - This is the Index file. You must have this one.
- .DBF - This is the dBASE file. This one isn't required, but is useful. This file contains useful information about each record within the Main Shapefile.
- .PRJ - This is a Project file. This one isn't required, but can be very useful if present. This file will contain the projection information needed to convert the Main Shapefile data into Latitude/Longitude values. If the data within the .SHP file is Latitude/Longitude values, this file may not be present and isn't needed.
- .SBN and .SBX - a Spatial index of the features. These files are not used by the application.
- .SHP.XML - Metadata in XML format. This file isn't used by the application.
There are some other file types that can be included in the ZIP file, but the above seem to be the most common. For more information, check out this wiki link on shapefiles.
The application uses a tab style interface, similar to how DeLorme products work. There are a total of six tabs, of which 3 are disabled when the application is first executed. The six tabs are:
- Select
- Preview (initially disabled)
- Generate (initially disabled)
- Database (initially disabled)
- Report
- Debug
Select tab
This is the initial tab displayed when the application is launched. This tab is used to select a shapefile, enter projection parameters, and then preview the shapefile records based on the projection parameters.
The first step after launching the application is to select a shapefile by clicking on the Select Shapefile button. This will bring up the Open Dialog box, allowing you to select the desired shapefile.

After selecting a shapefile, the application performs the following actions:
- Resets Boundary Limits to their default values.
- Clears Previous View information.
- Clears Parameter combo box values of any prior "PARAMETER" values.
- Disables the Preview, Generate, and Database tabs.
- Automatically checks Use All Field Values.
- Checks to make sure an Index file (.SHX) exists.
- Calculates Total Records contained within selected shapefile.
- Checks for existence of a Project file (.PRJ). If a Project file exists, then the file is parsed and displayed as shown below. Also, any "PARAMETER" values are added to the Parameter combo boxes (not shown until a projection other than Latitude-Longitude is selected). Additionally, the application will automatically try to setup the projection and projection parameters based on the values in the project file.
- Checks for existence of a Database file (.DBF). If a Database file exists, then a connection is opened and the Database tab is enabled (as shown below).
- All other buttons, checkboxes, and lists are enabled,

The next step is to configure the projection and projection parameters. If a project file exists, then the application will try to automatically configure the projection and projection parameters based on the project file information. If the application can not determine the projection from the project file, then the values from the file can be used to manually set the projection parameters. If a project file does not exist, then the application will default to the "Latitude-Longitude" projection. If the default "Latitude-Longitude" projection isn't correct, then you will need to get the correct projection information from the source of the shapefile.
The following steps describe how to manually setup the projection and projection parameters.
Step 1 - Setting the Projection:
In the above screenshot you will see a "PROJECTION" value of "Lambert Conformal Conic". So, we need to change the Projection from the default value of "Latitude-Longitude" to "Lambert Conformal Conic(2SP)". NOTE: There are several types of LCC projections that can be selected. "2SP" seems to be a common type and refers to the fact that the parameters includes 2 "Standard Parallel" values.

After selecting a projection, the application will now display the required parameters for the selected projection as show below. NOTE: Each supported projection requires difference types of parameters. When the Projection combo box is changed, the parameter values will be updated to show the required parameters.

NOTE: The Projection and projection parameters are stored in "proj.ini". This file can be modified to add (or remove) projection and projection parameters.
Include Check Boxes:

By checking the Include checkboxes, you can get access to the ESRI, EPSG, SPCS, IGNF, and WORLD codes. Each code includes all of the required projection parameters needed to read the shapefile data. Only use the codes if you know the shapefile has been encoded with the selected code.

After selecting a code (i.e., ESRI: 2000), the Proj4,dll Params line is updated:

After clicking on the Preview Shapefile button, you can select the Report tab to see what actual parameters where used by the selected code:

The codes provide one more way to specific the correct projection parameters for proj4.dll when converting the shapefile data into latitude/longitude values.
Step 2 - Setting the Datum and Ellipse(Spheroid):
From the project file information, we see the DATUM value is "D_North_American_1983", so set the Datum to "NAD83". The application will automatically select the Ellipse(Spheroid) commonly used for the selected Datum. If the correct Ellipse(Spheroid) was selected by the application, proceed to Step 3. If not, then set the Ellipse(Spheroid) based on the project file information. In this example, the SPHEROID value is "GRS_1980", which was correctly selected by the application.
NOTE: If a code is selected from one of the Include files, then the Datum list box will be disabled if the selected code includes a "+datum" parameter. Same with Ellipse(Spheriod), if the selected code includes a "+ellpse" parameter, then the Ellipse(Spheroid) list box will be disabled.
Step 3 - Setting Units:
From the project file information, the UNITS value is "Foot", so change the Units to "ft".
NOTE: Some project files use "Foot_US" with a value of 0.3048006096012192. This option is available further down the list as "us-ft".

Step 4 - Setting of Projection Parameters:
The next step is to enter the required Projection Parameter information. In this example, 6 parameters must be entered. To make entry of the parameter information easier, all of the PARAMETER values from the project file are added to each of the Parameter combo boxes. These pre-entered values can be accessed by using the drop-down arrow of each Parameter combo box. So, based on the project file information, enter each Projection Parameter:
When entering the False Easting and False Northing projection parameters, they must be in meters. If the UNIT value of the project file is in meters, then there shouldn't be a problem using the project file values. But, if the UNIT value of the project file isn't in meters (as is the case in this example), then the values may or may not need to be converted. Normally, the False Easting and False Northing values will be a number followed by a bunch of zeros (i.e., 400000). So, if the value in the project file is a bit strange looking (i.e., 1312335.958), then it may need to be converted to meters. To see the value converted to meters, right-click on the Projection Parameter. If the displayed value seems to make more sense (as it does in this example), then click on the pop-up value.
NOTE: One exception to the False Easting and False Northing values liking sensible is the Hotine Oblique Mercator Natural Origin projection used by some shapefiles of Michigan:

Step 5 -Exchange X-Y values:
I haven't found a shapefile were the X,Y values have been reversed (exchanged). But, just in case, I provided a checkbox that allows them to be un-reversed.
Step 6 - Proj4.dll parameters:
As you make changes to the Projection Parameter information (i.e., Projection, Datum, Ellipse, Units, etc), the Proj4.dll Params are updated. When the Preview Shapefile button is clicked, the application will initialize the DLL with the listed parameters. So, after entering the projection information and before pressing the Preview Shapefile button, the parameters listed can be manually changed if needed. Manually changing the parameters shouldn't normally be needed, but the option to change them is there should the need arise.

NOTE: The application uses a modified version of the proj4.dll (Version 4.6.1). See Proj.4 for information about how parameters are used . The only modifications made to the source code was to remove any output to stdout or stderr and to re-direct the output to the application for display on either the Report tab or the Debug tab.. Another useful reference site for determining the correct projection and parameters is http://spatialreference.org/.
Step 7 -Preview Shapefile:
At this point, a shapefile has been selected and the required projection parameters entered. So, now it's time to process the shapefile. This is done by pressing the Preview Shapefile button. Pressing the Preview Shapefile button performs the following actions:
- Initializes the Proj4.DLL with the parameters listed on the Proj4.ll Params line.
- Opens the Main shapefile (.SHP) and verifies that the header information is valid.
- Opens the Index file (.SHX) and verifies that the header information is valid.
- Uses the Bounding Box information stored in the shapefile header to update the Boundary Limits.
- Enables the Preview and Generate tabs and automatically switches the application to the Preview tab.
NOTE: If the wrong projection or projection parameters are used, then the conversion of the shapefile data into latitude/longitude values will be wrong. While the application can't detect small errors, it will give you a warning message if the converted data is outside of the valid range of latitudes (-90 to +90) or longitudes (-180 to +180):

Nornally, if you get one if these warning messages, you should re-check your projection and projection parameters on the Select tab.

Preview tab
This tab displays a preview of the shapefile data. This tab also allows you to zoom-in to a specific area. This can be done by manually entering the area into the Boundary Limits and pressing the Update Preview button, or by creating a selection box using the mouse (left-click, drag, release) within the Preview pane. Once the desired area is being displayed, press the Generate Tab button, this will switch you to the Generate tab. NOTE: Only the shapefile records within the Boundary Limits will be included in the TXT file.
Boundary Limits - These four values allow you to manually select an area. After entering new values, press the Update Preview button. This will limit the records to only those that are within these limits. This effects which records are displayed in the Preview pane and which records will be included in the TXT output file. The Boundary Limits can also be changed by drawing a selection box around the area of interest in the Preview pane. The selection box is created by a left-click, drag, release while the mouse is over the Preview Pane.
NOTE: If the Boundary Limits don't appear to be valid Latitude/Longitude values, then make sure the correct projection has been selected and that the Projection Parameters are correct.
Previous View button - Once you have zoomed into an area, this button becomes enabled. To return to the previous view, press this button. Once you have reached the first view, the button will become disabled again.
Abort button - This button is only displayed while the preview image is being created. This button can be used to abort the processing of large shapefiles.

NOTE: Pressing this button while the preview is being generated only stops the application from displaying all records within the Boundary Limits, not the actual records that will be generated later when the Generate TXT File button is pressed.
Generate Tab button - Pressing this button takes you to the Generate Tab.
Total Records (on status bar) - This value displays the total number of records stored in the shapefile.
Selected Records (on status bar) - This value displays the number of records being displayed at the current Boundary Limits setting. NOTE: If the Abort button is pressed, then this value will only display the number of records processed before pressing the Abort button.
Objects (on status bar) - This value displays the number of objects that will be exported when the Generate TXT File button is pressed. This value is the total number of parts that will be exported. This value can be higher than the Selected Records when there are multiple parts within each record of the shapefile. For more information about records and parts, see the ESRI Shapefile specification.
NOTE: If the Abort button is pressed, then the Objects value will only display the number of objects processed before pressing the Abort button.
Generate tab
The TXT file is generated from this page by pressing the Generate TXT File button. But, before generating the TXT file, there are several selections that can be made from this page that will effect the amount and type of data generated within the TXT file.
Symbol Type - This option controls how the data will be imported into Topo/Street Altas/XMap:
- Map Note This creates a “BEGIN NOTE”
- Symbol This creates a “BEGIN SYMBOL”
- Waypoint This creates a “BEGIN WAYPOINT”
- Text Note This creates a “BEGIN TEXT”
The Symbol Type is only enabled if the shapefile contains points. If the shapefile contains lines or polygons, then the Symbol Type is disabled.
Symbol Selection List - This allows you to select the type of symbol that will be imported into Topo/Street Altas/XMap. This list is only enabled if Symbol Type is “Symbol” or “Waypoint”.
Field Name Selection List - This allows you to select which field from the dBASE will be included in the TXT file. If "-Use Record Number-" is selected, then each point, line, or polygon will be given a "R-xxxx" number, where "xxxx" is the record number within the shapefile. Also, if the shapefile is lines or polygons, then "-No Name-" is also an option.
Use All Field Values - This checkbox is enabled when Field Name Selection List isn't on "-No Name-" or "-Use Record Number-", which means a dBASE field name has been selected. When checked, all records that haven't been filtered will be included in the TXT file. When un-checked, you can select which records will be included based on the field value. See Field Value Selection List below.
Field Value Selection List - This list is only enabled when a dBASE field name has been selected in the Field Name Selection List and Use All Field Values is un-checked. From this list, you can select which records you want included in the TXT file. Only the field values selected will be included. In the example below, the field "COUNTY" has been selected and User All Field Values has been un-checked. In the Field Value Selection List, only "Tillamook County", "Umatilla County", and "Union County" have been selected. This will limit the TXT file to only records that have these values in the COUNTY field of the dBASE.

Select All button - This will select all field names within the Field Value Selection List.
Select None button - This will un-select all field names within the Field Value Selection List.
Abort button - This button is only displayed while the TXT file is being generated (after pressing the Generate TXT File button). This button allows you to abort the generation of large shapefiles.

dBASE Information - This shows the information contained within the dBASE file (if it exists). This is for reference only and can be used to help in the selection of the best field name. This is the same information displayed on the Database tab. NOTE: When the Generate TXT File button is pressed, the dBASE information is disabled. This is done for performance reasons.
Filter - This allows you to filter what records will be displayed. This also effects which records will be included in the TXT file, as only records that are included in the filter value will be included. Once you enter a filter string, press Apply Filter button. NOTE: Applying a filter not only effects what records will be included in the generation of the TXT file, but also effects what records are displayed on the Preview tab. Following are some example filter strings:
| STATE='OR' |
Only records that contain 'OR' in the STATE field will be displayed and included in the TXT file. |
| STATE='OR' or STATE='WA' |
This will include only records that contain either OR or WA in the STATE Field. |
| STATE='OR' and COUNTY>='C' and COUNTY<'D' |
Only records were STATE contains 'OR' and COUNTY starts with the letter 'C' will be included. |
| (STATE='OR' or STATE='WA') and PERIMETER>2 |
Only records were STATE contains either 'OR' or 'WA' will be included, and PERIMETER must be greater than 2.
|
To make entering a filter easier, you can right-click on the Filter string. This will bring up a list of field names. Click on the desired field name and it will automatically be entered at the position of the cursor.
Optimize TXT File - Used to enable optimization logic. When selected (and enabled), the application will try to combine objects with the same Field Name. By combining objects, there will be fewer labels being displayed when imported. This logic only works with "line" type shapefiles.
This is with Optimize TXT file un-checked. Each object (5 total) is labeled by Topo.

This is with Optimize TXT file checked. Each object (5 total) has now been combined into 1 object and 1 label.
Generate TXT File button - Once you have made your selections, press this button to create the TXT file.
Database tab
When the application finds a database file (.DBF), it creates a connection to the database and then enables the Database tab. The Database tab displays the content of the dBASE file as shown below. You can also change/enter a filter value from this tab as you can from the Generate tab.
Report tab
This tab displays information about what the application has been doing.
Debug tab
This tab displays debug information about what the application has been doing.
Importing into Topo/Street Altas/XMap:
To import your TXT file, goto the Draw Tab and select “File…”. Then press the “Import…” button. This will open up the Import Draw File dialog box. Be sure to setup the Files of type, Coords, and Datum as follows:
Now, select your file and press “Open”.
Things to Remember before importing:
Point Shapes - If the data being imported is point shapes (Map Note, Symbol, Waypoint, or Text Note), then the symbol name will be drawn using the current font settings (font name, font style, font size, font color, etc). So, be sure to check and/or change them to your desired settings before importing your TXT file. This is done by selecting the Draw Tab and then pressing the Waypoint, Symbol, MapNotes, or TextLabel buttons and then setting the font as desired.
This screenshot shows the Waypoint button active. This allows you to change the font type settings when importing WAYPOINTS (See Symbol Type on Generate tab). NOTE: The Symbols setting are ignored when the TXT file is being imported. This is because the TXT file continues the Symbol information (See Symbol Select List on Generate tab)

This screenshot shows the MapNote button active. This allows you to change the font type settings when importing MAP NOTES (See Symbol Type on Generate tab) .

This screenshot shows the Text Label button active. This allows you to change the font type settings when importing TEXT NOTES (See Symbol Type on Generate tab) .

This screenshot shows the Symbol button active. This allows you to change the font type settings when importing SYMBOLS (See Symbol Type on Generate tab). NOTE: The Symbols settings are ignored when the TXT file is being imported. This is because the TXT file continues the Symbol information (See Symbol Select List on Generate tab)
Line Shapes - If the data being imported is line shapes, then the lines will be drawn using the current line settings (style, width, color, highlight). So, be sure to check and/or change them to your desired settings before importing your TXT file. This is done by selecting the Draw Tab and then pressing the Line button and then setting the line styles as desired.
Polygon Shapes - If the data being imported is polygon shapes, then the polygons will be drawn using the current polygon settings (fill, outline, width, color). So, be sure to check and/or change them to your desired settings before importing your TXT file. This is done by selecting the Draw Tab and then pressing the Polygon button and then setting the polygon styles as desired.

NOTE: Object settings can be changed either before being imported as described above, or after being imported by using the Selection Tool. 
|