1 rating
  • 1
  • 2
  • 3
  • 4
  • 5
5 star 1
4 star 0
3 star 0
2 star 0
1 star 0
Compatible with
  • iOS
  • Android

ArcGIS.PCL 5.0.3

Dave Timmins

Use ArcGIS Server REST types and resources without an official SDK. You can also convert between ArcGIS Features and GeoJSON.

ArcGIS.PCL can be used to call ArcGIS Server resources, including those from Portal for ArcGIS and ArcGIS Online. The resources can be secure or unsecure and the ArcGIS Online token service and OAuth token service are supported.

Available operations available are:

  • CheckGenerateToken - create a token automatically via an ITokenProvider
  • Query<T> - query a layer by attribute and / or spatial filters
  • QueryForCount - only return the number of results for the query operation
  • QueryForIds - only return the ObjectIds for the results of the query operation
  • Find - search across n layers and fields in a service
  • ApplyEdits<T> - post adds, updates and deletes to a feature service layer
  • Geocode - single line of input to perform a geocode usning 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
  • Simplify<T> - alter geometries to be topologically consistent
  • Project<T> - convert geometries to a different spatial reference
  • Buffer<T> - buffers geometries by the distance requested
  • DescribeSite - returns a url for every service discovered
  • Ping - verify that the server can be accessed

REST admin operations:

  • PublicKey - admin operation to get public key used for encryption of token requests
  • ServiceStatus - admin operation to get the configured and actual status of a service
  • ServiceReport - admin operation to get the service report
  • StartService - admin operation to start a service
  • StopService - admin operation to stop a service

In addition to these you can use it to convert between GeoJSON and ArcGIS JSON features.

To get started with ArcGIS.PCL first create an ISerializer implementation. There is a Json.NET implementation packaged with the component that will be used by default if you initialise it

Json.NET ISerializer initialisation

ArcGIS.ServiceModel.Serializers.JsonDotNetSerializer.Init();

To call ArcGIS Server resources you can create a gateway. You pass in the root url of the ArcGIS Server that you want to call operations against. There are a mixture of secure, non secure and ArcGIS Online base classes available.

ArcGIS Server gateway

// ArcGIS Server with non secure resources
var gateway = new PortalGateway("http://sampleserver3.arcgisonline.com/ArcGIS/");

// ArcGIS Server with secure resources
var secureGateway = new SecurePortalGateway("http://serverapps10.esri.com/arcgis", "user1", "pass.word1");

// ArcGIS Server with secure resources and token service at different location
var otherSecureGateway = new PortalGateway("http://sampleserver3.arcgisonline.com/ArcGIS/", tokenProvider: new TokenProvider("http://serverapps10.esri.com/arcgis", "user1", "pass.word1"));

// ArcGIS Online either secure or non secure
var arcgisOnlineGateway = new ArcGISOnlineGateway();

var secureArcGISOnlineGateway = new ArcGISOnlineGateway(tokenProvider: new ArcGISOnlineTokenProvider("user", "pass"));

var secureArcGISOnlineGatewayOAuth = new ArcGISOnlineGateway(tokenProvider: new ArcGISOnlineAppLoginOAuthProvider("clientId", "clientSecret"));

Once you have a gateway you can call operations on it, for example to query an endpoint

var queryPoint = new Query(@"Earthquakes/EarthquakesFromLastSevenDays/MapServer/0".AsEndpoint());

var resultPoint = await gateway.Query<Point>(queryPoint);

Icon

Icon made by Freepik from www.flaticon.com

Release Notes

5.0.2

  • Xamarin Unified API support

5.0.1

  • Added SiteReport admin operation
  • Added StartService admin operation
  • Added StopService admin operation
  • Added hypermedia self links to responses if enabled using PortalGateway IncludeHypermediaWithResponse flag
  • Added ObjectID and GlobalID getters to Feature
  • Added new ITokenProvider types for generating tokens for services when federated with Portal for ArcGIS or ArcGIS Online
  • Better error messages for ApplyEdits
  • Added ExpiresAt property for Token
  • Modified DescribeSite for ArcGIS Online gateway when no username is used
  • Fixed issue with DescribeSite for secured folder
  • Updated NuGet package references
  • Added automatic encryption of tokens if supported by the server, requires access to the admin REST API
  • Added ServiceStatus admin operation
  • Added PublicKey admin operation
  • Added DescribeSite for ArcGISOnline gateway - returns the hosted feature services for the user
  • Added operation overloads to gateway implementations for accepting a CancellationToken

Breaking changes:

  • added Links property to IPortalResponse interface
  • change all ObjectID types to long (was int)
  • Rename SecureArcGISServerGateway to SecurePortalGateway
  • changed ArcGISServerOperation signature
  • DescribeSite returns different response, has more data
  • ITokenProvider now has an ICryptoProvider and username, CheckGenerateToken now takes a CancellationToken as an input parameter
  • Split operations amongst various gateway classes as not all the operations apply to them so this prevents unwanted operations being called, in theory at least :)

3.2.2

  • Fixed issue calling geometry server operations when using an ArcGISOnlineGateway
  • Fixed issue when HTTP calls were cancelled
  • Handle CancellationTokenSource for operations

3.2.1

  • Added all typed operations to PortalGateway
  • Removed access restrictions for PortalGateway
  • Updated ModernHttpClient to v2.0.0

3.1.0

  • Updated version to match NuGet package
  • Added OAuth token provider for ArcGIS Online
  • Updated dependencies to only require minimum when installing
  • Fixed issue checking null referer for generate token request
  • Split out purely portable code
  • Added Json.NET ISerializer as a default implementation
Be the first to write a review