BrainDump
  Home arrow BrainDump arrow Page 4 - Finding Locations 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

Finding Locations 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-21

    Table of Contents:
  • Finding Locations with the MapPoint Web Service Find APIs
  • Finding Addresses
  • Finding Points of Interest Around a Location
  • Finding Points of Interest Along a Route

  • 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


    Finding Locations with the MapPoint Web Service Find APIs - Finding Points of Interest Along a Route


    (Page 4 of 4 )

    To find points of interest along a given route, use the FindServiceSoap.FindNearRoute method. The FindNearRoute method works only with data sources that have the CanFindNearby capability. As with the FindNearby method, only the point of interest data sources supplied by data vendors such as NavTeq and Acxiom have this capability; data sources such as MapPoint.NA and MapPoint.EU do not support the FindNearRoute method.

    You can read more about calculating routes using RouteServiceSoap in Chapter 7.

    Like any other find service method, the FindNearRoute method also takes a specification of type FindNearRouteSpecification class. The FindNearRouteSpecification object takes information, such as the data source name, input route (as a Route object) around which you want to find points of interest, and distance to be covered along the route, and uses it to find points of interest and entity types you want to find. Table 6-5 gives an idea of the fields presented in the FindNearRouteSpecification object.

    Table 6-5. Fields in a FindNearRouteSpecification object

    Field Description
    DataSourceName The data source name as a string
    Distance The distance from the Route property
    Filter The filter ( FindFilter object) to apply to the results; that is, the specific entity type, properties, and values that the returned results must match
    Route The route from which the points of interest are searched
    Options The search options ( FindOptions object), which include the range of results and a flag to identify which objects are desired in the returned results

    Say you want to find all the coffee shops along the route that you are planning for a road trip. First, calculate your route using the RouteServiceSoap class; next, call the FindServiceSoap.FindNearRoute with one of the point of interest data sources (I chose to use MapPoint.FourthCoffeeSample ) and the entity type name for coffee shops, FourthCoffeeShops , as follows:

      FindServiceSoap findService =
                        new FindServiceSoap();
      findService.Credentials =
                new System.Net.NetworkCredential(myMapPointUserId,
                              mySecurePassword);

      RouteServiceSoap routeService = new RouteServiceSoap();
      routeService.Credentials =
                new System.Net.NetworkCredential(myMapPointUserId,
                             mySecurePassword);

      //Route between two locations
      LatLong[] latLongs = new LatLong[2];
      latLongs[0] = new LatLong();
      latLongs[1] = new LatLong();
      latLongs[0].Latitude = 52.5;
      latLongs[0].Longitude = 13.1;
      latLongs[1].Latitude = 52.51;
      latLongs[1].Longitude = 13.11;

      //Calculate route
      Route myRoute =
      routeService.CalculateSimpleRoute(latLongs,
                              
    "MapPoint.EU",
                   
    SegmentPreference.Quickest);

      //Create near route specificiation
      FindNearRouteSpecification findnearroutespec =
              
    new FindNearRouteSpecification();

      findnearroutespec.DataSourceName = "MapPoint.FourthCoffeeSample";
      findnearroutespec.Filter = new FindFilter();
      findnearroutespec.Filter.EntityTypeName = "FourthCoffeeShops";
      findnearroutespec.Distance = 20;
      findnearroutespec.Route = myRoute;

      FindResults foundResults;
     
    foundResults = findService.FindNearRoute(findnearroutespec);

      //Process the results to display on a map
      ...

    This code finds the coffee shops around the specified route within 20 miles from the beginning of the route using the MapPoint.FourthCoffeeSample data source; you could use different point of interest data sources from Acxiom or NavTech or even your own data source.

    Finally, note that the distance must always be greater than 0.1 miles (0.160934 kilo meters) and less than 25 miles (40.2336 kilometers).

    Please check back next week for the continuation of 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

    - Are Microsoft Certifications Worth the Cost ...
    - Microsoft, NSF Open Cloud Computing to Scien...
    - Windows 7 Grabs One-Tenth of Market
    - Windows Mobile 7
    - Commands in WPF
    - Routing Events in WPF
    - Property Value Inheritance and More WPF Conc...
    - Important New Concepts in WPF
    - 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





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