Follow

How can I plot STR street map data for a specific zip code using MapViewer automation?

This article contains a sample script for creating a street map for a specific zip code.

To run this script:

  1. Copy the script below, or click here to download the BAS file: Create_Street_Map_by_ZIP.bas.
  2. In a Windows Explorer window, navigate to C:\Program Files\Golden Software\MapViewer 8\Scripter.
  3. Double click on Scripter.exe to launch Scripter.
  4. Press Ctrl+A to select all of the existing lines then press Delete.
  5. If you copied this script, press Ctrl+V to paste it into Scripter. If you downloaded it, click File | Open, select the BAS file from your downloads directory, and click Open.
  6. Click Script | Run to run the script.
     

*********

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Create_Street_Map_by_ZIP.bas
' Copyright (C) Golden Software Inc. 1992-2015
'
' Starts MapViewer And creates a street map of certain ZIP codes.
'
' This script uses the STR files that are available on the Support Central page.
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Sub Main
  Dim mvApp, plot, stmap As Object
  Dim zips(1) As Variant

  ' Initializes and opens MapViewer
  Set mvApp = CreateObject("MapViewer.Application")
  mvApp.Visible = True
  Set plot = mvApp.Documents.Add(DocType:=mvDocPlot)

  ' Create street map of ZIP 80525 and 80526 in Larimer Co, CO.
  ' The values for the IDIndexFor* parameters are:
  '  0 = empty string
  '  1 = street name
  '  2 = street type
  '  3 = address range for left side of street
  '  4 = address range for right side of street
  '  5 = zip code for left side of street
  '  6 = zip code for right side of street
  zips(0) = "80525"
  zips(1) = "80526"

  plot.CreateStreetMap ( StreetFileName := "C:\GSI_Street_Data\CO\08069.STR", _
    Append := True, IDIndexForPID := 1, IDIndexForSID := 0, IDIndexForAtt1 := 5, _
    IDIndexForAtt2 := 6, IDIndexForHyperlink := 0, Subset := True, _
    pZIPOrTownNames := zips, SpecifyTown := False )

End Sub

 

Updated November 2, 2016

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.