# Service Area Map Generator Agent Guide

This guide is for LLM and browser agents using the public MobiFlex Service Area Map Generator.

Use the HTML guide first when your browsing tool can read rendered pages:

- HTML guide: `/tools/service-area-map/agent`
- Markdown mirror: `/tools/service-area-map/agent.md`

The rendered tool root also exposes `data-agent-doc="/tools/service-area-map/agent"`. Treat that as the current agent guide URL.

## What the tool does

The Service Area Map Generator creates an approximate service area map from suburbs, postcodes, or drawn map points.

Use it when a user wants to:

- turn an Australian suburb or postcode list into a map
- upload or paste a simple Australian service area list
- draw an approximate service area manually in Australia or another country
- export a PNG map from the browser
- get a post-export guide for putting the map on a website, profile, or customer reply

## URLs

- Tool: `/tools/service-area-map`
- Agent HTML guide: `/tools/service-area-map/agent`
- Agent markdown guide: `/tools/service-area-map/agent.md`
- Post-export usage guide: `/tools/service-area-map/guide/`

Warm-start and mode query examples:

```txt
/tools/service-area-map?country=AU&source=tools_page_warm_start
/tools/service-area-map?country=AU&source=tools_page_warm_start&lat=-34.92000&lng=138.62000&zoom=10
/tools/service-area-map?country=AU&mode=list&input=paste
/tools/service-area-map?country=AU&mode=list&input=upload
/tools/service-area-map?country=AU&mode=draw
/tools/service-area-map?country=NZ&mode=draw&source=tools_page_warm_start
/tools/service-area-map?country=OTHER&mode=draw&source=tools_page_warm_start
```

Supported query params:

- `country`: `AU`, `NZ`, `US`, `GB`, `CA`, or `OTHER`.
- `mode`: `list` or `draw`.
- `input`: `paste` or `upload`. Only applies when `country=AU` and `mode=list`.
- `source`: `tools_page_warm_start` when navigation came from the Tools page warm-start.
- `lat`, `lng`, `zoom`: optional map centre hints emitted by warm-start after an AU base location is selected.

Do not use `mode=paste`. Paste and upload are `input` values under `mode=list`.

## Fragment prefill schema

Use URL fragments, not query params, for area-list prefill. Fragment values stay client-side on page load.

```txt
/tools/service-area-map#mode=list&country=AU&state=SA&businessName=Example%20Business&areas=Glenelg%0AUnley%0ANorwood
```

Supported fragment params:

- `mode`: optional. Allowed values are `list` and `draw`.
- `country`: optional. `AU` keeps the current Australia context. Fragment country normalisation is Australia-only today.
- `state`: optional. Use an Australian state code such as `SA`, `NSW`, `VIC`, `QLD`, `WA`, `TAS`, `NT`, or `ACT`.
- `businessName`: optional. Prefills the business/export name field after export controls are shown.
- `areas`: optional. URL-encoded newline-separated suburbs or postcodes.

Example:

```txt
/tools/service-area-map#mode=list&country=AU&state=SA&businessName=Example%20Mobile%20Mechanic&areas=Glenelg%0AUnley%0ANorwood%0AMawson%20Lakes
```

Vertical examples:

- Mobile mechanic in Adelaide:

```txt
/tools/service-area-map#mode=list&country=AU&state=SA&businessName=Example%20Mobile%20Mechanic&areas=Glenelg%0AUnley%0ANorwood%0AMawson%20Lakes
```

- Caravan service and repair around Adelaide:

```txt
/tools/service-area-map#mode=list&country=AU&state=SA&businessName=Example%20Caravan%20Service&areas=Gawler%0AElizabeth%0ASalisbury%0AModbury
```

- Mobile pet groomer around a local service area:

```txt
/tools/service-area-map#mode=list&country=AU&state=SA&businessName=Example%20Mobile%20Pet%20Groomer&areas=Brighton%0AMarion%0APlympton%0AGlenelg
```

Decoded `areas` example:

```txt
Glenelg
Unley
Norwood
Mawson Lakes
```

Do not use query params for `areas` or `businessName`. Do not use JSON blob fragments.

## Agent workflow

```txt
1. Read the HTML guide at /tools/service-area-map/agent, or this markdown mirror if HTML is unavailable.
2. Open /tools/service-area-map, a supported query URL, or a fragment-prefilled AU list URL.
3. Look for data-agent-tool="service-area-map-generator" on the rendered tool root.
4. If data-agent-doc is present, use it to confirm the current agent guide URL.
5. If a specific AU base suburb is needed, type it into data-agent-input="base-suburb" and select a result from the dropdown.
6. For AU list maps, select data-agent-action="select-paste-mode" or data-agent-action="select-upload-mode"; a deep link may also use ?country=AU&mode=list&input=paste or input=upload.
7. For draw-only maps, use ?mode=draw or data-agent-action="select-draw-mode".
8. For paste mode, confirm the area list is present in data-agent-input="areas".
9. Click the Generate map control with data-agent-action="resolve-areas".
10. Wait until the map area renders or data-agent-status="map-ready" is present.
11. Click data-agent-action="recenter-map" so the boundary fits the export canvas.
12. Click data-agent-action="export-png" to generate and download the PNG.
13. If available after export, use data-agent-output="png-download" as the generated PNG download target.
```

Some agents can read webpages but cannot interact with browser controls or access downloaded files. Those agents can prepare a supported URL and instructions, but they may not be able to complete the PNG export. Agents with browser-control tools should use the documented data-agent selectors.

## DOM selectors

- Tool root: `[data-agent-tool="service-area-map-generator"]`
- Agent guide on root: `[data-agent-doc]`
- Base suburb or postcode autocomplete: `[data-agent-input="base-suburb"]`
- Select paste mode: `[data-agent-action="select-paste-mode"]`
- Select upload mode: `[data-agent-action="select-upload-mode"]`
- Select draw mode: `[data-agent-action="select-draw-mode"]`
- Area list input: `[data-agent-input="areas"]`
- Business name input: `[data-agent-input="business-name"]`
- Resolve areas: `[data-agent-action="resolve-areas"]`
- Centre map: `[data-agent-action="recenter-map"]`
- Export PNG: `[data-agent-action="export-png"]`
- Generated PNG download target: `[data-agent-output="png-download"]`

There is no visible country or state selector in the tool. Country comes from the URL or defaults to Australia. Australian state is inferred from the selected base suburb or from the fragment `state` param.

## Privacy notes

```txt
Spreadsheet files are parsed in the browser. Fragment values are not sent to the server as part of the HTTP request. Suburb and postcode text may be sent to the MobiFlex resolver when the user or agent resolves the map.
```

The tool does not create MobiFlex clients, leads, bookings, or other permanent records.

## Known limits

- The output is an approximate service area only.
- List, upload, paste, and suburb/postcode resolution are Australia-only.
- For `NZ`, `US`, `GB`, `CA`, and `OTHER`, use `mode=draw` only. Non-AU list URLs are coerced to draw mode.
- The maximum unique listed areas remains 50.
- Long area lists may exceed practical browser URL length.
- Use upload or paste manually for long lists.
- Export requires the browser page to be open.
