BrainDump
  Home arrow BrainDump arrow Page 4 - Finding Entities with the MapPoint Web Ser...
Iron Speed
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  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Download TestComplete 
Windows Web Hosting
 
IBM® developerWorks 
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

Finding Entities 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-28

    Table of Contents:
  • Finding Entities with the MapPoint Web Service Find APIs
  • Finding entity by properties
  • Finding Polygons
  • Getting Entities from Latitude/Longitude

  • 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
     
     
    Iron Speed
     
    ADVERTISEMENT

    Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!

    Finding Entities with the MapPoint Web Service Find APIs - Getting Entities from Latitude/Longitude
    (Page 4 of 4 )

    We have looked at find service methods that take place names and addresses and return the corresponding latitude/longitude and other entity information. To find entity (or address) information for any given latitude/longitude, use the FindServiceSoap.GetLocationInfo; it gives you entity information for any given latitude and longitude. The GetLocationInfo method takes theGetInfoOptionsobject as an argument, along with a latitude/longitude and a data source name as a string. TheGetLocationInfoobject gives you control to decide which entity types you want using theGetInfoOptions.EntityTypesToReturnfield; you also have the option to obtain addresses for a given latitude/longitude (if available) using theGetInfoOptions. IncludeAddressesflag. The following code shows how to use theGetLocationInfo method:

      //Create a find service soap proxy
      FindServiceSoap findService = new FindServiceSoap();
      //Take an example lat long information that you want to
      //find using GetLocationInfo
      LatLong latlong = new LatLong();
      latlong.Latitude = 47.682;
      latlong.Longitude = -122.132;

      //Define get info options object
      GetInfoOptions options = new GetInfoOptions();
      //I'm looking only for cities
      options.IncludeAllEntityTypes = false;
      options.EntityTypesToReturn = new string[] {"PopulatedPlace"};

      //Define a field to hold returned 
    locations
      Location[] returnedLocations;
      //Call GetLocationInfo with "MapPoint.NA" data source
      returnedLocations = findService.GetLocationInfo(latlong, "MapPoint.NA", options);
      //Get entity information
      for(int i = 0; i < returnedLocations.Length; i++)
      {
        
    Console.WriteLine(returnedLocations[i].Entity.DisplayName);
      }

    When I’m querying for corresponding entities for the latitude/longitude, I limit my query to a city (the entity namePopulatedPlace) using theEntityTypesToReturnfield; it is important to remember that you must set theIncludeAllEntityTypesto false when you request specific entities.

    This method is not a direct inverse to theFindServiceSoap.FindAddressmethod, so if you call theFindServiceSoap.FindAddressmethod to obtain latitude/longitude for an address and pass that latitude/longitude to theFindServiceSoap.GetLocationInfomethod, the resulting address won’t match your original address because of the internal representation of the address data; in MapPoint data sources, addresses are stored in address range blocks along the streets, and the interpolation algorithms are used to calculate the address for a given latitude/longitude and vice versa. So, the addresses returned by theFindServiceSoap.GetLocationInfoare approximations of the original address; in fact, this method returns an array of four possible addresses for any given latitude/longitude in increasing order of the distance from the given latitude/longitude.

    Please check back next week for the conclusion to this article.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · 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

    - Multiple Service Contracts and Indigo
    - Cleaning Out Your Programs in XP
    - Handling Metadata with Indigo
    - Building Blocks for a WCF Service Web Site
    - Help! I Need Some Remote Assistance
    - Using Service Templates with Indigo
    - Windows XP Tips for Task Manager
    - Generating Clients and Services with Indigo
    - Vista SP1, A Review
    - Services and the WCF
    - VBScript: Final Date Functions
    - Creating Services with the WCF
    - The Resource View of the MFC
    - VBScript: More Fun with the Date Functions
    - Vista Price Cuts Dissected




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway