georest
Python clients for geospatial REST APIs: ArcGIS Image, Map and Feature Services, ArcGIS Portal search, the USFS Enterprise Data Warehouse (EDW), Forest Service FIA estimates and LCMS summaries, and the USGS Water Data OGC API.
One dependency: pandas, used by the USGS and Forest Service clients, which return DataFrames. The Esri clients use only the standard library. Earth Engine is optional, for summarizing LCMS over your own polygon.
pip install georest
pip install "georest[ee]" # adds Earth Engine for usfs.lcms_ee
pip install "georest[mcp]" # adds georest-mcp, the MCP server for LLM agents
Documentation: georest.io.
Quick start
from georest.esri import portal, services
from georest.usfs import edw
# Search the USFS EDW catalog by keyword or theme
hits = edw.search_edw_services("fire")
# Pull features as GeoJSON (layer 63 = "Burned Area Boundaries (All Years)")
geojson = edw.query_features(
"EDW_MTBS_01", 63,
where="fire_name LIKE '%CAMERON PEAK%'",
out_fields="fire_name,acres,year",
)
# Search any ArcGIS Portal - IIPP, ArcGIS Online, USGS, NOAA, USFS, NASA,
# or any ArcGIS Enterprise install
results = portal.searchPortal("naip 2023", portal="agol")
# Generic ArcGIS service operations, on any layer (EDW's queries are these)
tile_url = services.getImageServiceTileUrl("https://.../ImageServer")
fires = services.queryFeatureService(edw.layer_url("EDW_MTBS_01", 62),
max_features=5000, if_more="page")
# USGS Water Data: find gages in a box, pull a month of daily discharge
from georest.usgs import waterdata
gages = waterdata.search_monitoring_locations(bbox=(-111.7, 36.8, -111.5, 37.0),
site_type_code="ST")
flow = waterdata.get_daily_values("USGS-09380000", "00060",
start="2024-01-01", end="2024-01-31")
flow[["time", "value"]] # a DataFrame, value as a number
# Forest Service: FIA estimates always come with their sampling error
from georest.usfs import fia, lcms
fia.find_attributes("carbon") # what can be estimated
wc = fia.find_evaluations("Oregon")["wc"].iloc[0] # which inventory
df = fia.estimate(wc, 2, rselected="County code and name") # se_pct, plots, unreliable
lcms.lcms_summary("Land_Cover", state="Oregon", county="Crook")
The provider modules are also re-exported at the top level, so from georest import edw
and from georest import waterdata work too. They load lazily, so import georest costs
almost nothing.
Maps
georest.view draws ArcGIS services, GeoJSON and XYZ tiles on an interactive
map, with query, legends, time lapses and area charts. Map.addLayer works out
what it was given: an ArcGIS feature layer, map service or image service URL, a
tile URL with {z}, {x} and {y}, or GeoJSON (a URL, text or a dict).
from georest.view import Map
Map.addLayer("https://hazards.fema.gov/arcgis/rest/services/public/NFHL/MapServer",
{"layers": "show:28"}, "Flood hazard")
Map.addLayer("https://services3.arcgis.com/T4QMspbfLg3qTGWY/arcgis/rest/services/"
"WFIGS_Interagency_Perimeters_Current/FeatureServer/0", {}, "Fire perimeters")
# an image service: every scene in a window, combined per pixel by a reducer
Map.addLayer("https://landsat2.arcgis.com/arcgis/rest/services/Landsat/MS/ImageServer",
{"time": ("2020-06-01", "2020-09-30"), "reducer": "min"}, "Landsat summer 2020")
# tiles: Query shows the color under the click, named by classLegendDict
Map.addLayer("https://basemap.nationalmap.gov/arcgis/rest/services/USGSHydroCached/MapServer/tile/{z}/{y}/{x}",
{"classLegendDict": {"Water body": "cbe6ff"}}, "Hydrography")
Map.addLayer("https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_week.geojson", {}, "Earthquakes")
Map.setCenter(-105.1, 40.6, 9)
Map.turnOnInspector()
Map.view() # or Map.export_html("map.html")
For a time-enabled image or map service shown as a time lapse, one frame per
time step, use Map.addTimeLapse(url, viz, name). examples/view_example.py
shows every kind of input.
Layout
| Import path | What it covers |
|---|---|
georest.esri.portal |
ArcGIS Portal search and service metadata |
georest.esri.services |
Generic Image/Map/Feature Service queries (one request, or paged past the server's limit), window-function analytics, and raster operations |
georest.usgs.waterdata |
USGS Water Data OGC API: monitoring locations, daily/continuous values, field measurements, peaks, time-series metadata |
georest.usfs |
Forest Service FIA estimates (EVALIDator) with sampling errors, LCMS land cover/use/change summaries, and the two side by side |
georest.usfs.edw |
The Forest Service Enterprise Data Warehouse (EDW): catalog search, layer-role tagging, FGDC/ISO metadata, and feature and analytic queries through georest.esri.services. It was georest.esri.edw until 0.5.2; that name still works, with a deprecation warning |
georest.fema.nfhl |
FEMA's National Flood Hazard Layer: the flood zone at a point, when that map took effect, and new maps that are pending or preliminary |
georest.fema.openfema |
OpenFEMA disaster declarations: by declared county, or one row per disaster |
georest.noaa |
NWS alerts, forecasts and observations (one unit system per call), NWPS river gauges with flood stages, CO-OPS tides, NHC active storms |
esri is the Esri/ArcGIS provider, usgs the USGS provider, usfs the
USDA Forest Service provider, fema the FEMA provider, and noaa the NOAA
provider. Each sits under
georest as a subpackage so providers can be added alongside one another without a
namespace collision, and each is self-contained - its private _http (and, for
usgs, _ogc) module is its own.
Full per-function reference: docs/api.md.
Runnable notebooks: examples/. The guide_* notebooks each answer one question
with interactive charts and maps; the others walk through one module function by function.
An MCP server for LLM agents
georest-mcp serves georest's data clients as Model Context Protocol tools over stdio:
FIA estimates and LCMS summaries, USGS water data, the river network, elevation,
earthquakes, ScienceBase and water quality, and EDW, portal and Feature Service queries. It
has 18 read-only tools and no code execution. Register it with your client, e.g. for Claude Code:
{"mcpServers": {"georest": {"command": "georest-mcp"}}}
See docs/api.md for what the tools return and the rules they follow.
Signing in to ArcGIS Online / Portal
Public services need no sign-in. For secured content, sign in once and every portal and
services call without an explicit token= uses your session, sent only to the portal's
own hosts (never to, say, a public NOAA service).
One-time setup, per AGOL org or Enterprise portal:
- Content > New item > Developer credentials > OAuth 2.0 credentials.
- Add the redirect URL
http://127.0.0.1:8765/callback. - Note the client id. No client secret is needed.
Then pick whichever fits:
from georest.esri import auth
# Notebook or script: browser sign-in; enterprise SSO (SAML/eAuth) works.
auth.login("https://myorg.maps.arcgis.com", client_id="abc123")
# ArcGIS Pro: reuse Pro's session via the arcgis API (run in Pro's Python).
from arcgis.gis import GIS
gis = GIS("Pro")
auth.set_token(gis._con.token, portal=gis.url, refresh=lambda: gis._con.token)
auth.status() # who you are and until when; never the token
For an MCP server or any long-running process, sign in from a terminal once:
georest-login --portal https://myorg.maps.arcgis.com --client-id abc123
That saves a refresh token to ~/.georest/esri_credentials.json; later processes pick it
up automatically until the refresh token expires (two weeks by default, set by your org),
then run the command again. georest-login --logout removes it. GEOREST_ESRI_PORTAL and
GEOREST_ESRI_CLIENT_ID can stand in for the flags.
USGS API key
The Water Data API works anonymously, rate-limited to "a few queries per hour". For more,
get a free key and set USGS_API_KEY in the
environment (or call waterdata.set_api_key(...) once at startup). The key is sent only as
the X-Api-Key header - never in a URL, so it cannot leak through an error message or a
log line. Every result carries the remaining budget when the server reports it
(fc["rate_limit"]), and a 429 the server won't let the client wait out raises
waterdata.RateLimitError with a .retry_after rather than blocking.
Maintenance tool
georest-check-themes # report drift vs. the live EDW catalog
georest-check-themes --emit # + paste-ready _SERVICE_THEMES entries
georest.usfs.edw._SERVICE_THEMES is hand-curated and powers theme filtering and description
matching. EDW publishes and retires services without notice, so the table rots
quietly - an untyped service still appears in search results, but as theme
uncategorized with no description for keyword matching to reach. Exit status is
0 in sync, 1 drifted, 2 unreachable.
Migrating from RESTesri
This package was previously a loose RESTesri/ directory that worked only when the
repository root happened to be on sys.path. Update imports:
from RESTesri import edw # before
from georest.usfs import edw # after
from RESTesri._http import fetch_json # before
from georest.esri._http import fetch_json # after
Then delete any sys.path.insert(...) bootstrap - pip install georest (or
pip install -e . from a clone) makes it unnecessary.
Development
git clone https://github.com/redcastle-resources/georest
cd georest
pip install -e ".[dev]"
python -m pytest # or: python -m unittest discover -s tests -t .
EDW_LIVE=1 SERVICES_LIVE=1 USGS_LIVE=1 python -m pytest # include the network tests
This is a src/ layout, so pip install -e . is required before the tests can
import the package - that is deliberate. It makes the suite import the installed
artifact rather than the source directory, so a packaging mistake fails loudly
instead of being masked by the working directory.
Live tests skip rather than fail when the servers are unreachable; EDW
intermittently answers 404, 500, Layer not found, or 200-with-no-layers for
services that work moments later, and the USGS API rate-limits anonymous callers.
See tests/README.md and CONTRIBUTING.md.
Requirements
Python 3.9 or newer, and pandas 1.5 or newer. The 3.9 floor is deliberate: ArcGIS Pro 3.0–3.2 ships Python 3.9 (with pandas), and that is squarely this library's audience.
License
Apache License 2.0 - see LICENSE.
portal.py and services.py were ported from
geeViz's esriLib.py, with the
viewer-rendering functions removed; these modules fetch data rather than render it.
Metadata
Release files for georest 0.6.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| georest-0.6.3.tar.gz | 1.8 MB | With provenance | Details for georest-0.6.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| georest-0.6.3-py3-none-any.whl | Python 3 | none | any | Details for georest-0.6.3-py3-none-any.whl |
Total release size: 2.6 MB
Release files / georest-0.6.3.tar.gz
| Download URL | georest-0.6.3.tar.gz |
|---|---|
| Size | 1.8 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cdc448dfea5c1a7fcbfbb5b0bcd2720c9d84a2610e2a3ba81680b38f0c32bfc9
|
|
BLAKE2b-256 checksum How to use checksums |
86115f07772ea677220464fe37d7b2334dd1a75bdf43509b3545db9a77259ca0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logRelease files / georest-0.6.3-py3-none-any.whl
| Download URL | georest-0.6.3-py3-none-any.whl |
|---|---|
| Size | 777.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
af5ead1c458d0a47fa4f792c9bcb1ca81ce50979167d46ea5ff51e787d43da48
|
|
BLAKE2b-256 checksum How to use checksums |
237c8b809cb8bdd8728b0fd6dc2d3402d570bc49c477b9e3a9170b9264f576e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logSecurity for georest 0.6.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for georest-0.6.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.