spacer1
spacer2 1_1 1_2
2_1
 Subscribe
 The MP2K Update!
 
 
 
 Magazine
Front Cover
What's New
Articles
News
Sample Data
Gallery
Advertise
About
 Features
MapPoint 2013
Press Releases
MapPoint Forums
Companies
Link to MP2Kmag
Wish List
MapPoint Trial
Authors
 Earlier Content
Past News Items
Past What's New Announcements
 Sponsors
 Order

MapPoint 2013

Programming MapPoint in .NET

MapPoint Book

  Spatial Community
SVG Tutorials
MapPoint

Map Visitors

  ARTICLES  


The MapPoint Web Service Helper - Part II: Mobile Application Development

This article describes how the MapPoint Web Service Helper can be used to quickly and easily write Visual Basic 2005 mobile applications that make use of the Microsoft MapPoint Web Service.

Introduction

Programming with the MapPoint Web Service directly can be extremely challenging and comes with a significant learning curve. With this concern in mind, Martin Schray, Central and Western US Academic Developer Evangelism Manager for Microsoft, and I have collaborated on the development of the MapPoint Web Service Helper. Martin has created the MapPoint Web Service Helper Class Library, with ongoing discussions with me about the functionality that it should provide. Meanwhile, I have developed two PowerPoint presentations discussing how this library can be used in developing Visual Basic 2005 Windows and Web applications.

The MapPoint Web Service Helper (we’ll call it the Helper for short) was designed to provide an easy-to-use interface to the MapPoint Web Service that doesn’t require a large learning curve. Many parameters provided by the MapPoint Web Service are hidden from the user, and returns from one method can be used to feed the next. You can find locations, render maps, retrieve driving directions, find points of interest (e.g. ATM, Banks, Gas Stations...) and even get real time traffic information. Especially nice is the fact that you can do these things for Windows, Web, and mobile applications with the Helper. In a nutshell, the Helper significantly simplifies access to the MapPoint Web Service Find, Render, and Route services by providing a simple API with just a few core arguments.

This article is the second of two that will be discussing use of the MapPoint Web Service Helper. In this article we will be discussing how to develop a MapPoint Web Service Visual Basic 2005 mobile application, making use of the Helper, that could be deployed on a Pocket PC running Windows Mobile.

Keep in mind that although this article discusses the Helper in the context of Visual Basic 2005 and the Helper was written in C#, the Helper can be used with any of the more than 20 .NET languages currently in existence. All files associated with the Helper library, including the two PowerPoints can be downloaded by going to this link at the Microsoft Academic Resource Center.

The current version of the Helper, completed during spring 2007, provides the following methods: GetInstance, FindLocation, GetMap, GetMapURL, GetRoute, GetRouteMap, GetRouteMapURL, GetRouteDirections, RouteItineraryToText, FindNearbyPlaces, GetTrafficIncident, GetPostalCode, and GetAddress. These methods were discussed in Part I using a series of small Visual Basic 2005 applications, including four Windows and one Web application. For each application, the Helper methods required by the application were described, the Visual Basic code (replete with comments) was provided, and a graphic showing the running application was displayed.

The items to be discussed in detail in this article include the following:

  • Starting a Visual Basic 2005 Pocket PC Device Application Project
  • Setting the Device Emulator Properties
  • Adding the Device Toolbar
  • Connecting the Emulator to the Internet
  • Add a Reference to the MapPointWebServiceHelperCF.dll
  • Designing the Visual Basic Mobile Application
  • Deploying the Mobile Application to the Pocket PC Emulator
  • Running the Application on a Windows Mobile Smart Phone

Starting a Visual Basic 2005 Pocket PC Device Application Project

It is assumed in our discussion that we will be builing a mobile application for the Pocket PC 2003 smart device. In this case, we would open Visual Studio 2005, select File|New Project, and then follow the five numbered steps shown in the figure below. Note that we make use of the "Device Application" installed template, and that we have given our project the name MyFirstMobileApp.

Setting the Device Emulator Properties

Since you will be making use of the MapPoint Web Service in this device application, it is clear that the emulator will need to be connected to the Internet. Setting up the device emulator can be a bit tricky, but a procedure that has worked well for the author in configuring the Pocket PC 2003 SE Emulator is now described. Select Tools|Options from the main menu in Visual Studio 2005. Then follow the numbered steps in the figure shown below. (A good resource for additional information regarding setting up the device emulator can be found by clicking this link). You may get a Microsoft Visual Studio informational message to "Reset the device before using it with the new transport" upon clicking OK (step 5 in the figure below).

Adding the Device Toolbar

If the Device Toolbar is not already visible, then you will need to add the device toolbar by clicking View|Toolbars|Device. We then select Pocket PC 2003 SE Emulator from the dropdown arrow in the device toolbar, as shown in step 1 in the figure below. Next, we click the Connect to Device button on the device toolbar, as shown in step 2 in the figure.

Connecting the Emulator to the Internet

After the "Connecting..." window has indicated that the "Connection succeeded" to the Pocket 2003 SE Emulator, you then need to configure the emulator properties so that the emulator can connect to the Internet by following the four steps shown in the figure below. As shown in the figure, after Selecting File|Configure from the "Pocket PC 2003 Second Edition" window, you need to make sure that the checkbox is checked to "Enable NE2000 PCMCIA network adapter". Selecting File|Reset from the "Pocket PC 2003 Second Edition" window allows you to reset the device if you received a Visual Studio information message earlier to do so.

A tower should show up on the emulator. As shown in steps 1 through 3 in the figure below, you need to click the tower and then indicate that "this network card connect me to the Internet". You can then start Internet Explorer on the emulator, as shown in steps 4 and 5 in the figure below.

With Internet Explorer now open, you should be able to key in and open your favorite Internet Web site, as shown in the figure below for Amazon.com. If the Web site opens, then your emulator has been properly configured and you can begin designing your Visual Basic mobile application that accesses the MapPoint Web Service.

Add a Reference to the MapPointWebServiceHelperCF.dll

Any Windows or Web applications that make use of the Helper require adding a reference to MapPointWebServiceProject.dll. In contrast to this, however, any mobile application that makes use of the Helper will require adding a reference to MapPointWebServiceProjectCF.dll. The "CF" in the name of this DLL is intended to refer to the .NET Compact Framework that allows the development of applications on devices including PDAs and mobile phones. The five steps shown in the figure below indicate how to add the reference to MapPointWebServiceProjectCF.dll. Once you have done this, you are ready to begin the design of your mobile application that makes use of the MapPoint Web Service.

Designing the Visual Basic Mobile Application

An example mobile application that makes use of the MapPoint Web Service will now be described. As shown in the figure below, the running application requires the user to key in a place (e.g., Space Needle) or an address (e.g., 222 Windsor Drive, DeKalb, IL 60115). The user then clicks the Get Map! button. The MapPoint Web Service then returns a map of the location with a marker and the phrase You are here identifying the location. Zoom Out and Zoom In buttons allow the user to perform zoom functions common to mapping applications. The author has observed that the response time for the first call to the MapPoint Web Service development server may take up to a minute, but succeeding calls either with the Get Map! or zoom buttons typcially take only about five seconds. So be patient on that first call!

The code for this application is shown below. You will note that the user only needs to key in fourteen lines of code, including two Imports statements, three Dim statements, and nine assignment statements. One can sign up for a free MapPoint Web Service Developer account that would provide a userID and password by following this link. Detailed comments in the code explain what the code is doing. Note that one would probably want to add code to catch exceptions. Also note the CF (Compact Framework) in the second Imports statement--this is a different Imports statement than was used in the Windows and Web applications discussed in Part I of this series of two articles.

Deploying the Mobile Application to the Pocket PC Emulator

Once you've completed coding your application, it is quite easy to deploy the mobile application to the Pocket PC 2003 SE Emulator. Simply follow the four steps outlined in the figure below. After the application has been deployed to the emulator, you can get maps of locations and zoom in and out to your heart's content!

Running the Application on a Windows Mobile Smart Phone

Your ultimate goal, of course, is to run your application on your actual Windows Mobile device. For example, the photo below shows the application running on a palm Treo smart phone with a broadband Verizon connection to the Internet.

While your device is connected via ActiveSync to the laptop or desktop PC where you developed the mobile application, all you need to do is simply copy two files to any folder on your mobile device that you wish. For the application developed in this article, these two files, which would be located in your project folder, would be copied to the mobile device:

  • MyFirstMobileApp.exe
  • MapPointWebServiceHelperCF.dll

To run your application on your Windows Mobile device, first make sure that your device is connected to the Internet. Then click Start|Programs|File Explorer on your Windows Mobile device and navigate to the folder containing MyFirstMobileApp.exe and MapPoint WebServiceHelperCF.dll. Click the name of the file MyFirstMobileApp.exe. Your now good to go!

Discuss this story in the forum.

Author: Rich Born
Email: rborn(AT)niu.edu
Rich Born is an Associate Professor in the Department of Operations Mangement and Information Systems in the College of Business at Northern Illinois University (NIU). Rich teaches courses in business applications of geographic information systems and computer simulation in business at both the undergraduate and graduate level. In an effort to provide insight into the benefits of mapping business data, Rich has set up a Business Geographics Center at NIU.



Google
 
MP2Kmag Internet


 Recent Discussion
-numeca fine
-AutoColor
-SolidThinking Inspire v2016.1.5559 x64-BEAN (17/8)
-Auto FX PhotoGraphic Edges Ultimate Bundle Gen2 v9.6.0 (17/8)
-Mentor Graphics FloEFD 14.2-SSQ (17/8)
-Dlubal RFEM 5.06 (x64) Multilanguage (17/8)
-Bluebeam Revu eXtreme 2018.1 v18.x Multilingual (17/8)
-Autodesk Maya 2018.4 (17/8)
-Adobe Bridge CC 2018 (v8.1) x86-x64 Multilingual Update 2 (17/8)
-Simufact.Welding 4.0.1 (17/8)
-ANSYS Discovery Enterprise 19.1.1 (17/8)
-Aurora SPARK3D v2018
-ANSYS Electromagnetics Suite 17.1 (17/8)
-Solidthinking Inspire v2018.3.0.10526 Multilingual (x64) (17/8)
-Adobe Acrobat Pro DC 2018.011.20058 Multilingual (17/8)
-ANSYS Electromagnetics Suite 17.0 (x64) (17/8)
-GibbsCAM 12.0.29.0 (x64) Multilingual (17/8)
-Autodesk Autocad Mechanical 2019.1 by m0nkrus (17/8)
-Adobe Bridge CC 2018 v8.1 (x86/x64) Update 2 Multilingual (17/8)
-Autodesk AutoCAD Electrical 2019.1 (17/8)
-DS V5R22 CATIA-DELMIA-ENOVIA last hotfixes for all SP (17/8)
-VMware Fusion Pro 10.1.3 Build 9472307 (17/8)
-MAGIX Fotostory easy 2.0.0.35 Germany + English (17/8)
-Ds Simulia Abaqus v6.14-4 (17/8)
-Paragon Drive Copy 15 Professional 10.1.25.779 (x86/x64) (17/8)
 Resources
Browse GIS books and periodicals
Find a MapPoint Partner or Consultant
Real Estate Columbia, MO Real Estate


Want Your Site To Appear Here?

   © 1999-2012 MP2K. Questions and comments to: website@mp2kmag.com
  Microsoft and MapPoint 2002/2004/2006/2009/2010/2011/2013 are either trademarks or registered trademarks of Microsoft.