BrainDump
  Home arrow BrainDump arrow Page 2 - Finding Entities with the MapPoint Web Ser...
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 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
     
     
    ADVERTISEMENT


    Finding Entities with the MapPoint Web Service Find APIs - Finding entity by properties


    (Page 2 of 4 )

    Many times, you want to query for entities based on their properties—for example, finding all ATMs in the city of Chicago, or all coffee shops that accept credit cards. In this case, the query is based solely on the entity properties, and you should use the FindServiceSoap.FindByProperty method for this purpose. The FindByProperty method takes a specification object of type FindByPropertySpecification, which takes the queries to find entities using their properties. Table 6-7 shows the fields exposed on theFindByPropertySpecificationobject.

    Table 6-7. Fields in the FindByPropertySpecification object

    Field Description
    DataSourceName Name of the data source as a string
    Filter The filter (FindFilterobject) to apply to the results; that is, the specific entity type, properties, and values that the returned results must match
    Options The search options (FindOptionsobject), which may include the range of results and a flag to identify which objects are desired in the returned results

    The following code shows how to use these expressions to find entities using theFindByPropertymethod:

      //Create a find service soap proxy class
      FindServiceSoap findService = new FindServiceSoap();
      //Assign credentials
      . . .

      //Create find by property specification
      FindByPropertySpecification findbypropspec = new FindByPropertySpecification();

      //Define find by property specification
      findbypropspec.DataSourceName = "MapPoint.FourthCoffeeSample";
      //Assign a filter
      findbypropspec.Filter = new FindFilter();
      //Specify the entity type that you are looking for
      findbypropspec.Filter.EntityTypeName = "FourthCoffeeShops";

      //Now define and assign the expression
      findbypropspec.Filter.Expression = new FilterExpression();
      findbypropspec.Filter.Expression.Text = "PrimaryCity = {0} AND IsWiFiHotSpot"; 
      findbypropspec.Filter.Expression. Parameters = new object[] {"Chicago"};

      FindResults foundResults;
      foundResults = findService.FindByProperty(findbypropspec);

    The resulting expression from this code is"PrimaryCity = 'Chicago' AND IsWiFiHotSpot", which means to return only coffee shops in the city of Chicago that have WiFi Hotspots available. Even though the filter expressions look and behave like SQL expressions, there are limitations that you need to be aware of:

    1. The expression text should never contain the values that are being compared, but the text must provide the placeholders for all non-Boolean value types. Placeholders are represented by “{nn}” where n is an integer between 0 and 9.
    2. The comparison operators LIKE and NOT LIKE support only the “Starts with” condition.
    3. Maximum length of the expression text is limited to 2,000 characters.
    4. No more than one level of nesting (parenthesis) is allowed.
    5. A maximum of 10 non-Boolean comparisons and a maximum of 10 sub-clauses are allowed.
    6. A maximum of 50 total comparisons per expression is allowed.

    Next, let’s look at an example expression: you want to find all coffee shops in the city of Chicago that have a seating capacity greater than 20 or that are open 24 hours a day whose names start with the letter C. The expression to pass for theFindByPropertymethod would be:(City={0} AND SeatingCapacity>{1}) OR (StoreType={2} AND Name LIKE {3}) with the arguments Chicago, 20, Open 24 Hours and C.

    Now that you know how to use the find service APIs, let’s look at some of the common service methods that are relevant to the finding places, addresses, and entities.

    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 4 Hosted by Hostway
    Stay green...Green IT