KB no longer maintained - MapViewer is a Legacy Product. Legacy Products are still supported, but no longer receive new features or updates. Many of MapViewer's features have been moved to Surfer. Please contact support@goldensoftware.com with any questions. |
This article contains a sample script for creating a choropleth (hatch) map and sorting the objects in the object manager by their linked data values.
To run this script:
- Copy the script below, or click here to download the BAS file: Create_Hatch_Map_and_Sort.bas.
- In a Windows Explorer window, navigate to C:\Program Files\Golden Software\MapViewer 8\Scripter.
- Double click on Scripter.exe to launch Scripter.
- Press Ctrl+A to select all of the existing lines then press Delete.
- 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.
- Click Script | Run to run the script.
*********
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Create_Hatch_Map_and_Sort.bas ' Copyright (C) Golden Software Inc. 1992-2015 ' ' This script creates a hatch map and then sorts the objects ' by their linked data values. ' ' This script requires MapViewer 6 or later. ' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Sub Main Dim mvApp, plot, hatch As Object Dim path As String ' 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) ' Set the path variable to point to the MapViewer samples folder path = mvApp.ApplicationFolder + "samples\" ' Create a hatch map of the population in Alabama ' Col A contains the PID ' Col G contains the population Set hatch = plot.CreateHatchMap( BoundaryFileName := path + "al2010.gsb", _ DataFileName := path + "al2010.dat", PIDCol := 1, VarCol := 7 ) ' Sort by population plot.ActiveLayer.SortObjects( Type := mvSortByLinkedData, Ascending := True, _ IgnoreCase := True, DataCol := 7, LabelInFirstRow := True ) End Sub
Updated August 20, 2018
Comments
0 comments
Please sign in to leave a comment.