Find Nearby Features REST Server Object Extension


Purpose
The purpose of this sample is to demonstrate use of a REST Server Object Extension that has 1 sub-resource and 1 operation.
The sub-resource is called "featureLayers" and displays all feature layers in associated map service. This subresource does not display layers of other types such as raster. The operation called "findNearbyFeatures" finds features near user-specified location and takes in a layer Id (picked from the feature layer list shown by featureLayers sub-resource), a location (x, y coordinates and spatial reference) and the distance to indicate how wide a net should be cast.
 
The sub-resource and operation return information in JSON format, and thus could be easily consumed in a Web API app .

How to use

See How to use ArcGIS samples for help on running the sample.

How to use this sample?
  1. Deploy the lib/JavaFindNearbyFeaturesRESTSOE.soe file to Server. For instructions on how to deploy an SOE to ArcGIS 10.1 Server, please see the "Developing Extensions" -> "Server Object Extensions" -> "Deploying and Un-deploying SOEs" topic in the ArcGIS Java Developer Help.
  2. Enable the SOE on map service of your choice. For instructions on how to enable SOE on a map service, please see the "Developing Extensions" -> "Server Object Extensions" -> "Enabling and Disabling SOEs" topic in the ArcGIS Java Developer Help. Please ensure that the map service has at least 1 feature layer.
  3. After the map service has started with SOE enabled on it, open up Services Directory web app and access the http://<server name>:6080/arcgis/rest/services page
  4. Click on the map service you enabled your SOE on.
  5. Scroll down and click on the JavaFindNearbyFeaturesRESTSOE listed in "Supported Extensions" section. If you don't find your REST SOE listed here, please log in as admin into the Services Directory web app and clear the REST cache. Repeat steps 3,4, and 5.
  6. The JavaFindNearbyFeaturesRESTSOE web page displays root resource details such as name and description, along with the "Child Resources" and "Supported Operations" sections.
  7. Click the "featureLayers" sub-resource. All feature layers in associated map service will be displayed. Record id of one of the layers for use in the operation below.
  8. Navigate back to the SOE web page and click on the "findNearbyFeatures" operation.
  9. Provide the following information to this operation: the layer id you recorded earlier in step 7, the location in JSON format, such as {"x": <x-value>, "y": <y-value>, "spatialReference": {"wkid": <sp ref id of map>}}, and distance in feet, such as 500. Click the "findNearbyFeatures(GET)" or "findNearbyFeatures(POST)" button. All features within 500 feet of your location will be returned.

If you installed the samples feature, you will find the files associated with this sample in <Your Developer Kit install location>\DeveloperKit10.4\Java\Samples\ArcObjects.

soe/JavaFindNearbyFeaturesSOE.java The FindNearbyFeatures Java Server Object Extension class.
lib/JavaFindNearbyFeaturesRESTSOE.soe The .soe file that contains this Server Object Extension




Development licensing Deployment licensing
Server Server