MapWindow GIS ActiveX Control



Similar documents
Introduction to Custom GIS Application Development for Windows. By: Brian Marchionni

Visualization with Excel Tools and Microsoft Azure

WFP Liberia Country Office

Working with SQL Server Integration Services

Adobe Acrobat: Creating Interactive Forms

Getting Started With LP360

How to use Wireframe in Visio

Custom Reporting System User Guide

Creating Fill-able Forms using Acrobat 8.0: Part 1

Activity: Using ArcGIS Explorer

Build Your First Web-based Report Using the SAS 9.2 Business Intelligence Clients

Data Visualization. Brief Overview of ArcMap

Getting Started With the MapWinGIS ActiveX Control

Creating and Using Links and Bookmarks in PDF Documents

A database is a collection of data organised in a manner that allows access, retrieval, and use of that data.

Spatial Adjustment Tools: The Tutorial

Microsoft PowerPoint 2008

Creating a Storyboard using Microsoft Word

Wyoming Geographic Information Science Center & Wyoming Game & Fish Department

Schoolwires Staff Website Reference Guide

How to Edit an . Here are some of the things you can do to customize your

6. If you want to enter specific formats, click the Format Tab to auto format the information that is entered into the field.

Internet Explorer 7. Getting Started The Internet Explorer Window. Tabs NEW! Working with the Tab Row. Microsoft QUICK Source

INTRODUCTION to ESRI ARCGIS For Visualization, CPSC 178

Files Used in this Tutorial

How to Mail Merge PDF Documents

Applying a circular load. Immediate and consolidation settlement. Deformed contours. Query points and query lines. Graph query.

Contents. The OWRB Floodplain Viewer. Creating Maps Helpful Tips... 10

How To Use The Unify Intelligence Center On A Pc Or Macbook Or Macrocessor On A Computer Or Macosade On A Macbook (For Macro Recipebook) On A Mobile Device On A Web Browser On A Desktop Or

Print Audit 6 - SQL Server 2005 Express Edition

Using SSH Secure File Transfer to Upload Files to Banner

Microsoft Access 2010 Part 1: Introduction to Access

The guide uses the example files provided with Flood Modeller. Depending on your operating system these are located at:

Completing Baseline s Site Survey Request Form

Microsoft Outlook Reference Guide for Lotus Notes Users

There are various ways to find data using the Hennepin County GIS Open Data site:

Create an Art Collage

Modeling Fire Hazard By Monica Pratt, ArcUser Editor

Embroidery Fonts Plus ( EFP ) Tutorial Guide Version

The LSUHSC N.O. Archive

OmniTouch 8400 Instant Communications Suite. My Instant Communicator Desktop User guide. Release 6.7

DataPA OpenAnalytics End User Training

Tutorial 3: Working with Tables Joining Multiple Databases in ArcGIS

PRELIMINARY Interfacing to C++

Login: Quick Guide for dotcms & Accessibility November 2014 Training:

Module One: Getting Started Opening Outlook Setting Up Outlook for the First Time Understanding the Interface...

Web Portal User Guide. Version 6.0

Writer Guide. Chapter 15 Using Forms in Writer

Prints and Photographs Online Catalog Web Address

Turbo Lister Listing Activity Quick Start Guide

Spatial Database Support

ImageNow User. Getting Started Guide. ImageNow Version: 6.7. x

Texas Wildfire Risk Assessment Portal (TxWRAP) User Manual. Texas A&M Forest Service

Planning and Creating a Custom Database

HELCOM Data and Map Service. User Manual

New Features in Microsoft Office 2007

Outlook Add-in Deployment Guide

Introduction to Microsoft Access 2013

ArcGIS Tutorial: Adding Attribute Data

NETWORK PRINT MONITOR User Guide

Finding GIS Data and Preparing it for Use

Creating Interactive PDF Forms

ZoomText 10.1 for Windows 8 Quick Reference Guide Addendum

Using Spreadsheets, Selection Sets, and COGO Controls

Advanced Presentation Features and Animation

SMART Ink 1.5. Windows operating systems. Scan the following QR code to view the SMART Ink Help on your smart phone or other mobile device.

Table of Contents. Part I Welcome. Part II Introduction. Part III Getting Started. Part IV The User Interface. Part V Quick Start Tutorials

ITCS QUICK REFERENCE GUIDE: EXPRESSION WEB SITE

Microsoft Outlook Tips & Tricks

Guide To Creating Academic Posters Using Microsoft PowerPoint 2010

MrSID Viewer 2.0 for Windows 95/NT4.0

Chapter 14: Links. Types of Links. 1 Chapter 14: Links

Database Servers Tutorial

Using Clicker 5. Hide/View Explorer. Go to the Home Grid. Create Grids. Folders, Grids, and Files. Navigation Tools

Legal Notes. Regarding Trademarks KYOCERA Document Solutions Inc.

MICROSOFT OFFICE ACCESS NEW FEATURES

ArcGIS. Tips and Shortcuts. for Desktop

Microsoft PowerPoint 2010

Tyler Dashboard. User Guide Version 6.2. For more information, visit

Ofgem Carbon Savings Community Obligation (CSCO) Eligibility System

USING STUFFIT DELUXE THE STUFFIT START PAGE CREATING ARCHIVES (COMPRESSED FILES)

Virto Pivot View for Microsoft SharePoint Release User and Installation Guide

8 CREATING FORM WITH FORM WIZARD AND FORM DESIGNER

Tutorial 3 Maintaining and Querying a Database

Sharing Files and Whiteboards

Chapter 15 Using Forms in Writer

Instructions to view & create.kmz/.kml files from Google Earth

Access Tutorial 3 Maintaining and Querying a Database. Microsoft Office 2013 Enhanced

Avery Dennison UK Consumer Helpline: Consumer

3D-GIS in the Cloud USER MANUAL. August, 2014

INSTRUCTIONS FOR MAKING 3D,.DWG CONTOUR LINES

CARESTREAM Vue Motion

Password Memory 6 User s Guide

Practice Management Application Suite

Microsoft Publisher 2010: Web Site Publication

ECA IIS Instructions. January 2005

Government 1009: Advanced Geographical Information Systems Workshop. LAB EXERCISE 3b: Network

MODULE 2: SMARTLIST, REPORTS AND INQUIRIES

Transcription:

MapWindow GIS ActiveX Control Sample Project: Data Visualization Tool A step-by-step guide to creating a custom GIS-aware application with the MapWindow GIS ActiveX Control by Christopher Michaelis cmichaelis@happysquirrel.com

Introduction Often, a full geographic information system is not needed for a given application or task. In these cases, it is immensely useful to build a custom application from the ground up. Adding GIS capabilities to a custom application is typically slow and difficult; in this guide you will use the MapWinGIS ActiveX Control to vastly simplify this goal, easily and quickly adding GIS functionality to a custom program. The tool developed here is a simple data visualization tool, allowing the user to view ESRI Shapefiles and most raster data formats including ECW, Mr. SID, GeoTIFF, ASCII, ArcGrid and many other raster files. A more advanced demonstration application, the Hike Difficulty Analysis Tool, continues the concepts demonstrated here. This project is written using Microsoft Visual Basic 2005 Express edition, and may be downloaded here: http://www.mapwindow.org/download.php?show_details=24 Step 1: Please follow the steps below to create the basic data viewer application. Create a new VB.Net project using Microsoft Visual Studio. Step 2: Right-click in the Toolbox window and select Choose Items (Visual Studio 2005) or Add Control (Visual Studio 2002-2003). Select the COM Components tab. Browse to the location of the MapWindow GIS ActiveX control, typically: C:\Program Files\MapWindow\MapWinGIS.ocx This window is shown in figure 1:

Figure 1: Adding the Map Control to the toolbox. Step 3: Notice that Map Control has now been added to the list of tools that you may use. Select this tool, and click in the default form that was created when your project was created. Use the mouse to drag the corner, resizing it as desired. Also add a button and a groupbox, and three radio buttons inside of the groupbox, as shown in figure 2:

Figure 2: Form with button and radio button controls. Step 4: Change the names of the map, buttons and radio button. Change the text of the button and radio buttons. Map (Defaults to AxMap1): Change name to Map or any name you prefer. Button1: Change text to Add Data. Change name to btnadddata or any name you prefer. RadioButton1: Change text to Zoom In. Change name to rdzoomin or any name you prefer. RadioButton2: Change text to Zoom Out. Change name to rdzoomout or any name you prefer. RadioButton3: Change text to Pan.

Step 5: Change name to rdpan or any name you prefer. Change the text of the group box to Mouse Cursor Mode or any text you prefer. Change the text of the form to Data Viewer or any preferred text. Set the anchor for the groupbox and the button to Left and Bottom. Set the anchor for the main map to Left, Right, Top and Bottom. This will make it so that the map size will expand when the window is resized. Figure 3: Properly named form controls. Step 6: Set the Checked property of the Zoom In radio button to true. This is because the default cursor mode for the map is to zoom in. Double-click the Add Data button. This will take you into the source code view. Add the code beginning on the next page to the btnadddata_click subroutine. The code listing looks daunting at first; however, this code provides access to every file format that the MapWinGIS ActiveX control supports. Supporting only a shapefile or only a grid would be a substantially shorter code listing.

'Create instances of the possible data objects, 'to retrieve the dialog filters of supported formats. Dim sf As New MapWinGIS.Shapefile Dim grd As New MapWinGIS.Grid Dim img As New MapWinGIS.Image 'We want users to be able to open any file type. 'Merge the dialog filters by placing a pipe character 'in between each: Dim dlg As New OpenFileDialog dlg.filter = "All Files (*.*) *.* " & sf.cdlgfilter & _ " " & grd.cdlgfilter & " " & img.cdlgfilter If dlg.showdialog() = Windows.Forms.DialogResult.OK Then 'If the user didn't cancel the dialog, try to open the file. 'First, determine what kind it was: Dim extension As String = _ IO.Path.GetExtension(dlg.FileName).ToLower() If sf.cdlgfilter.tolower().contains(extension) Then 'It's a shapefile sf.open(dlg.filename) Map.AddLayer(sf, True) 'Zoom to all visible layers Map.ZoomToMaxExtents() Return 'Done ElseIf grd.cdlgfilter.tolower().contains(extension) Then 'NOTE: a.tif can be a GeoTIFF (a grid) 'or an image. Check this, if the file 'is a tif: If dlg.filename.tolower().endswith("tif") Then If Not Map.IsTIFFGrid(dlg.FileName) Then 'It's an image, not a grid. 'Open it as an image. img.open(dlg.filename) Map.AddLayer(img, True) 'Zoom to all visible layers Map.ZoomToMaxExtents() Return 'Done End If End If 'Open the grid: grd.open(dlg.filename) 'Define a coloring scheme to color this grid: Dim sch As New MapWinGIS.GridColorScheme 'Use a predefined coloring scheme "Fall Leaves" sch.usepredefined(grd.minimum, grd.maximum, _ MapWinGIS.PredefinedColorScheme.FallLeaves) 'Convert it to an image that can be displayed: Dim u As New MapWinGIS.Utils

Dim gridimage As MapWinGIS.Image gridimage = u.gridtoimage(grd, sch) 'Add the generated image to the map: Map.AddLayer(gridimage, True) 'Zoom to all visible layers Map.ZoomToMaxExtents() Return 'Done ElseIf img.cdlgfilter.tolower().contains(extension) Then 'It's a plain image img.open(dlg.filename) Map.AddLayer(img, True) 'Zoom to all visible layers Map.ZoomToMaxExtents() Return 'Done End If End If Step 7: Press the Play button on the toolbar (figure 4) to start the program. Figure 4: The green "Play" button to begin running the application. Click on your Add Data button, and select any common GIS data format file. You may also click the Files of Type drop down to see what formats are supported (figure 5):

Figure 5: The Add Data... button. You will now see your data in the map (figure 6): Figure 6: Data added to view.

Step 8: Double-click on the Zoom In radio button. Add the following code: Map.CursorMode = MapWinGIS.tkCursorMode.cmZoomIn Double-click on the Zoom Out radio button. Add the following code: Map.CursorMode = MapWinGIS.tkCursorMode.cmZoomOut Double-click on the Pan radio button. Add the following code: Step 9: Map.CursorMode = MapWinGIS.tkCursorMode.cmPan Click the Play button once again to run the program. Your viewer can now zoom in, zoom out, and pan as well as support a large number of data formats. Additional Information: For a much more detailed demonstration, please visit: http://www.mapwindow.org/download.php?show_details=24