maplibre-gl-geoagent 0.3.1 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +53 -0
  2. package/dist/{GeoAgentControl-DzBY1NXW.cjs → GeoAgentControl-Cc0HuUPf.cjs} +3022 -54
  3. package/dist/GeoAgentControl-Cc0HuUPf.cjs.map +1 -0
  4. package/dist/{GeoAgentControl-DOAYVbPg.js → GeoAgentControl-CfSj1n01.js} +3024 -56
  5. package/dist/GeoAgentControl-CfSj1n01.js.map +1 -0
  6. package/dist/{anthropic-DhbSHleV.js → anthropic-BVBhgJNP.js} +2 -2
  7. package/dist/{anthropic-DhbSHleV.js.map → anthropic-BVBhgJNP.js.map} +1 -1
  8. package/dist/{anthropic-C31X7JK8.cjs → anthropic-BfFYVXzE.cjs} +2 -2
  9. package/dist/{anthropic-C31X7JK8.cjs.map → anthropic-BfFYVXzE.cjs.map} +1 -1
  10. package/dist/browser-BtMWNaZj.cjs +28032 -0
  11. package/dist/browser-BtMWNaZj.cjs.map +1 -0
  12. package/dist/browser-D437ICBx.js +28033 -0
  13. package/dist/browser-D437ICBx.js.map +1 -0
  14. package/dist/{index-Bbu2vTKz.js → index-CVvcPs8z.js} +2 -2
  15. package/dist/{index-Bbu2vTKz.js.map → index-CVvcPs8z.js.map} +1 -1
  16. package/dist/{index-BU4LZEvR.js → index-CeL5qxhv.js} +2 -2
  17. package/dist/{index-BU4LZEvR.js.map → index-CeL5qxhv.js.map} +1 -1
  18. package/dist/{index-DXB0TYg3.js → index-D0hzZEUn.js} +2 -2
  19. package/dist/{index-DXB0TYg3.js.map → index-D0hzZEUn.js.map} +1 -1
  20. package/dist/{index-C0CcPtSz.cjs → index-DGr_aIvw.cjs} +2 -2
  21. package/dist/{index-C0CcPtSz.cjs.map → index-DGr_aIvw.cjs.map} +1 -1
  22. package/dist/{index-1fng-HVi.cjs → index-DaOfppi1.cjs} +2 -2
  23. package/dist/{index-1fng-HVi.cjs.map → index-DaOfppi1.cjs.map} +1 -1
  24. package/dist/{index-DrL1mot0.cjs → index-DumDV1aY.cjs} +2 -2
  25. package/dist/{index-DrL1mot0.cjs.map → index-DumDV1aY.cjs.map} +1 -1
  26. package/dist/index.cjs +1 -1
  27. package/dist/index.mjs +1 -1
  28. package/dist/maplibre-gl-geoagent.css +37 -0
  29. package/dist/react.cjs +1 -1
  30. package/dist/react.mjs +1 -1
  31. package/dist/types/index.d.ts +1 -0
  32. package/dist/types/index.d.ts.map +1 -1
  33. package/dist/types/lib/core/GeoAgentControl.d.ts +7 -0
  34. package/dist/types/lib/core/GeoAgentControl.d.ts.map +1 -1
  35. package/dist/types/lib/core/earth-engine.d.ts +186 -0
  36. package/dist/types/lib/core/earth-engine.d.ts.map +1 -0
  37. package/dist/types/lib/core/maplibre-tools.d.ts +37 -1
  38. package/dist/types/lib/core/maplibre-tools.d.ts.map +1 -1
  39. package/dist/types/lib/core/types.d.ts +7 -0
  40. package/dist/types/lib/core/types.d.ts.map +1 -1
  41. package/package.json +2 -1
  42. package/dist/GeoAgentControl-DOAYVbPg.js.map +0 -1
  43. package/dist/GeoAgentControl-DzBY1NXW.cjs.map +0 -1
package/README.md CHANGED
@@ -14,6 +14,7 @@ inspect and operate on the live map through dedicated browser tools.
14
14
  - Collapsible MapLibre control with a floating chat panel
15
15
  - Browser provider UI for OpenAI Responses, OpenAI Chat, Anthropic, Google Gemini, and Amazon Bedrock
16
16
  - Map tools for camera movement, projection, basemaps, markers, GeoJSON, XYZ tiles, layer visibility, opacity, feature queries, screenshots, and layer cleanup
17
+ - Optional Google Earth Engine tools for catalog search, OAuth initialization, dataset tile layers, normalized difference indexes, visualization updates, snippets, and bounded statistics
17
18
  - Optional MapLibre JavaScript execution tool, disabled by default
18
19
  - Destructive layer removal tools gated behind a separate toggle
19
20
  - Copy the visible conversation log as Markdown
@@ -134,6 +135,45 @@ Converse model ID, and set the AWS region. The default Bedrock model is
134
135
  | `allowDestructiveToolsDefault` | `boolean` | `true` |
135
136
  | `showPermissionToggles` | `boolean` | `false` |
136
137
  | `basemaps` | `Record<string, string \| StyleSpecification>` | built-in basemaps |
138
+ | `earthEngine` | `EarthEngineOptions` | `undefined` |
139
+
140
+ ### Earth Engine Options
141
+
142
+ ```typescript
143
+ new GeoAgentControl({
144
+ earthEngine: {
145
+ oauthClientId: "YOUR_GOOGLE_OAUTH_CLIENT_ID",
146
+ projectId: "your-earth-engine-project",
147
+ includeCommunityCatalog: true,
148
+ },
149
+ });
150
+ ```
151
+
152
+ The Earth Engine integration uses browser OAuth through the official
153
+ `@google/earthengine` package. Service account private keys are intentionally
154
+ not supported in this browser-only package. Use a backend proxy if your
155
+ deployment needs service account access.
156
+
157
+ Host applications that already authenticate Earth Engine outside the browser
158
+ can provide a short-lived OAuth access token instead of launching browser
159
+ OAuth:
160
+
161
+ ```typescript
162
+ new GeoAgentControl({
163
+ earthEngine: {
164
+ accessToken: "SHORT_LIVED_EARTH_ENGINE_ACCESS_TOKEN",
165
+ tokenType: "Bearer",
166
+ tokenExpiresIn: 3600,
167
+ projectId: "your-earth-engine-project",
168
+ includeCommunityCatalog: true,
169
+ },
170
+ });
171
+ ```
172
+
173
+ Access tokens are passed to the browser JavaScript runtime and should be
174
+ short-lived. Do not persist them in page source, notebooks, local storage, or
175
+ session storage. For untrusted users or production deployments, prefer a
176
+ backend proxy.
137
177
 
138
178
  ## Browser Credentials
139
179
 
@@ -168,6 +208,14 @@ Change the basemap to dark, then get the current map state.
168
208
  Add the GeoJSON URL https://raw.githubusercontent.com/plotly/datasets/master/geojson-counties-fips.json as US counties.
169
209
  ```
170
210
 
211
+ ```text
212
+ Search Google Earth Engine for SRTM elevation datasets, then add the SRTM image with a terrain palette.
213
+ ```
214
+
215
+ ```text
216
+ Load Sentinel-2 surface reflectance for Knoxville in June 2024 and calculate NDVI using B8 and B4.
217
+ ```
218
+
171
219
  ```text
172
220
  Hide the US counties layer, then show it again.
173
221
  ```
@@ -187,8 +235,13 @@ What features are visible at the center of the current map?
187
235
 
188
236
  ```bash
189
237
  npm install
238
+ cp .env.example .env
190
239
  npm run dev
191
240
  npm test
192
241
  npm run build
193
242
  npm run build:examples
194
243
  ```
244
+
245
+ For the Earth Engine example, set `VITE_GEE_OAUTH_CLIENT_ID` in `.env`.
246
+ `VITE_GEE_PROJECT_ID` is optional; when it is omitted, users can enter their
247
+ own Earth Engine-enabled Google Cloud project ID in the GeoAgent panel.