Interpolate points

An interpolation analysis resulting in a new layer with predicted elevation values from point features in Oregon.

What is an interpolation analysis?

An interpolation analysis is the process of estimating and predicting the location of new features and attribute values by using point features with numeric fields. To execute the analysis, use the spatial analysis service and the InterpolatePoints.

interpolate points

Real-world examples of this analysis include the following:

  • Interpolating air quality, soil nutrients, and rainfall levels.
  • Predicting heavy metal concentrations.
  • Predicting earthquake magnitudes.

How to perform an interpolation analysis

The general steps to performing an interpolation analysis are as follows:

  1. Review the parameters for the InterpolatePoints operation.
  2. Send a request to get the spatial analysis service URL.
  3. Execute a job request with the following URL and parameters:
    • URL: https://<YOUR_ANALYSIS_SERVICE>/arcgis/rest/services/tasks/GPServer/InterpolatePoints/submitJob
    • Parameters:
      • inputLayer: Your points dataset as a hosted feature layer or feature collection.
      • field: The numeric field containing the values to interpolate.
      • outputName: A string representing the name of the hosted feature layer to return with the results.
  4. Check the status.
  5. Get the output layer results.

To see examples using ArcGIS API for Python, ArcGIS REST JS, and the ArcGIS REST API, go to Examples below.

URL request

Use dark colors for code blocksCopy
1
https://analysis3.arcgis.com/arcgis/rest/services/tasks/GPServer/CalculateDensity/submitJob?<parameters>

Required parameters

NameDescriptionExamples
fThe format of the data returned.f=json f=pjson
token

An access token (API key or OAuth 2.0) with the required Spatial Analysis > Feature analysis privilege.

token=<ACCESS_TOKEN>
inputLayerThe point feature collection or hosted feature layer.{url:"https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Average_temperature_Oregon/FeatureServer/0"}
fieldThe numeric field containing the values to interpolate.Elevation

Key parameters

NameDescriptionExamples
interpolateOptionA value declaring the preference for speed versus accuracy. The default is 5.1, 5, 9
classificationTypeDetermines how the predicted values will be classified into areas. The default is GeometricInterval.EqualArea, EqualInterval, GeometricInterval, Manual
classBreaksIf the classificationType is Manual, then provide the class break values as a list.[1,3,5]
boundingPolygonLayerThe layer specifying the polygons in which you want values to be interpolated.{url:"https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Delaware_County_Municipal_Boundaries/FeatureServer/0"}
outputNameA string representing the name of the hosted feature layer to return with the results. NOTE: If you do not include this parameter, the results are returned as a feature collection (JSON).{"serviceProperties": {"name": "<SERVICE_NAME>"}}
contextA bounding box or output spatial reference for the analysis."extent":{"xmin:", "ymin:", "xmax:", "ymax:"}

Code examples

Predict air quality

This example uses the InterpolatePoints operation to predict the air quality index (AQI) based on particle values that are 10 micrometers or smaller.

In the analysis, the inputLayer value is the AQI PM10 hosted feature layer. The DAILY_AQI_LEVEL is the field used to interpolate values.

Interpolation analysis showing the air quality indices for California.

APIs

ArcGIS API for PythonArcGIS API for PythonArcGIS REST JS
Expand
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
inputLayer = "https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/aqi_pm10/FeatureServer/0"
aoiLayer = "https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/California_State_Boundary/FeatureServer/0"

results = interpolate_points(
    input_layer=inputLayer,
    field="DAILY_AQI_VALUE",
    interpolate_option=5,
    classification_type="GeometricInterval",
    num_classes=10,
    bounding_polygon_layer=aoiLayer,
    output_prediction_error=False,
    #Outputs results as a hosted feature layer.
    output_name="Interpolate points result",
)

result_features = results["result_layer"].query()

print(
    f"The interpolate points layer has {len(result_features.features)} new records"
)

Service requests

Request
HTTPHTTPcURL
Use dark colors for code blocksCopy
1
2
3
4
5
POST arcgis.com/sharing/rest/portals/self HTTP/1.1
Content-Type: application/x-www-form-urlencoded

&f=json
&token=<ACCESS_TOKEN>
Response (JSON)
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
{
  "helperServices": {
    // Other parameters
    "analysis": {
      "url": "https://<YOUR_ANALYSIS_SERVICE>/arcgis/rest/services/tasks/GPServer"
    },
    "geoenrichment": {
      "url": "https://geoenrich.arcgis.com/arcgis/rest/services/World/GeoenrichmentServer"
    }
  }
}

Predict fuel prices

This example uses the InterpolatePoints operation to predict fuel prices in Madrid.

In the analysis, the inputLayer value is the Gasolineras hosted feature layer and the Precio_gas is the field used to interpolate values.

Interpolation analysis showing fuel prices (95) for Madrid and surrounding areas.

APIs

ArcGIS API for PythonArcGIS API for PythonArcGIS REST JS
Expand
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
results = interpolate_points(
    input_layer="https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Gasolineras/FeatureServer/0",
    field="Precio_gas",
    interpolate_option=5,
    classification_type="GeometricInterval",
    num_classes=10,
    #Outputs results as a hosted feature layer.
    output_name="Interpolate points results",
    context={
        "extent": {
            "xmin": -438873.975499999,
            "ymin": 4903874.0387,
            "xmax": -375084.7903,
            "ymax": 4945862.018,
            "spatialReference": {"wkid": 102100},
        },
    },
)

print(f"New item created : {results.itemid}")

Service requests

Request
HTTPHTTPcURL
Use dark colors for code blocksCopy
1
2
3
4
5
POST arcgis.com/sharing/rest/portals/self HTTP/1.1
Content-Type: application/x-www-form-urlencoded

&f=json
&token=<ACCESS_TOKEN>
Response (JSON)
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
{
  "helperServices": {
    // Other parameters
    "analysis": {
      "url": "https://<YOUR_ANALYSIS_SERVICE>/arcgis/rest/services/tasks/GPServer"
    },
    "geoenrichment": {
      "url": "https://geoenrich.arcgis.com/arcgis/rest/services/World/GeoenrichmentServer"
    }
  }
}

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.