geeViz.esriLib

ArcGIS / Esri REST services client for geeViz.

Bridges three Esri service types into the existing geeViz viewer with no JavaScript changes required. The viewer already supports both tileMapService (for raster tiles) and geoJSONVector (for vector features) layer types.

Service type

Mechanism

Image Service

Map.addTileLayer("<url>/tile/{z}/{y}/{x}")

Map Service (cached)

Map.addTileLayer(...) — same tile path

Feature Service (≤ max_features)

Fetch <url>/query?f=geojsonMap.addLayer(geojson_dict)

Feature Service (> max_features)

ValueError with remediation message

Public API — 7 functions + 1 constant:

import geeViz.esriLib as el

# Discover data on any ArcGIS Portal
results = el.searchPortal("naip 2023")                  # IIPP (default)
results = el.searchPortal("naip 2023", portal="agol")   # ArcGIS Online
results = el.searchPortal("naip 2023",
                          portal="https://myagency.gov/portal")

# Available portals
el.PORTALS.keys()   # iipp, agol, usgs, noaa, usfs, nasa

# Inspect any service
meta = el.getServiceMetadata("https://.../ImageServer")

# Add to the geeViz map (auto-dispatches by service type)
el.addEsriService(result_or_url)

# Or call the typed helpers directly
el.addEsriImageService("https://.../ImageServer", name="NAIP 2023")
el.addEsriFeatureService("https://.../FeatureServer/0",
                         max_features=2000, where="STATE='UT'")
el.addEsriMapService("https://.../MapServer")

Token-gated portals:

# Obtain a token first:
#   POST <portal>/sharing/rest/generateToken
#     username=...&password=...&client=requestip&expiration=60&f=json
token = "..."
el.searchPortal("classified data", token=token)
el.addEsriFeatureService(url, token=token)

Copyright 2026 Ian Housman

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

Module Attributes

PORTALS

Module-level dict mapping short names to portal base URLs.

Functions

addEsriFeatureService(url_or_result[, ...])

Fetch and add an ArcGIS Feature Service layer as a GeoJSON vector layer.

addEsriImageService(url_or_result[, ...])

Add an ArcGIS Image Service as an XYZ tile layer to the geeViz map.

addEsriMapService(url_or_result[, name, ...])

Add a cached ArcGIS Map Service as an XYZ tile layer to the geeViz map.

addEsriService(url_or_result[, viz_params, ...])

Auto-detect the Esri service type and call the appropriate add helper.

getServiceMetadata(url[, token])

Fetch and return the JSON metadata for any ArcGIS REST service.

searchPortal(query[, portal, limit, ...])

Search any ArcGIS Portal for hosted services.