Skip to content

Commit

Permalink
update suggest
Browse files Browse the repository at this point in the history
  • Loading branch information
davetimmins committed Oct 31, 2017
1 parent 2f30854 commit 1e3480e
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 17 deletions.
8 changes: 5 additions & 3 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
Why the change? Well there are 2 main reasons, the first is that this is now a netstandard library rather than a portable class library (PCL), so the old naming didn't really apply. Secondly, NuGet now has package Id reservations and so I can't use ArcGIS as the suffix anymore.

To migrate from ArcGIS.PCL to Anywhere.ArcGIS the following breaking changes need to be done / reviewed:
To migrate from [ArcGIS.PCL](https://github.com/davetimmins/ArcGIS.PCL/) to [Anywhere.ArcGIS](https://github.com/davetimmins/Anywhere.ArcGIS/) the following __breaking__ :boom: changes need to be done / reviewed:

- All namespaces have changed from `ArcGIS.ServiceModel.*` to `Anywhere.ArcGIS.*`.

- You no longer need to call the static `ISerializer` `Init()` method as JSON.NET is now baked in.
- You no longer need to call the static `ISerializer.Init()` method as JSON.NET is now baked in as the default.

- `SecurePortalGateway` has been renamed to just `PortalGateway`.

- Internally all requests now use an `ArcGISServerOperation` type, this allows before and after actions to be invoked for the HTTP request.

- Renamed `GdbVersion` to `GeodatabaseVersion`.
- Renamed `GdbVersion` to `GeodatabaseVersion`.

- Removed `Disabled` from `ICryptoProvider` and replaced it with `Enabled` which is `false` by default, so to opt in to trying to encrypt token requests (admin endpoint only) you now need to call `CryptoProviderFactory.Enabled = true;` once in your app code.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Supports the following as typed operations:
- `QueryForExtent` return the bounding extent for the result of the query operation
- `Find` search across _n_ layers and fields in a service
- `ApplyEdits` post adds, updates and deletes to a feature service layer
- `DeleteFeatures` delete features in a feature layer or table
- `Geocode` single line of input to perform a geocode using a custom locator or the Esri world locator
- `Suggest` lightweight geocode operation that only returns text results, commonly used for predictive searching
- `ReverseGeocode` find location candidates for a input point location
Expand Down
2 changes: 1 addition & 1 deletion src/Anywhere.ArcGIS/ArcGISOnlineAppLoginOAuthProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void Dispose()

public string RootUrl
{
get { return "https://www.arcgis.com/sharing/oauth2/token"; }
get { return "https://www.arcgis.com/sharing/rest/oauth2/token"; }
}

public bool CancelPendingRequests { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions src/Anywhere.ArcGIS/CryptoProviderFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ public static class CryptoProviderFactory
{
public static Func<ICryptoProvider> Get { get; set; }

public static bool Disabled { get; set; }
public static bool Enabled { get; set; }

static CryptoProviderFactory()
{
Get = (() => { return Disabled ? null : new RsaEncrypter(); });
Get = (() => { return Enabled ? new RsaEncrypter() : null; });
}
}

Expand Down
38 changes: 28 additions & 10 deletions src/Anywhere.ArcGIS/Operation/SingleInputGeocode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ public SingleInputGeocode(ArcGISServerEndpoint endpoint, Action beforeRequest =
public string SourceCountry { get; set; }

/// <summary>
/// The maximum number of results to be returned by a search, up to the maximum number allowed by the service.
/// If not specified, then one location will be returned.
/// The world geocoding service allows up to 20 candidates to be returned for a single request.
/// The maximum number of results to be returned by a search, up to the maximum number allowed by the service.
/// If not specified, then one location will be returned.
/// The world geocoding service allows up to 20 candidates to be returned for a single request.
/// Note that up to 50 POI candidates can be returned
/// </summary>
[DataMember(Name = "maxLocations")]
Expand All @@ -44,8 +44,8 @@ public SingleInputGeocode(ArcGISServerEndpoint endpoint, Action beforeRequest =
public string MagicKey { get; set; }

/// <summary>
/// A set of bounding box coordinates that limit the search area to a specific region.
/// This is especially useful for applications in which a user will search for places and addresses only within the current map extent.
/// A set of bounding box coordinates that limit the search area to a specific region.
/// This is especially useful for applications in which a user will search for places and addresses only within the current map extent.
/// </summary>
[DataMember(Name = "bbox")]
public Extent SearchExtent { get; set; }
Expand All @@ -60,10 +60,10 @@ public SingleInputGeocode(ArcGISServerEndpoint endpoint, Action beforeRequest =
public string OutFieldsValue { get { return OutFields == null ? string.Empty : string.Join(",", OutFields); } }

/// <summary>
/// The spatial reference of the x/y coordinates returned by a geocode request.
/// This is useful for applications using a map with a spatial reference different than that of the geocode service.
/// If the outSR is not specified, the spatial reference of the output locations is the same as that of the service.
/// The world geocoding service spatial reference is WGS84 (WKID = 4326).
/// The spatial reference of the x/y coordinates returned by a geocode request.
/// This is useful for applications using a map with a spatial reference different than that of the geocode service.
/// If the outSR is not specified, the spatial reference of the output locations is the same as that of the service.
/// The world geocoding service spatial reference is WGS84 (WKID = 4326).
/// </summary>
[DataMember(Name = "outSR")]
public SpatialReference OutputSpatialReference { get; set; }
Expand Down Expand Up @@ -93,7 +93,7 @@ public class Location
}

/// <summary>
/// Call the suggest method for a locator. This has the parameters used by the hosted world geocoding service at geocode.arcgis.com
/// Call the suggest method for a locator. This has the parameters used by the hosted world geocoding service at geocode.arcgis.com
/// </summary>
[DataContract]
public class SuggestGeocode : GeocodeOperation
Expand All @@ -102,13 +102,31 @@ public SuggestGeocode(ArcGISServerEndpoint endpoint, Action beforeRequest = null
: base(new ArcGISServerEndpoint(endpoint.RelativeUrl.Trim('/') + "/" + Operations.SuggestGeocode), beforeRequest, afterRequest)
{
Distance = null;
MaxSuggestions = 5;
}

/// <summary>
/// Specifies the location to be searched for.
/// </summary>
[DataMember(Name = "text")]
public string Text { get; set; }

/// <summary>
/// The maximum number of suggestions returned by a suggest operation, up to the maximum number allowed by the service.
/// The default value is 5.
/// </summary>
[DataMember(Name = "maxSuggestions")]
public int MaxSuggestions { get; set; }

/// <summary>
/// A set of bounding box coordinates that limit the search area for suggestions to a specific region.
/// This is especially useful for applications in which a user searches for places and addresses within the current map extent.
/// You can specify the spatial reference of the searchExtent coordinates,
/// which is necessary if the map spatial reference is different than that of the geocoding service;
/// otherwise, the spatial reference of the coordinates is assumed to be the same as that of the geocoding service.
/// </summary>
[DataMember(Name = "searchExtent")]
public Extent SearchExtent { get; set; }
}

[DataContract]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public class SecureGISGatewayTests : IClassFixture<IntegrationTestFixture>
public SecureGISGatewayTests(IntegrationTestFixture fixture, ITestOutputHelper output)
{
fixture.SetTestOutputHelper(output);
CryptoProviderFactory.Disabled = true;
}

[Theory]
Expand Down

0 comments on commit 1e3480e

Please sign in to comment.