Follow

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

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

To run this script:

  1. Copy the script below, or click here to download the BAS file: Create_Street_Map_by_Town.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_Town.bas
' Copyright (C) Golden Software Inc. 1992-2015
'
' Starts MapViewer and creates a street map of certain towns.
'
' This script uses the STR files that are available on the Support Central page.
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

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

  ' Start MapViewer and create a pointer to the application object
  Set mvApp = CreateObject("MapViewer.Application")

  ' Make the application visible
  mvApp.Visible = True

  ' Create a plot document
  Set plot = mvApp.Documents.Add(DocType:=mvDocPlot)

  ' Create street map of Loveland and Berthoud 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
  towns(0) = "Loveland"
  towns(1) = "Berthoud"

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

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.