/// <summary> /// Gets the spatial record parcel count within a specified polygon. /// </summary> /// <param name="authKey">The authentication key to access SWS.</param> /// <param name="polygonWkt">The polygon, in well-known text (WKT) format.</param> /// <param name="bundle">The bundle.</param> /// <param name="excludeNonSolicitationStates"> /// Exclude parcels in states in which owner cannot be solicited. /// </param> /// <returns>The number of parcels within the specified polygon.</returns> public int GetSpatialRecordParcelCount( string authKey, string polygonWkt, SpatialRecordBundle bundle = SpatialRecordBundle.SpatialRecordOGPremium, bool excludeNonSolicitationStates = false) { var polygon = this.wktReader.Read(polygonWkt); if (excludeNonSolicitationStates && this.nonSolicitationArea.Intersects(polygon)) { return(this.GetSpatialRecordParcels(authKey, polygonWkt, bundle, true).Length); } else { var content = new SpatialRecordPolygonRequest(authKey, polygonWkt, 1, 1, bundle); var request = this.CreateSpatialRecordTask(HttpMethod.Post, content); request.Wait(); var response = request.Result.Content.ReadAsAsync <SpatialRecordResponse>(); response.Wait(); return(response.Result.PageInfo.Length); } }
/// <summary> /// Gets the parcels within a specified polygon. /// </summary> /// <param name="polygonWkt">The polygon, in well-known text (WKT) format.</param> /// <param name="bundle">The bundle.</param> /// <param name="excludeNonSolicitationStates"> /// Exclude parcels in states in which owner cannot be solicited. /// </param> /// <returns>An array of <see cref="SpatialRecordParcel"/> instances.</returns> public SpatialRecordParcel[] GetSpatialRecordParcels( string polygonWkt, SpatialRecordBundle bundle = SpatialRecordBundle.SpatialRecordOGPremium, bool excludeNonSolicitationStates = false) { this.EnsureValidAuthKey(); return(this.GetSpatialRecordParcels(this.authKey, polygonWkt, bundle, excludeNonSolicitationStates)); }
/// <summary> /// Initializes a new instance of the <see cref="SpatialRecordPolygonRequest"/> class. /// </summary> /// <param name="authKey">The authentication key.</param> /// <param name="geometry">The polygon in well-known text (WKT) format.</param> /// <param name="pageNumber">The page number.</param> /// <param name="pageSize">The page size.</param> /// <param name="bundle">The bundle.</param> public SpatialRecordPolygonRequest( string authKey, string geometry, int pageNumber = 1, int pageSize = 50, SpatialRecordBundle bundle = SpatialRecordBundle.SpatialRecordOGPremium) : base(authKey, pageNumber, pageSize, bundle) { this.Geometry = geometry; }
/// <summary> /// Initializes a new instance of the <see cref="SpatialRecordRequest"/> class. /// </summary> /// <param name="authKey">The authentication key.</param> /// <param name="pageNumber">The page number.</param> /// <param name="pageSize">The page size.</param> /// <param name="bundle">The bundle.</param> protected SpatialRecordRequest( string authKey, int pageNumber = 1, int pageSize = 50, SpatialRecordBundle bundle = SpatialRecordBundle.SpatialRecordOGPremium) { this.AuthKey = authKey; this.Bundle = bundle.ToString(); this.PageNumber = pageNumber; this.PageSize = pageSize; }
/// <summary> /// Gets the parcels at a specified latitude/longitude. /// </summary> /// <param name="latitude">The latitude.</param> /// <param name="longitude">The longitude.</param> /// <param name="bundle">The bundle.</param> /// <param name="excludeNonSolicitationStates"> /// Exclude parcels in states in which owner cannot be solicited. /// </param> /// <returns>An array of <see cref="SpatialRecordParcel"/> instances.</returns> public SpatialRecordParcel[] GetSpatialRecordParcels( double latitude, double longitude, SpatialRecordBundle bundle = SpatialRecordBundle.SpatialRecordOGPremium, bool excludeNonSolicitationStates = false) { this.EnsureValidAuthKey(); return(this.GetSpatialRecordParcels( this.authKey, latitude, longitude, bundle, excludeNonSolicitationStates)); }
/// <summary> /// Initializes a new instance of the <see cref="SpatialRecordLatLongRequest"/> class. /// </summary> /// <param name="authKey">The authentication key.</param> /// <param name="latitude">The latitude.</param> /// <param name="longitude">The longitude.</param> /// <param name="pageNumber">The page number.</param> /// <param name="pageSize">The page size.</param> /// <param name="bundle">The bundle.</param> public SpatialRecordLatLongRequest( string authKey, double latitude, double longitude, int pageNumber = 1, int pageSize = 50, SpatialRecordBundle bundle = SpatialRecordBundle.SpatialRecordOGPremium) : base(authKey, pageNumber, pageSize, bundle) { this.Latitude = latitude; this.Longitude = longitude; }
/// <summary> /// Gets the parcels within a specified polygon. /// </summary> /// <param name="authKey">The authentication key to access SWS.</param> /// <param name="polygonWkt">The polygon, in well-known text (WKT) format.</param> /// <param name="bundle">The bundle.</param> /// <param name="excludeNonSolicitationStates"> /// Exclude parcels in states in which owner cannot be solicited. /// </param> /// <returns>An array of <see cref="SpatialRecordParcel"/> instances.</returns> public SpatialRecordParcel[] GetSpatialRecordParcels( string authKey, string polygonWkt, SpatialRecordBundle bundle = SpatialRecordBundle.SpatialRecordOGPremium, bool excludeNonSolicitationStates = false) { return(this.GetSpatialRecordParcels( authKey, HttpMethod.Post, (key, pageNumber) => new SpatialRecordPolygonRequest(key, polygonWkt, pageNumber, 50, bundle), excludeNonSolicitationStates)); }
/// <summary> /// Gets the parcels at a specified latitude/longitude. /// </summary> /// <param name="authKey">The authentication key to access SWS.</param> /// <param name="latitude">The latitude.</param> /// <param name="longitude">The longitude.</param> /// <param name="bundle">The bundle.</param> /// <param name="excludeNonSolicitationStates"> /// Exclude parcels in states in which owner cannot be solicited. /// </param> /// <returns>An array of <see cref="SpatialRecordParcel"/> instances.</returns> public SpatialRecordParcel[] GetSpatialRecordParcels( string authKey, double latitude, double longitude, SpatialRecordBundle bundle = SpatialRecordBundle.SpatialRecordOGPremium, bool excludeNonSolicitationStates = false) { return(this.GetSpatialRecordParcels( authKey, HttpMethod.Get, (key, pageNumber) => new SpatialRecordLatLongRequest(key, latitude, longitude, pageNumber, 50, bundle), excludeNonSolicitationStates)); }