# Macrostrat Geology Units Scraper (`parseforge/macrostrat-geology-units-scraper`) Actor

Scrapes geologic unit records from Macrostrat by latitude/longitude or stratigraphic name. Returns each unit as a flat row with attributes like name, age, and lithology.

- **URL**: https://apify.com/parseforge/macrostrat-geology-units-scraper.md
- **Developed by:** [ParseForge](https://apify.com/parseforge) (community)
- **Categories:** Education, AI, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

[![ParseForge](https://raw.githubusercontent.com/ParseForge/apify-assets/main/banner-v4.webp)](https://apify.com/parseforge?fpr=vmoqkp)

### Macrostrat Geology Units Scraper

**Scrape geologic unit data from Macrostrat by location or stratigraphic name.** Get formation names, ages, lithologies, and more for any point on Earth, up to a million units per run. No API key required. Export to CSV, JSON, Excel, or XML.

Macrostrat's geology database holds detailed records on rock units worldwide, but querying it manually is slow and hard to scale. This Actor pulls unit data directly from Macrostrat's public API, letting you collect stratigraphic information for any latitude/longitude or by formation name. Each result is returned as a flat row with consistent fields, ready for analysis or export.

| Who uses it | What they scrape Macrostrat for |
|---|---|
| Geologists | Compile regional stratigraphic columns for field mapping projects. |
| GIS analysts | Extract bedrock geology attributes for points of interest in spatial models. |
| Earth science researchers | Gather unit ages and lithologies across study areas for statistical analysis. |
| Educators | Build teaching datasets of local rock formations for classroom exercises. |

### What it does

This Actor collects geologic unit records from Macrostrat by location point or stratigraphic name, returning each unit as a flat row with its attributes.

- 📍 **Location query:** Provide latitude and longitude to get all units in the Macrostrat column at that point.
- 🔍 **Stratigraphic name lookup:** Search by formation or group name (e.g., 'Mancos', 'St Peter') instead of coordinates.
- 📊 **Flexible output:** Export results as CSV, JSON, Excel, or XML for downstream use.
- ⚙️ **Configurable limits:** Set a maximum number of units to collect per run, from 1 to 1,000,000.

Results export to CSV, JSON, Excel, or XML, or straight from the API.

### What you can do with Macrostrat data

**🗺️ Build regional stratigraphic columns.**

A field geologist runs the Actor with coordinates for a mapping area to quickly assemble the local sequence of rock units for a report.

**📈 Analyze unit distribution for research.**

An earth science researcher collects unit ages and lithologies across multiple points to study spatial patterns in basin evolution.

**🏫 Create teaching datasets.**

An educator gathers all formations near a campus location to develop a lab exercise on local geology.

**🛰️ Enrich GIS point data.**

A GIS analyst extracts bedrock unit names and attributes for sample locations to add geologic context to a spatial database.

### Why choose this scraper

| | What you get |
|---|---|
| **No API key needed** | Access Macrostrat's public data without registration or authentication. |
| **Scalable collection** | Retrieve up to a million units in a single run, limited only by your maxItems setting. |
| **Consistent schema** | Every unit is returned as a flat row with the same fields, simplifying data processing. |
| **Two query modes** | Query by location to get a full stratigraphic column, or by name to find all matching units. |

### How it compares

No other Store actor targets Macrostrat the same way, so the honest comparison is with the alternatives teams actually weigh.

| | Macrostrat Geology Units Scraper | Build it in-house | By hand |
|---|---|---|---|
| Setup | Run it now, zero config | Days of engineering | None, but hours per pull |
| When Macrostrat changes | Maintained for you | You fix it | You re-learn the page |
| Proxies, retries, anti-bot | Built in | Your problem | Browser only |
| Output | Fixed JSON schema, CSV/Excel export | Whatever you build | Copy-paste |
| Cost | Pay per result | Engineering time | Analyst hours |

### Configure the run

Drive the Actor with either a latitude/longitude point or a stratigraphic name, and set a maximum number of units to collect per run. The Input tab lists every parameter.

A first run with the defaults:

```json
{
 "lat": "43",
 "lng": "-89.3",
 "maxItems": 10
}
```

A larger pull:

```json
{
 "lat": "43",
 "lng": "-89.3",
 "maxItems": 200
}
```

### Pricing

Pay-per-result: **$0.004 per result** collected. You pay only for the results written to your dataset.

| Results collected | Approximate cost |
|---|---|
| 100 results | $0.40 |
| 1,000 results | $4.00 |
| 10,000 results | $40.00 |

New Apify accounts start with $5 in free credit.

### Free users

Free-plan runs return up to 10 results as a preview. [Upgrade your Apify plan](https://console.apify.com/sign-up?fpr=vmoqkp) to collect up to 1,000,000 results per run.

### Run it

1. [Create a free Apify account with $5 in credit](https://console.apify.com/sign-up?fpr=vmoqkp).
2. Open the [Macrostrat Geology Units Scraper](https://apify.com/parseforge/macrostrat-geology-units-scraper?fpr=vmoqkp).
3. Set your inputs and any filters, then click **Start**.
4. Export the results as CSV, Excel, JSON, or XML from the **Dataset** tab.

Run it programmatically through the [Apify API](https://docs.apify.com/api/v2) (`run-sync-get-dataset-items`) or the [ApifyClient](https://docs.apify.com/api/client/js) for JavaScript and Python.

### Use with AI agents (MCP)

Give an AI agent live access to Macrostrat through the Model Context Protocol. Add the Actor to Claude, Cursor, or any MCP client:

```bash
claude mcp add --transport http apify "https://mcp.apify.com?tools=parseforge/macrostrat-geology-units-scraper"
```

Then prompt it in plain language to run the scraper and read back the results.

### Troubleshooting

**Why am I getting no results?**

Check that your latitude and longitude are in decimal degrees and within valid ranges (-90 to 90 for lat, -180 to 180 for lng). If using a stratigraphic name, ensure it is spelled correctly and exists in Macrostrat.

**The Actor returns fewer units than expected.**

The maxItems setting limits the number of units collected. Increase maxItems if you need more. Also, some locations may have fewer units in the Macrostrat column.

**I get an error about invalid input.**

Verify that latitude and longitude are numeric strings (e.g., '43' not '43N'). For stratigraphic name, avoid special characters unless part of the official name.

**The run takes a long time.**

Large maxItems values can increase runtime. Reduce maxItems or query a more specific location to speed up collection.

### FAQ

| Question | Answer |
|---|---|
| Do I need an API key to use this Actor? | No. The Actor uses Macrostrat's public API endpoints, which do not require authentication. |
| Can I query by both location and stratigraphic name? | No. The Actor uses one mode at a time. If you provide a stratigraphic name, it takes precedence and the latitude/longitude are ignored. |
| What coordinate system should I use for latitude and longitude? | Use decimal degrees in the WGS84 datum. For example, 43.0 and -89.3 for Madison, Wisconsin. |
| How many units can I collect in one run? | You can set maxItems to any value from 1 to 1,000,000. The Actor will stop after reaching that number of units. |
| What data fields are returned for each unit? | Each unit includes attributes such as stratigraphic name, age, lithology, and other properties available from Macrostrat. The exact fields are shown in the sample output. |
| Can I export the results to a spreadsheet? | Yes. The Actor supports CSV, JSON, Excel, and XML output formats, which you can download from the run's dataset. |
| Is there a rate limit on Macrostrat's API? | Macrostrat's public API is generally open, but heavy usage may be throttled. The Actor handles requests sequentially to avoid overwhelming the service. |
| What if my location returns no units? | Some points, such as oceans or areas with no mapped bedrock, may return zero units. Try a nearby location or use a stratigraphic name query instead. |

### Related actors

- [usgs-earthquake-scraper](https://apify.com/parseforge/usgs-earthquake-scraper?fpr=vmoqkp): Use this to collect earthquake data from USGS, which complements geologic unit information for hazard analysis.

Browse the full [ParseForge collection](https://apify.com/parseforge?fpr=vmoqkp) for more scrapers.

🆘 **Need help?** Email parseforge@protonmail.com with your run ID, your input, and what you expected.

⚠️ **Disclaimer.** This Actor is unofficial and is not affiliated with, endorsed by, or sponsored by Macrostrat. It collects only publicly available data. You are responsible for using the collected data in compliance with the source's terms of service and applicable data-protection laws, including GDPR, CCPA, and PIPL. Do not use it to collect personal data unlawfully.

# Actor input Schema

## `lat` (type: `string`):

Latitude of the location to query (decimal degrees, WGS84). Returns all geologic units in the Macrostrat column at this point.

## `lng` (type: `string`):

Longitude of the location to query (decimal degrees, WGS84).

## `stratName` (type: `string`):

Optional. Look up units by formation/group name (e.g. 'Mancos', 'St Peter') instead of by location. When set, lat/lng are ignored.

## `maxItems` (type: `integer`):

How many units to collect per run.

## Actor input object example

```json
{
  "lat": "43",
  "lng": "-89.3",
  "maxItems": 10
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "lat": "43",
    "lng": "-89.3",
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("parseforge/macrostrat-geology-units-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "lat": "43",
    "lng": "-89.3",
    "maxItems": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("parseforge/macrostrat-geology-units-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "lat": "43",
  "lng": "-89.3",
  "maxItems": 10
}' |
apify call parseforge/macrostrat-geology-units-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,parseforge/macrostrat-geology-units-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/2vUeecWTpYsqO8KsX/builds/xT17ZzivK07sIYare/openapi.json
