ArcGIS for Elixir

View Source

Convenient access to Esri ArcGIS APIs for applications written in the Elixir programming language.

{:ok, portal} = ArcGIS.Portal.discover("https://arcgis.com")
{:ok, portal_info} = ArcGIS.Portal.self(portal)

{:ok, session_token} = ArcGIS.User.generate_token(user, password, portal)

service_params = %ArcGIS.Feature.Service.CreateParameters{name: "ExArcTest4"}
{:ok, service} = ArcGIS.Feature.Service.create(portal, service_params, auth_token: session_token)

{:ok, features} = ArcGIS.Feature.query(service, 0, limit: 2000, auth_token: session_token, geometry?: true)

Features

  • Portal
    • Both ArcGIS Online and Enterprise are supported
    • Service discovery via the self endpoint
    • HTTP GET and POST requests against a portal
    • Portal item queries
  • Feature services
    • Create, update, and delete feature services
    • Create, update, delete, and query features
    • Fetch the schema of a feature service

Telemetry

The following :telemetry messages are generated by this library:

  • [:arcgis, :request, :success]
  • [:arcgis, :request, :error]

To aid in developing with the ArcGIS library, calling ArcgIS.Utils.enable_local_telemetry(true) will cause telemetry messages to be printed to the local terminal.

Configuration

Runtime configuration is optional, as functions in the ArcGIS library accept an options keyword list parameter for passing in portal URLs, session tokens, etc.

However, a number of application defaults can be defined in configuration files (e.g. runtime.exs) under the arcgis key. These include:

  • portal: An ArcGIS.Portal struct containing default settings such as URLs used when accessing an ArcGIS Portal.
  • portal_client_id: The string to pass as the client ID to ArcGIS REST APIs.
  • default_query_timeout: The default query timeout in millseconds.
  • log_errors: Boolean, whether or not to write errors via Logger.
  • telemetry: Boolean, whether or not to emit :telemetry messages.

Testing

In tests, it may be desirable to not run queries against an actual ArcGIS portal. Network requests can be mocked by adding this to config/test.exs (or simlar):

config :arcgis, :req_defaults, plug: {Req.Test, ArcGIS}

Req.Test.stub can then be used in tests to create mock results, test assertions, etc.:

test "a test" do
  Req.Test.stub(ArcGIS, fn conn ->
    assert(conn.request_path == "/some/path")
    Req.Test.json(conn, "{}")
  end)

  ...
end

Issues

Find a bug or want to request a new feature? Please let us know by submitting an issue.

Contributing

Esri welcomes contributions from anyone and everyone. Please see our guidelines for contributing.

Licensing

Copyright 2026 Esri

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

A copy of the license is available in the repository's LICENSE.txt file.