Hide

Updating Features

Existing features may be patched (updated) by sending a POST request to the /tables/tableId/features/batchPatch endpoint.

Limits

A single request can modify:

  • Up to 50 features.
  • A combined total of 10 000 vertices.

Request

The following HTTP request changes the coordinates property of feature 100 and the open property of feature 300.

POST https://www.googleapis.com/mapsengine/v1/tables/tableId/features/batchPatch
Authorization: Bearer token

{
  "features": [
    {
      "geometry": {
        "type": "Polygon",
        "coordinates": [[1.5, 3.5], [1.0, 1.0], [4.0, 1.0], [4.0, 4.0], [1.5, 3.5]]
      },
      "properties": {
        "gx_id": "100"
      }
    },
    {
      "properties": {
        "gx_id": "300",
        "open": "weekdays"
        }
      }
    }
  ]
}

Request body

Feature updates use HTTP PATCH semantics:

  • A supplied value replaces an existing value (if any) in that field.
  • Omitted fields remain unchanged.
  • Complex values in geometries and properties must be replaced as atomic units. For example, providing just the coordinates of a geometry is not allowed; the complete geometry, including type, must be supplied.
  • Setting a property's value to null deletes that property.

Each feature in an update request uses the following GeoJSON fields:

  • properties is required and must contain a valid primary key. This is either the contents of the primaryKey column you specified when creating the table, or the feature's gx_id if no primaryKey was specified.
  • If supplying additional key-value pairs within properties, and the value is a JSON object, the entire updated object must be supplied.
  • geometry (optional), if present and not null, must be complete. Partial patches are not supported for geometries.
  • type (optional), if provided, must be Feature.

There must be at least one modification specified for each feature. Providing a primary key but no modification is not supported.

Response

A successful update request returns HTTP status code 204 (No content). No response body is returned.

Errors

  • If the primary key is omitted, a required error is returned.
  • If the structure of the supplied coordinates field does not match the geometry's type, an invalid error type is returned.
  • Each property must exist as a key in the table's schema, and the associated column must be capable of storing the given value. Otherwise, an invalid error type is returned.

Send feedback about...

Google Maps Engine API (Deprecated)