# SF Planning Notices & Hearings (`rocketlaunchers/sf-planning-notices`) Actor

Scrapes San Francisco Planning's public notices table (Planning Commission, variance and neighborhood-notification hearings) and geocodes each project address with the city's own address registry. Filter by neighborhood, bounding box or radius.

- **URL**: https://apify.com/rocketlaunchers/sf-planning-notices.md
- **Developed by:** [Noah Wolk](https://apify.com/rocketlaunchers) (community)
- **Categories:** Real estate, Agents
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## 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

## SF Planning Notices & Hearings

Which projects near an address are about to go before San Francisco's Planning Commission? The answer sits in [one city page](https://sfplanning.org/page/public-notices-project-applications): a long HTML table with no API, no coordinates and no filters. This Actor turns that page into clean, geocoded JSON you can filter by neighborhood, bounding box or radius.

Built at Cal Hacks 13.0 for **Coordinate**. Its "Hearing Watch" agent calls this Actor to pin upcoming hearings on the map.

### What it does

1. Fetches the public notices table from sfplanning.org (about 100 active projects).
2. Parses each row: address, record number and type (`CUA` conditional use, `VAR` variance, `DRP` discretionary review, `PRJ` project…), notice type, links to the notice and plans PDFs, Planning neighborhood, and the posting, expiration and hearing dates.
3. Geocodes each address against the city's own address registry ([DataSF Enterprise Addressing System](https://data.sf.gov/resource/3mea-di5p.json)), using batched SoQL `address in (...)` queries. About 90% of rows match. The ones that don't are multi-parcel or non-address items such as "SF Survey Findings".
4. Applies your filters and writes one dataset item per notice.

### Input

| Field | Type | Default | Notes |
|---|---|---|---|
| `neighborhoods` | string\[] | `[]` | e.g. `["Mission", "Castro Upper Market"]` (substring match) |
| `bbox` | `[minLng, minLat, maxLng, maxLat]` | – | needs geocoding |
| `center` + `radiusKm` | `[lng, lat]`, number | –, 1 | sorted nearest first, adds `distanceKm` |
| `noticeTypes` | string\[] | `[]` | e.g. `["Hearing", "Variance", "311"]` |
| `upcomingOnly` | boolean | false | drops notices whose hearing or expiration date has passed |
| `geocode` | boolean | true | adds `lat`/`lng`, `analysisNeighborhood`, `supervisor` |
| `maxItems` | integer | 100 | |

Example: `{ "center": [-122.4194, 37.7599], "radiusKm": 1.5, "upcomingOnly": true }`

### Output (one item)

```json
{
  "address": "811 Valencia Street", "recordNumber": "2018-009487VAR", "recordType": "VAR",
  "noticeType": "Zoning Variance Hearing", "neighborhood": "Mission",
  "postedDate": "2026-10-07", "expirationDate": null, "hearingDate": "2026-10-28",
  "noticeUrl": "https://citypln-m-extnl.sfgov.org/SharedLinks.aspx?...", "plansUrl": "https://citypln-m-extnl.sfgov.org/SharedLinks.aspx?...",
  "lat": 37.7598, "lng": -122.4211, "analysisNeighborhood": "Mission", "supervisor": "Jackie Fielder",
  "distanceKm": 0.151, "staff": "Edgar Oropeza", "sourceUrl": "https://sfplanning.org/page/public-notices-project-applications"
}
```

`staff` is the city planner assigned to the notice, which is a public contact. Only the name is kept.

### Cost and speed

A run makes one page fetch plus 3 small DataSF queries, takes about 3 to 6 seconds, and needs 256 MB of memory. No proxies are needed: both sources are public government sites.

### Develop and deploy

```bash
npm install && node src/main.js      # local run; input from storage/key_value_stores/default/INPUT.json
npx -p apify-cli apify login         # paste your Apify API token
npx -p apify-cli apify push          # builds on the Apify platform as <your-username>/sf-planning-notices
```

The parsing helpers live in `src/parse.js` (no dependencies). Coordinate unit-tests them against a recorded copy of the page: `web/src/lib/sponsors/sponsors.test.ts`.

# Actor input Schema

## `neighborhoods` (type: `array`):

Keep only notices in these Planning neighborhoods (e.g. "Mission", "Castro Upper Market"). Empty = all.

## `bbox` (type: `array`):

Keep only notices inside \[minLng, minLat, maxLng, maxLat]. Requires geocoding.

## `center` (type: `array`):

With radiusKm: keep only notices within that distance. Results are sorted nearest first.

## `radiusKm` (type: `number`):

Distance from center. Ignored without center.

## `noticeTypes` (type: `array`):

Keep only notice types containing any of these words (e.g. "Hearing", "Variance", "311"). Empty = all.

## `upcomingOnly` (type: `boolean`):

Drop notices whose hearing date (or expiration, if no hearing) has passed.

## `geocode` (type: `boolean`):

Add lat/lng from DataSF's Enterprise Addressing System (the city's address registry). Needed for bbox/center filters.

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

Stop after this many notices.

## Actor input object example

```json
{
  "neighborhoods": [],
  "radiusKm": 1,
  "noticeTypes": [],
  "upcomingOnly": false,
  "geocode": true,
  "maxItems": 100
}
```

# Actor output Schema

## `notices` (type: `string`):

Geocoded SF Planning notices and hearings matching the input filters.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("rocketlaunchers/sf-planning-notices").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("rocketlaunchers/sf-planning-notices").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 '{}' |
apify call rocketlaunchers/sf-planning-notices --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,rocketlaunchers/sf-planning-notices"
        }
    }
}
```

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/pAidCl5aMU95vYKOB/builds/5WCZNH61amzaF43TE/openapi.json
