How can I enter a Query expression in a MapViewer script?

This article provides a sample script for querying in MapViewer via automation.

Enter the Query expression in a script the same way you would enter it in the program, the only difference is the quotes. In a script, a single set of double quotes surrounds the entire expression, and anywhere within the string where quotes are needed (ie. around the PID or SID values), put two double quotes.


To run this script:

  1. Copy the text below, from the Sub Main start line to the End Sub end line.
  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.
  5. Press Ctrl+V to paste your copied script over top of these existing lines.
  6. Click Script | Run to run the script.

Sub Main

Dim mvApp, Plot As Object
Set mvApp = CreateObject("MapViewer.Application")
mvApp.Visible = True

'Opens the ContourMap.gsm sample file in a new plot window
Set Plot = mvApp.Documents.Open(mvApp.ApplicationFolder+"\samples\ContourMap.gsm")

'Performs the Query
Plot.Query(Verb:=mvQueryVerbApplyProperty, Region:=mvQueryMap, Point:=True, _
Expression:="PID=""Denver""", SymbolIndex:=33, SymbolSize:=0.3, SymbolFillColor:=mvColorBlue)

End Sub

Updated September 10, 2018


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


Please sign in to leave a comment.