BrainDump
  Home arrow BrainDump arrow Working with Data with the MapPoint Web Se...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
BRAINDUMP

Working with Data with the MapPoint Web Service Find APIs
By: O'Reilly Media
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-02-14

    Table of Contents:
  • Working with Data with the MapPoint Web Service Find APIs
  • Querying for Geographic Extent for a Data Source
  • Working with Find Methods
  • Finding more default matches

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Working with Data with the MapPoint Web Service Find APIs


    (Page 1 of 4 )

    In this second part of a five-part series on MapPoint's Find Service, you will learn how to handle data sources and queries. It is excerpted from chapter six of the book Programming MapPoint in .NET, written by Chandu Thota (O'Reilly; ISBN: 0596009062). Copyright © 2007 O'Reilly Media, Inc. All rights reserved. Used with permission from the publisher. Available from booksellers or direct from O'Reilly Media.

    Data Sources and Countries/Regions

    Just as each data source in MapPoint Web Service supports different entity types, there is country/region level mapping to each MapPoint data source. The geographic extent (or the geographic coverage) of each data source is predefined by MapPoint Web Service. For example, the data source MapPoint.NA has a geographic extent of the United States, Canada, Mexico, and Puerto Rico. In the same way, other data sources have different supported country listings. You don’t need to remember which data source needs to be used for each country name—you can use the CommonServiceSoap class for this purpose as well.

    Countries/Regions and Their Entity IDs

    Before we get into the details of how to query data source geographic extents and how to map a country to a supported data source programmatically, you need to understand how the countries/regions are managed in MapPoint Web Service Data sources. Each country/region is given an entity ID, which is a unique integer number. Each country/region also holds an ISO2- and ISO3-compatible code associated with that country. All of this information is represented as the CountryRegionInfoobject, which exposes several properties, such asEntityID,FriendlyName,Iso2,Iso3, andOfficialName. If you take the United States, for example, the country region information is organized as follows:

      Entity ID        244
      FriendlyName     United States
      Iso2             US
      Iso3             USA
      OfficialName     United States of America

    An instance of theCountryRegionInfoclass that represents a valid country/region also includes the centroid latitude/longitude of the country. The entity ID for the United States is 244, and it does not change across different versions of the MapPoint Web Service, so you can safely hardcode this ID into your applications for any United States–specific find queries.

    To get the country/region information using MapPoint Web Service, use theCommonServiceSoap.GetCountryRegionInfomethod:

      //Create Common Service SOAP Class instance
      CommonServiceSoap commonsoap = new CommonServiceSoap();
     
    //Assign credentials
      . . .

      //Get country region info
      CountryRegionInfo[] countryregioninfos =
              commonsoap.GetCountryRegionInfo(null);

      //Do some processing
      foreach(CountryRegionInfo crinfo in countryregioninfos)
     
    {
      
    . . .
      }

    TheGetCountryRegionInfomethod takes an array of entity IDs as integers; however, in the previous code example, I’m passingnullin order to get country/region information for all the countries listed in MapPoint Web Service. Similarly, if you want only country/region information for the United States, your call would look like this with 244 entity ID as an input argument:

      //Get country region info
      CountryRegionInfo[] countryregioninfos =
                commonsoap.GetCountryRegionInfo(new int[] {244});

    You get only oneCountryRegionInfoobject (that corresponds to the United States) back from this method.

    Note that since the list of county/region information does not change that frequently, it is good idea to store it in an in-memory data structure (such as aHashtablewith the entity ID as the key) in your applications to avoid round trips to the MapPoint Web Service.

    More BrainDump Articles
    More By O'Reilly Media


       · This article is an excerpt from the book "Programming MapPoint in .NET," published...
     

    Buy this book now. This article is excerpted from chapter six of the book Programming MapPoint in .NET, written by Chandu Thota (O'Reilly; ISBN: 0596009062). Check it out today at your favorite bookstore. Buy this book now.

    BRAINDUMP ARTICLES

    - Introduction to Office Live Workspace
    - Using MS Excel for One-way Analysis of Varia...
    - Comparing Data Sets Using Statistical Analys...
    - Import Blogger Posts into WordPress Using Wi...
    - Download WordPress from an FTP Server and Ru...
    - Install and Run WordPress in XAMPP Local Host
    - What Windows 7 Brings to the Table
    - Virtualization and Sandbox Detection
    - Advanced Firebug Techniques in Windows XP Ho...
    - Editing CSS with Firebug in Windows XP Home
    - Using Firebug in Windows XP Home
    - Migrating to Exchange Server 2007
    - Using System Restore on a Non-Bootable PC
    - Finding Logged on Users and More Scripting S...
    - Developing Macro Commands in MS Excel





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek