Click here to Skip to main content
15,892,575 members
Articles / Programming Languages / C#

GeoNames .NET WCF Client

Rate me:
Please Sign up or sign in to vote.
4.40/5 (16 votes)
21 Apr 2009MIT3 min read 205K   3K   59  
A .NET WCF client for accessing the GeoNames services
#region Header
/////////////////////////////////////////////////////////////////////////////
//
// Myren.GeoNames.Client.GeoToponymSearchCriteria
//
//
// Authors: 
//   Dennis Myren
//   
//
/////////////////////////////////////////////////////////////////////////////
// 
// Copyright (c) 2008 Dennis Myren
// 
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
///////////////////////////////////////////////////////////////////////////////
#endregion // Header


using System;

using Myren.GeoNames.Client.Internal;


namespace Myren.GeoNames.Client
{

  /// <summary>
  /// Provides the criteria for a toponym search operation.
  /// </summary>
  public sealed class GeoToponymSearchCriteria
  {

    /// <summary>
    /// Creates a new instance of GeoToponymSearchCriteria.
    /// </summary>
    public GeoToponymSearchCriteria ( )
    {
    }


    /// <summary>
    /// Search over all attributes of a place:
    /// place name, country name, continent, admin codes, ...
    /// </summary>
    public string Query
    {
      get;
      set;
    }

    /// <summary>
    /// Place name.
    /// </summary>
    public string Name
    {
      get;
      set;
    }

    /// <summary>
    /// Exact place name.
    /// </summary>
    public string NameEquals
    {
      get;
      set;
    }

    /// <summary>
    /// The first characters of a place name.
    /// </summary>
    public string NameStartsWith
    {
      get;
      set;
    }

    /// <summary>
    /// The country. Default is all countries.
    /// </summary>
    public string Country
    {
      get;
      set;
    }

    /// <summary>
    /// The GeoNames feature code class.
    /// </summary>
    public string FeatureCode
    {
      get;
      set;
    }

    /// <summary>
    /// The name of the GeoNames feature code class.
    /// </summary>
    public string FeatureClass
    {
      get;
      set;
    }

    /// <summary>
    /// The first-order toponym.
    /// </summary>
    public string AdminCode1
    {
      get;
      set;
    }

    /// <summary>
    /// The second-order toponym.
    /// </summary>
    public string AdminCode2
    {
      get;
      set;
    }

    /// <summary>
    /// The third-order toponym.
    /// </summary>
    public string AdminCode3
    {
      get;
      set;
    }

    /// <summary>
    /// The fourth-order toponym.
    /// </summary>
    public string AdminCode4
    {
      get;
      set;
    }

    /// <summary>
    /// Toponyms tagged with this specific tag.
    /// </summary>
    public string Tag
    {
      get;
      set;
    }

    /// <summary>
    /// Used for paging results. If you want to get results 30 to 40, use startRow=30 and maxRows=10. Default is 0.
    /// </summary>
    public int StartIndex
    {
      get;
      set;
    }

    /// <summary>
    /// Place name and country name will be returned in the specified language. Default is English.
    /// Feature classes and codes are only available in English and Bulgarian.
    /// </summary>
    public string Culture
    {
      get;
      set;
    }

    /// <summary>
    /// The maximal number of rows in the document returned by the service. Default is 10.
    /// </summary>
    public int MaxRows
    {
      get
      {
        return _maxRows;
      }
      set
      {
        _maxRows = value;
      }
    }
    private int _maxRows = 10;

    /// <summary>
    /// Response verbosity; short, medium, long or full.
    /// </summary>
    public GeoStyle Style
    {
      get
      {
        return _style;
      }
      set
      {
        if ( !Enum.IsDefined ( typeof ( GeoStyle ), value ) )
          throw new ArgumentException ( SR.InvalidStyle, "value" );

        _style = value;
      }
    }
    private GeoStyle _style = GeoStyle.Full;


  }


}


By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The MIT License


Written By
Software Developer (Senior)
Norway Norway
Software Engineer at FAST, a Microsoft Subsidiary, in Oslo, Norway. Background in C++/PASCAL. Specialized in .NET and XML.

Comments and Discussions