ArcGIS Runtime SDK for iOS
100.15
|
A task to geocode and reverse-geocode addresses and places.
Instances of this class represent a task used to convert an address to a point (geocode) or vice-versa (reverse geocode). It also supports finding well known places and points of interest, and can provide suggestions character-by-character as a user types.
The task can be created for an ArcGIS Geocode service hosted in the cloud on ArcGIS Online or on-premises with ArcGIS Server. The task can also be created for a locator dataset stored locally on the device in which case it can used even when the device has no network connectivity.
Instance Methods | |
(void) | - cancelLoad |
(void) | - doCancelLoading |
(void) | - doStartLoading: |
(id< AGSCancelable >) | - geocodeWithSearchText:completion: |
(id< AGSCancelable >) | - geocodeWithSearchText:parameters:completion: |
(id< AGSCancelable >) | - geocodeWithSearchValues:completion: |
(id< AGSCancelable >) | - geocodeWithSearchValues:parameters:completion: |
(id< AGSCancelable >) | - geocodeWithSuggestResult:completion: |
(id< AGSCancelable >) | - geocodeWithSuggestResult:parameters:completion: |
(instancetype) | - initWithName: |
(instancetype) | - initWithURL: |
(void) | - loadDidFinishWithError: |
(void) | - loadWithCompletion: |
(void) | - onLoadStatusChanged |
(void) | - retryLoadWithCompletion: |
(id< AGSCancelable >) | - reverseGeocodeWithLocation:completion: |
(id< AGSCancelable >) | - reverseGeocodeWithLocation:parameters:completion: |
(id< AGSCancelable >) | - suggestWithSearchText:completion: |
(id< AGSCancelable >) | - suggestWithSearchText:parameters:completion: |
Class Methods | |
(instancetype) | + locatorTaskWithName: |
(instancetype) | + locatorTaskWithURL: |
Properties | |
NSString * | APIKey |
AGSCredential * | credential |
NSError * | loadError |
AGSLoadStatus | loadStatus |
AGSLocatorInfo * | locatorInfo |
AGSRequestConfiguration * | requestConfiguration |
NSURL * | URL |
|
requiredinherited |
Cancels loading if it is in progress, otherwise it does nothing. This should be called carefully because other objects could be waiting for loadWithCompletion:
or retryLoadWithCompletion:
to complete and this will call them all back with the error of NSUserCancelledError
- (void) doCancelLoading |
Never call this method directly. The framework calls this method on a background thread when cancelLoad (AGSLoadable-p)
is called. It is meant to be overriden by subclasses. Subclasses should override this method to cancel loading their data and call loadDidFinishWithError: (AGSLoadableBase(ForSubclassEyesOnly))
at the end passing in an error representing NSUserCancelledError
.
Provided by category AGSLoadableBase(ForSubclassEyesOnly).
- (void) doStartLoading: | (BOOL) | retrying |
Never call this method directly. The framework calls this method on a background thread when loadWithCompletion: (AGSLoadable-p)
or retryLoadWithCompletion: (AGSLoadable-p)
is called. It is meant to be overriden by subclasses. Subclasses should override this method to load their data and call loadDidFinishWithError: (AGSLoadableBase(ForSubclassEyesOnly))
upon completion, passing in the error if any.
retrying | flag that is true if this method was called from retryLoadWithCompletion: (AGSLoadable-p) . |
Provided by category AGSLoadableBase(ForSubclassEyesOnly).
- (id<AGSCancelable>) geocodeWithSearchText: | (NSString *) | searchText | |
completion: | (void(^)(NSArray< AGSGeocodeResult * > *__nullable geocodeResults, NSError *__nullable error)) | completion | |
Perform a geocode operation to find location candidates for the provided text.
searchText | to geocode. Can be an address (such as "380 New York St" or "380 New York St, Redlands, California, 92373") or the name of a well known place (such as "Disneyland") |
completion | block that is invoked when the operation completes. The results are populated if the operation succeeds, else the error is populated if the operation fails. |
- (id<AGSCancelable>) geocodeWithSearchText: | (NSString *) | searchText | |
parameters: | (AGSGeocodeParameters *) | parameters | |
completion: | (void(^)(NSArray< AGSGeocodeResult * > *__nullable geocodeResults, NSError *__nullable error)) | completion | |
Perform a geocode operation to find location candidates for the provided text.
searchText | to geocode. Can be an address (such as "380 New York St" or "380 New York St, Redlands, California, 92373") or the name of a well known place (such as "Disneyland") |
parameters | to refine the results returned |
completion | block that is invoked when the operation completes. The results are populated if the operation succeeds, else the error is populated if the operation fails. |
- (id<AGSCancelable>) geocodeWithSearchValues: | (NSDictionary< NSString *, NSString * > *) | searchValues | |
completion: | (void(^)(NSArray< AGSGeocodeResult * > *__nullable geocodeResults, NSError *__nullable error)) | completion | |
Perform a geocode operation to find location candidates for the provided values of a multi-line address.
searchValues | to geocode. Each value represents an individual address component of a multi-line address. The address components supported are defined by AGSLocatorInfo::searchAttributes . The key of this dictionary should match AGSLocatorAttribute::name , and the value in the input for that address component. |
completion | block that is invoked when the operation completes. The results are populated if the operation succeeds, else the error is populated if the operation fails. |
- (id<AGSCancelable>) geocodeWithSearchValues: | (NSDictionary< NSString *, NSString * > *) | searchValues | |
parameters: | (AGSGeocodeParameters *) | parameters | |
completion: | (void(^)(NSArray< AGSGeocodeResult * > *__nullable geocodeResults, NSError *__nullable error)) | completion | |
Perform a geocode operation to find location candidates for the provided values of a multi-line address.
searchValues | to geocode. Each value represents an individual address component of a multi-line address. The address components supported are defined by AGSLocatorInfo::searchAttributes . The key of this dictionary should match AGSLocatorAttribute::name , and the value in the input for that address component. |
parameters | to refine the results returned |
completion | block that is invoked when the operation completes. The results are populated if the operation succeeds, else the error is populated if the operation fails. |
- (id<AGSCancelable>) geocodeWithSuggestResult: | (AGSSuggestResult *) | suggestResult | |
completion: | (void(^)(NSArray< AGSGeocodeResult * > *__nullable geocodeResults, NSError *__nullable error)) | completion | |
Perform a geocode operation to find location candidates for a suggestion provided by suggestWithSearchText:completion:
suggestResult | suggestion to geocode |
completion | block that is invoked when the operation completes. The results are populated if the operation succeeds, else the error is populated if the operation fails. |
- (id<AGSCancelable>) geocodeWithSuggestResult: | (AGSSuggestResult *) | suggestResult | |
parameters: | (AGSGeocodeParameters *) | parameters | |
completion: | (void(^)(NSArray< AGSGeocodeResult * > *__nullable geocodeResults, NSError *__nullable error)) | completion | |
Perform a geocode operation to find location candidates for a suggestion provided by suggestWithSearchText:parameters:completion:
suggestResult | suggestion to geocode |
parameters | to refine the results returned. Note: The parameters must match the original criteria specified in the AGSSuggestParameters , if suggestWithSearchText:parameters:completion: was used to produce the suggestResult |
completion | block that is invoked when the operation completes. The results are populated if the operation succeeds, else the error is populated if the operation fails. |
- (instancetype) initWithName: | (NSString *) | name |
Initialize the task with the name of a locator dataset within the application bundle or shared documents directory.
name | of the locator dataset (same as the name of the .loc file without the file extension) |
- (instancetype) initWithURL: | (NSURL *) | URL |
Initialize the task with a URL to a remote ArcGIS Geocode service or a locator dataset (.loc file) on disk.
URL | to a remote ArcGIS Geocode service or a locator dataset (.loc file) on disk. |
- (void) loadDidFinishWithError: | (nullable NSError *) | error |
Only subclasses should call this method in doStartLoading: (AGSLoadableBase(ForSubclassEyesOnly))
and doCancelLoading (AGSLoadableBase(ForSubclassEyesOnly))
when done loading or failed to load.
Provided by category AGSLoadableBase(ForSubclassEyesOnly).
|
requiredinherited |
Loads data for the object asynchronously. The completion block is invoked upon completion.
You can call this method any number of times, however only one attempt is made to load the data. If it is already loading, it will just continue to load (i.e. not force a reload). If it has already loaded successfully, the completion block will be invoked right away. If it has already failed to load, the completion block will be invoked right away with error previously encountered. This method supports multiple callers and will call them all back on completion. However, each caller's completion block will be invoked once and only once.
completion | block that is invoked when object loads successfully or fails to load. An error is passed to the block if the object fails to load. |
- cancelLoad
to cancel loading - retryLoadWithCompletion:
to force reload + (instancetype) locatorTaskWithName: | (NSString *) | name |
Initialize the task with the name of a locator dataset within the application bundle or shared documents directory.
name | of the locator dataset (same as the name of the .loc file without the file extension) |
+ (instancetype) locatorTaskWithURL: | (NSURL *) | URL |
Initialize the task with a URL to a remote ArcGIS Geocode service or a locator dataset (.loc file) on disk.
URL | to a remote ArcGIS Geocode service or a locator dataset (.loc file) on disk. |
- (void) onLoadStatusChanged |
Never call this method directly. The framework calls this method on a background thread when AGSLoadable::loadStatus
changes is called. Subclasses can optionally implement this to know when their loading status has changed.
Provided by category AGSLoadableBase(ForSubclassEyesOnly).
|
requiredinherited |
Tries to reload when an object has failed to load. This method should be called judiciously. It should be called when:
cancelLoad
and then this methodIf the data hasn't started loading, it will start loading. If it is already loading, it will just continue to load. If it has already loaded successfully, calls back right away. If it has already failed to load, tries again. This method supports multiple callers and will call them all back on completion. However, each caller's completion block will be invoked once and only once.
completion | block that is invoked when object loads successfully or fails to load. An error is passed to the block if the object fails to load. |
- (id<AGSCancelable>) reverseGeocodeWithLocation: | (AGSPoint *) | location | |
completion: | (void(^)(NSArray< AGSGeocodeResult * > *__nullable geocodeResults, NSError *__nullable error)) | completion | |
Perform a reverse geocode operation to find address candidates for the provided location.
location | to reverse geocode |
completion | block that is invoked when the operation completes. The results are populated if the operation succeeds, else the error is populated if the operation fails. |
- (id<AGSCancelable>) reverseGeocodeWithLocation: | (AGSPoint *) | location | |
parameters: | (AGSReverseGeocodeParameters *) | parameters | |
completion: | (void(^)(NSArray< AGSGeocodeResult * > *__nullable geocodeResults, NSError *__nullable error)) | completion | |
Perform a reverse geocode operation to find address candidates for the provided location.
location | to reverse geocode |
parameters | to refine the results returned |
completion | block that is invoked when the operation completes. The results are populated if the operation succeeds, else the error is populated if the operation fails. |
- (id<AGSCancelable>) suggestWithSearchText: | (NSString *) | searchText | |
completion: | (void(^)(NSArray< AGSSuggestResult * > *__nullable suggestResults, NSError *__nullable error)) | completion | |
Suggest address and returns possible variants. Geocoding suggestions provide a mechanism for implementing character-by-character auto-complete. Using a text input and optional AGSSuggestParameters
, suggested addresses can be quickly found and presented to the user. Suggestions are not limited to addresses, they can also be used for POIs (Points of Interest). To return a focused set of suggestions, set the AGSSuggestParameters::preferredSearchLocation
or the AGSSuggestParameters::searchArea
. Using the AGSSuggestParameters::preferredSearchLocation
is similar to how ArcGIS Pro limits the suggestions returned.
searchText | to find suggestions for |
completion | block that is invoked when the operation completes. The results are populated if the operation succeeds, else the error is populated if the operation fails. |
- (id<AGSCancelable>) suggestWithSearchText: | (NSString *) | searchText | |
parameters: | (AGSSuggestParameters *) | parameters | |
completion: | (void(^)(NSArray< AGSSuggestResult * > *__nullable suggestResults, NSError *__nullable error)) | completion | |
Suggest address with parameters and returns possible variants. Geocoding suggestions provide a mechanism for implementing character-by-character auto-complete. Using a text input and optional AGSSuggestParameters
, suggested addresses can be quickly found and presented to the user. Suggestions are not limited to addresses, they can also be used for POIs (Points of Interest). To return a focused set of suggestions, set the AGSSuggestParameters::preferredSearchLocation
or the AGSSuggestParameters::searchArea
. Using the AGSSuggestParameters::preferredSearchLocation
is similar to how ArcGIS Pro limits the suggestions returned.
searchText | to find suggestions for |
parameters | to refine the results returned. |
completion | block that is invoked when the operation completes. The results are populated if the operation succeeds, else the error is populated if the operation fails. |
|
readwriterequirednonatomiccopyinherited |
The API key to access API key enabled services and resources in ArcGIS Online.
An API key is a unique key used to authorize access to specific services and resources in ArcGIS Online. It is also used to monitor access to those services. An API key is created and managed in the ArcGIS developer dashboard and is tied to a specific ArcGIS account.
In addition to setting an API key at a global level for your application using the AGSArcGISRuntimeEnvironment::APIKey
property, you can set an AGSAPIKeyResource::APIKey
property on any ArcGIS Runtime class that implements AGSAPIKeyResource
. When you set an individual AGSAPIKeyResource::APIKey
property on an AGSAPIKeyResource
it will override the default key at the global level (on the AGSArcGISRuntimeEnvironment::APIKey
property, in other words), enabling more granular usage telemetry and management for ArcGIS Online resources used by your app. Classes that expose an API key property by implementing AGSAPIKeyResource
include:
|
readwritenonatomicstronginherited |
Security credentials to access the remote resource. Only applicable if the resource is secured.
|
readnonatomicstronginherited |
The error that was encountered during the most recent load operation. Will be nil if the operation succeeded.
|
readrequirednonatomicassigninherited |
Status of the load operation.
|
readnonatomicstrong |
Metadata about the ArcGIS Geocode service or locator dataset being used by the task
|
readwritenonatomicstronginherited |
The AGSRequestConfiguration object which defines the behavior and policies to use when accessing the remote resource. The default will be nil. If it is nil the [AGSRequestConfiguration globalConfiguration] will be used.
|
readrequirednonatomicstronginherited |
The URL of the remote resource.