Skip to content

Commit 6daa18f

Browse files
committed
Update website
1 parent 1a68638 commit 6daa18f

45 files changed

Lines changed: 11120 additions & 2944 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ai-config.js

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
(function() {
2+
var defaultProvider = "anthropic";
3+
4+
var common = {
5+
enabled: true,
6+
mode: "direct",
7+
label: "Ask Mapshaper",
8+
title: "Ask Mapshaper",
9+
staticContextUrls: [
10+
"/docs/ai/bot-instructions.html.md",
11+
"/docs/ai/command-cheatsheet.html.md",
12+
"/llms-full.txt"
13+
],
14+
sendRuntimeContext: true,
15+
sendSampleValues: false,
16+
allowRunCommands: false
17+
};
18+
19+
var providers = {
20+
anthropic: {
21+
provider: "anthropic",
22+
apiKey: "",
23+
model: "claude-sonnet-4-6",
24+
cacheControl: {type: "ephemeral"},
25+
cacheTtl: "1h"
26+
},
27+
openai: {
28+
provider: "openai",
29+
apiKey: "",
30+
model: "gpt-4.1-mini"
31+
},
32+
gemini: {
33+
provider: "gemini",
34+
apiKey: "",
35+
model: "gemini-3.1-pro-preview"
36+
},
37+
mock: {
38+
mode: "mock",
39+
provider: "mock"
40+
}
41+
};
42+
43+
function getSelectedProvider() {
44+
var params = new URLSearchParams(window.location.search);
45+
return params.get("ai") || defaultProvider;
46+
}
47+
48+
function mergeConfig() {
49+
var selected = getSelectedProvider();
50+
var providerConfig = providers[selected] || providers[defaultProvider];
51+
return Object.assign({
52+
selectedProvider: providers[selected] ? selected : defaultProvider
53+
}, common, providerConfig);
54+
}
55+
56+
window.mapshaperAIConfigs = {
57+
defaultProvider: defaultProvider,
58+
common: common,
59+
providers: providers
60+
};
61+
window.mapshaperAI = mergeConfig();
62+
})();

docs/essentials/command-line.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
<aside class="docs-sidebar" id="docs-sidebar">
4343
<div class="sidebar-inner">
44-
<nav class="docs-nav"><ul class="top-links"><li><a href="/docs/">Home</a></li><li><a href="/docs/whats-new.html">What&#39;s new</a></li><li><a href="/docs/reference.html">Command reference</a></li><li><a href="/docs/gallery/">Gallery</a></li></ul><h2>Getting started</h2><ul><li><a href="/docs/essentials/command-line.html" class="is-active">The command-line tool</a></li><li><a href="/docs/essentials/web-app.html">The web app</a></li></ul><h2>Examples</h2><ul><li><a href="/docs/examples/basics.html">Basics</a></li><li><a href="/docs/examples/globe.html">Globe locator map</a></li><li><a href="/docs/examples/us-states.html">U.S. state map</a></li><li><a href="/docs/examples/ny-state.html">New York map</a></li></ul><h2>Guides</h2><ul><li><a href="/docs/guides/simplification.html">Simplification</a></li><li><a href="/docs/guides/expressions.html">JavaScript expressions</a></li><li><a href="/docs/guides/projections.html">Projections</a></li><li><a href="/docs/guides/topology.html">Topology and cleaning</a></li><li><a href="/docs/guides/combining-layers.html">Combining two layers</a></li><li><a href="/docs/guides/programmatic.html">Using Mapshaper from Node.js</a></li></ul><h2>Formats</h2><ul><li><a href="/docs/formats/overview.html">Overview</a></li><li><a href="/docs/formats/shapefile.html">Shapefile</a></li><li><a href="/docs/formats/geojson.html">GeoJSON</a></li><li><a href="/docs/formats/topojson.html">TopoJSON</a></li><li><a href="/docs/formats/geopackage.html">GeoPackage</a></li><li><a href="/docs/formats/geoparquet.html">GeoParquet</a></li><li><a href="/docs/formats/flatgeobuf.html">FlatGeobuf</a></li><li><a href="/docs/formats/kml.html">KML / KMZ</a></li><li><a href="/docs/formats/csv.html">CSV / TSV</a></li><li><a href="/docs/formats/json.html">JSON records</a></li><li><a href="/docs/formats/dbf.html">DBF</a></li><li><a href="/docs/formats/svg.html">SVG</a></li><li><a href="/docs/formats/snapshot.html">Mapshaper snapshot</a></li></ul></nav>
44+
<nav class="docs-nav"><ul class="top-links"><li><a href="/docs/">Home</a></li><li><a href="/docs/whats-new.html">What&#39;s new</a></li><li><a href="/docs/reference.html">Command reference</a></li><li><a href="/docs/gallery/">Gallery</a></li></ul><h2>Getting started</h2><ul><li><a href="/docs/essentials/command-line.html" class="is-active">The command-line tool</a></li><li><a href="/docs/essentials/web-app.html">The web app</a></li></ul><h2>Examples</h2><ul><li><a href="/docs/examples/basics.html">Basics</a></li><li><a href="/docs/examples/globe.html">Globe locator map</a></li><li><a href="/docs/examples/us-states.html">U.S. state map</a></li><li><a href="/docs/examples/ny-state.html">New York map</a></li></ul><h2>Guides</h2><ul><li><a href="/docs/guides/simplification.html">Simplification</a></li><li><a href="/docs/guides/styles-and-symbols.html">Styles and Symbols</a></li><li><a href="/docs/guides/expressions.html">JavaScript expressions</a></li><li><a href="/docs/guides/projections.html">Projections</a></li><li><a href="/docs/guides/topology.html">Topology and cleaning</a></li><li><a href="/docs/guides/combining-layers.html">Combining two layers</a></li><li><a href="/docs/guides/programmatic.html">Using Mapshaper from Node.js</a></li></ul><h2>Formats</h2><ul><li><a href="/docs/formats/overview.html">Overview</a></li><li><a href="/docs/formats/shapefile.html">Shapefile</a></li><li><a href="/docs/formats/geojson.html">GeoJSON</a></li><li><a href="/docs/formats/topojson.html">TopoJSON</a></li><li><a href="/docs/formats/geopackage.html">GeoPackage</a></li><li><a href="/docs/formats/geoparquet.html">GeoParquet</a></li><li><a href="/docs/formats/flatgeobuf.html">FlatGeobuf</a></li><li><a href="/docs/formats/kml.html">KML / KMZ</a></li><li><a href="/docs/formats/csv.html">CSV / TSV</a></li><li><a href="/docs/formats/json.html">JSON records</a></li><li><a href="/docs/formats/dbf.html">DBF</a></li><li><a href="/docs/formats/svg.html">SVG</a></li><li><a href="/docs/formats/snapshot.html">Mapshaper snapshot</a></li></ul></nav>
4545
</div>
4646
</aside>
4747

docs/essentials/web-app.html

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
<aside class="docs-sidebar" id="docs-sidebar">
4343
<div class="sidebar-inner">
44-
<nav class="docs-nav"><ul class="top-links"><li><a href="/docs/">Home</a></li><li><a href="/docs/whats-new.html">What&#39;s new</a></li><li><a href="/docs/reference.html">Command reference</a></li><li><a href="/docs/gallery/">Gallery</a></li></ul><h2>Getting started</h2><ul><li><a href="/docs/essentials/command-line.html">The command-line tool</a></li><li><a href="/docs/essentials/web-app.html" class="is-active">The web app</a></li></ul><h2>Examples</h2><ul><li><a href="/docs/examples/basics.html">Basics</a></li><li><a href="/docs/examples/globe.html">Globe locator map</a></li><li><a href="/docs/examples/us-states.html">U.S. state map</a></li><li><a href="/docs/examples/ny-state.html">New York map</a></li></ul><h2>Guides</h2><ul><li><a href="/docs/guides/simplification.html">Simplification</a></li><li><a href="/docs/guides/expressions.html">JavaScript expressions</a></li><li><a href="/docs/guides/projections.html">Projections</a></li><li><a href="/docs/guides/topology.html">Topology and cleaning</a></li><li><a href="/docs/guides/combining-layers.html">Combining two layers</a></li><li><a href="/docs/guides/programmatic.html">Using Mapshaper from Node.js</a></li></ul><h2>Formats</h2><ul><li><a href="/docs/formats/overview.html">Overview</a></li><li><a href="/docs/formats/shapefile.html">Shapefile</a></li><li><a href="/docs/formats/geojson.html">GeoJSON</a></li><li><a href="/docs/formats/topojson.html">TopoJSON</a></li><li><a href="/docs/formats/geopackage.html">GeoPackage</a></li><li><a href="/docs/formats/geoparquet.html">GeoParquet</a></li><li><a href="/docs/formats/flatgeobuf.html">FlatGeobuf</a></li><li><a href="/docs/formats/kml.html">KML / KMZ</a></li><li><a href="/docs/formats/csv.html">CSV / TSV</a></li><li><a href="/docs/formats/json.html">JSON records</a></li><li><a href="/docs/formats/dbf.html">DBF</a></li><li><a href="/docs/formats/svg.html">SVG</a></li><li><a href="/docs/formats/snapshot.html">Mapshaper snapshot</a></li></ul></nav>
44+
<nav class="docs-nav"><ul class="top-links"><li><a href="/docs/">Home</a></li><li><a href="/docs/whats-new.html">What&#39;s new</a></li><li><a href="/docs/reference.html">Command reference</a></li><li><a href="/docs/gallery/">Gallery</a></li></ul><h2>Getting started</h2><ul><li><a href="/docs/essentials/command-line.html">The command-line tool</a></li><li><a href="/docs/essentials/web-app.html" class="is-active">The web app</a></li></ul><h2>Examples</h2><ul><li><a href="/docs/examples/basics.html">Basics</a></li><li><a href="/docs/examples/globe.html">Globe locator map</a></li><li><a href="/docs/examples/us-states.html">U.S. state map</a></li><li><a href="/docs/examples/ny-state.html">New York map</a></li></ul><h2>Guides</h2><ul><li><a href="/docs/guides/simplification.html">Simplification</a></li><li><a href="/docs/guides/styles-and-symbols.html">Styles and Symbols</a></li><li><a href="/docs/guides/expressions.html">JavaScript expressions</a></li><li><a href="/docs/guides/projections.html">Projections</a></li><li><a href="/docs/guides/topology.html">Topology and cleaning</a></li><li><a href="/docs/guides/combining-layers.html">Combining two layers</a></li><li><a href="/docs/guides/programmatic.html">Using Mapshaper from Node.js</a></li></ul><h2>Formats</h2><ul><li><a href="/docs/formats/overview.html">Overview</a></li><li><a href="/docs/formats/shapefile.html">Shapefile</a></li><li><a href="/docs/formats/geojson.html">GeoJSON</a></li><li><a href="/docs/formats/topojson.html">TopoJSON</a></li><li><a href="/docs/formats/geopackage.html">GeoPackage</a></li><li><a href="/docs/formats/geoparquet.html">GeoParquet</a></li><li><a href="/docs/formats/flatgeobuf.html">FlatGeobuf</a></li><li><a href="/docs/formats/kml.html">KML / KMZ</a></li><li><a href="/docs/formats/csv.html">CSV / TSV</a></li><li><a href="/docs/formats/json.html">JSON records</a></li><li><a href="/docs/formats/dbf.html">DBF</a></li><li><a href="/docs/formats/svg.html">SVG</a></li><li><a href="/docs/formats/snapshot.html">Mapshaper snapshot</a></li></ul></nav>
4545
</div>
4646
</aside>
4747

@@ -77,14 +77,36 @@ <h3 id="keyboard">Keyboard</h3>
7777
</ul>
7878
<h3 id="syntax">Syntax</h3>
7979
<ul>
80-
<li>The leading <code>-</code> is optional in the console: <code>clip places</code> works the same as <code>-clip places</code>.</li>
80+
<li>The leading <code>-</code> is optional for a single console command: <code>clip places</code> works the same as <code>-clip places</code>.</li>
81+
<li>When entering a sequence of commands, include the leading <code>-</code> before each command after the first. The examples in these docs include leading <code>-</code> prefixes because that style works in both the web console and the CLI.</li>
8182
<li>Commands run on the <strong>currently-selected layer</strong> by default. Switch layers in the layer panel before issuing a command, or pass <code>target=</code> to be explicit (<code>target=*</code> runs against every layer).</li>
8283
</ul>
84+
<h3 id="using-cli-examples-in-the-web-console">Using CLI examples in the web console</h3>
85+
<p>Many Mapshaper examples are written for the command line. To run them in the web app, first load your data by dragging it onto the page or using <strong>Add files</strong>, then type only the editing commands in the Console.</p>
86+
<p>For example, this command-line example:</p>
87+
<pre><code class="hljs language-bash">mapshaper counties.shp -filter <span class="hljs-string">&#x27;STATE == &quot;CA&quot;&#x27;</span> -simplify 10% keep-shapes -o california.geojson
88+
</code></pre>
89+
<p>becomes this in the web console:</p>
90+
<pre><code class="hljs language-text">-filter &#x27;STATE == &quot;CA&quot;&#x27; \
91+
-simplify 10% keep-shapes
92+
</code></pre>
93+
<p>Use the <strong>Export</strong> button when you&#39;re ready to save the result.</p>
94+
<p>The general rules are:</p>
95+
<ul>
96+
<li>Drop the initial <code>mapshaper</code> command.</li>
97+
<li>Drop input filenames such as <code>counties.shp</code> after your data has been loaded.</li>
98+
<li>Don&#39;t use file-loading commands like <code>-i</code>, <code>-include</code> or <code>-require</code>; they are disabled in the browser console.</li>
99+
<li>Keep the leading <code>-</code> on command names when copying examples from the docs. It works in the web console and avoids confusion in command sequences.</li>
100+
<li>Use <code>target=</code> when you want a command to operate on a layer other than the currently selected layer.</li>
101+
<li>Export from the web UI instead of copying the CLI <code>-o output.geojson</code> part of an example.</li>
102+
</ul>
83103
<h3 id="magic-words-at-the-prompt">Magic words at the prompt</h3>
84104
<p>These are recognized directly by the console, not by Mapshaper:</p>
85105
<ul>
86106
<li><code>history</code> &mdash; print the current session as a single command-line string. Handy for reproducing an interactive workflow as a script.</li>
87107
<li><code>layers</code> &mdash; print the list of loaded layers.</li>
108+
<li><code>context</code> &mdash; print the current runtime context as JSON. This is the metadata that can be shared with debugging tools or a help bot: layer names, field names/types, counts, CRS, recent commands and recent messages, but not geometry or attribute records.</li>
109+
<li><code>context download</code> &mdash; save the same runtime context JSON to a local file.</li>
88110
<li><code>clear</code> &mdash; clear the console buffer.</li>
89111
<li><code>close</code> / <code>exit</code> / <code>quit</code> &mdash; close the console.</li>
90112
</ul>
@@ -124,10 +146,25 @@ <h2 id="running-the-web-ui-locally">Running the web UI locally</h2>
124146
<p>You can pre-load files by listing them on the command line, which skips the import dialog:</p>
125147
<pre><code class="hljs language-bash">mapshaper-gui states.shp rivers.shp
126148
</code></pre>
149+
<h2 id="optional-ai-assistant">Optional AI assistant</h2>
150+
<p>Some Mapshaper installations may enable an optional AI assistant by serving an <code>ai-config.js</code> file alongside the web app. If the file is missing or disabled, no assistant UI is shown.</p>
151+
<p>When enabled, the assistant can receive the same runtime context shown by the console&#39;s <code>context</code> command: layer names, field names/types, feature counts, CRS, recent commands and recent messages. It does not include geometry or full attribute records.</p>
152+
<p>Development builds can use a mock assistant or direct provider calls from <code>localhost</code>. Production deployments should use a proxy endpoint so provider secrets, rate limits and logging policy are not exposed in the browser.</p>
153+
<p>An <code>ai-config.js</code> file can also point the assistant at static documentation, such as <code>llms-full.txt</code>, for providers or proxies that support prompt caching:</p>
154+
<pre><code class="hljs language-js"><span class="hljs-variable language_">window</span>.<span class="hljs-property">mapshaperAI</span> = {
155+
<span class="hljs-attr">enabled</span>: <span class="hljs-literal">true</span>,
156+
<span class="hljs-attr">mode</span>: <span class="hljs-string">&quot;proxy&quot;</span>,
157+
<span class="hljs-attr">endpoint</span>: <span class="hljs-string">&quot;/api/mapshaper-assist&quot;</span>,
158+
<span class="hljs-attr">staticContextUrl</span>: <span class="hljs-string">&quot;/llms-full.txt&quot;</span>,
159+
<span class="hljs-attr">cacheControl</span>: {<span class="hljs-attr">type</span>: <span class="hljs-string">&quot;ephemeral&quot;</span>},
160+
<span class="hljs-attr">cacheTtl</span>: <span class="hljs-string">&quot;1h&quot;</span>
161+
};
162+
</code></pre>
163+
<p>For local testing without a proxy, <code>mode: &quot;direct&quot;</code> supports OpenAI-compatible Responses requests and Anthropic Messages requests. Anthropic direct mode sends static context as cacheable system content when <code>provider: &quot;anthropic&quot;</code> is configured. Direct mode should only be used with disposable development keys on <code>localhost</code>.</p>
127164
<h2 id="browser-support">Browser support</h2>
128165
<p>When importing very large files (hundreds of megabytes), the web app may run out of memory and crash. Firefox used to be better than Chrome at handling large files, but Chrome seems to have improved recently. If the web app crashes, try the <a href="/docs/essentials/command-line.html"><code>mapshaper-xl</code> command-line tool</a>, which can allocate a large amount of memory.</p>
129166
<h2 id="privacy">Privacy</h2>
130-
<p>The Mapshaper web app runs entirely in your browser. No file content is uploaded to any server. The only network traffic is for static assets (the app itself), basemap tiles when you&#39;ve enabled a basemap, and analytics for <code>mapshaper.org</code> page loads. See the <a href="/privacy.html">privacy policy</a> for details.</p>
167+
<p>The Mapshaper web app runs entirely in your browser. No file content is uploaded to any server. The only network traffic is for static assets (the app itself), basemap tiles when you&#39;ve enabled a basemap, optional AI assistant requests when an installation has enabled them, and analytics for <code>mapshaper.org</code> page loads. See the <a href="/privacy.html">privacy policy</a> for details.</p>
131168

132169
<div class="edit-link">
133170
<a href="https://github.com/mbloch/mapshaper/edit/master/docs/essentials/web-app.md">Edit this page on GitHub</a>
@@ -136,7 +173,7 @@ <h2 id="privacy">Privacy</h2>
136173
</main>
137174

138175
<aside class="docs-toc">
139-
<div class="docs-toc-title">On this page</div><ul><li class="lvl-2"><a href="#loading-data">Loading data</a></li><li class="lvl-3"><a href="#tips-for-importing-shapefiles">Tips for importing Shapefiles</a></li><li class="lvl-2"><a href="#the-console">The console</a></li><li class="lvl-3"><a href="#keyboard">Keyboard</a></li><li class="lvl-3"><a href="#syntax">Syntax</a></li><li class="lvl-3"><a href="#magic-words-at-the-prompt">Magic words at the prompt</a></li><li class="lvl-3"><a href="#discovering-commands">Discovering commands</a></li><li class="lvl-2"><a href="#the-map">The map</a></li><li class="lvl-3"><a href="#right-click-menu">Right-click menu</a></li><li class="lvl-3"><a href="#layer-navigation">Layer navigation</a></li><li class="lvl-2"><a href="#display-options">Display options</a></li><li class="lvl-2"><a href="#snapshots-and-session-history">Snapshots and session history</a></li><li class="lvl-2"><a href="#running-the-web-ui-locally">Running the web UI locally</a></li><li class="lvl-2"><a href="#browser-support">Browser support</a></li><li class="lvl-2"><a href="#privacy">Privacy</a></li></ul>
176+
<div class="docs-toc-title">On this page</div><ul><li class="lvl-2"><a href="#loading-data">Loading data</a></li><li class="lvl-3"><a href="#tips-for-importing-shapefiles">Tips for importing Shapefiles</a></li><li class="lvl-2"><a href="#the-console">The console</a></li><li class="lvl-3"><a href="#keyboard">Keyboard</a></li><li class="lvl-3"><a href="#syntax">Syntax</a></li><li class="lvl-3"><a href="#using-cli-examples-in-the-web-console">Using CLI examples in the web console</a></li><li class="lvl-3"><a href="#magic-words-at-the-prompt">Magic words at the prompt</a></li><li class="lvl-3"><a href="#discovering-commands">Discovering commands</a></li><li class="lvl-2"><a href="#the-map">The map</a></li><li class="lvl-3"><a href="#right-click-menu">Right-click menu</a></li><li class="lvl-3"><a href="#layer-navigation">Layer navigation</a></li><li class="lvl-2"><a href="#display-options">Display options</a></li><li class="lvl-2"><a href="#snapshots-and-session-history">Snapshots and session history</a></li><li class="lvl-2"><a href="#running-the-web-ui-locally">Running the web UI locally</a></li><li class="lvl-2"><a href="#optional-ai-assistant">Optional AI assistant</a></li><li class="lvl-2"><a href="#browser-support">Browser support</a></li><li class="lvl-2"><a href="#privacy">Privacy</a></li></ul>
140177
</aside>
141178

142179
</div>

0 commit comments

Comments
 (0)