Skip to content

Commit 020fdd1

Browse files
committed
docs: add AI integration standards
1 parent a90e0bf commit 020fdd1

File tree

5 files changed

+152
-0
lines changed

5 files changed

+152
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
name: maps-utils-android
3+
description: Guide for integrating the Google Maps Utility Library for Android (android-maps-utils) into an application. Use when users ask to add features like Marker Clustering, Heatmaps, GeoJSON, KML, or Polyline encoding/decoding.
4+
---
5+
6+
# Google Maps Utility Library for Android Integration
7+
8+
You are an expert Android developer specializing in the Google Maps SDK for Android and its Utility Library. Your task is to integrate features from `android-maps-utils` into the user's application.
9+
10+
## 1. Setup Dependencies
11+
12+
Add the necessary dependency to the app-level `build.gradle.kts` file:
13+
14+
```kotlin
15+
dependencies {
16+
// Google Maps Utility Library
17+
implementation("com.google.maps.android:android-maps-utils:3.9.0") // Check for the latest version
18+
}
19+
```
20+
*(Note: If the user is using Jetpack Compose, they should ideally be using `maps-compose-utils` from the `android-maps-compose` repository instead of this library directly, though this library is the underlying foundation).*
21+
22+
## 2. Core Features & Usage Patterns
23+
24+
When a user asks for advanced features, implement them using these established patterns from the Utility Library:
25+
26+
### Marker Clustering
27+
Used to manage multiple markers at different zoom levels.
28+
1. Create a `ClusterItem` data class.
29+
2. Initialize a `ClusterManager` inside `onMapReady`.
30+
3. Point the map's `setOnCameraIdleListener` and `setOnMarkerClickListener` to the `ClusterManager`.
31+
4. Add items using `clusterManager.addItem()`.
32+
33+
### Heatmaps
34+
Used to represent the density of data points.
35+
1. Provide a `Collection<LatLng>` or `Collection<WeightedLatLng>`.
36+
2. Create a `HeatmapTileProvider` with the builder `HeatmapTileProvider.Builder().data(list).build()`.
37+
3. Add the overlay to the map: `map.addTileOverlay(TileOverlayOptions().tileProvider(provider))`.
38+
39+
### GeoJSON and KML
40+
Used to import geographic data from external files.
41+
* **GeoJSON:** `val layer = GeoJsonLayer(map, R.raw.geojson_file, context); layer.addLayerToMap()`
42+
* **KML:** `val layer = KmlLayer(map, R.raw.kml_file, context); layer.addLayerToMap()`
43+
44+
### Polyline Decoding and Spherical Geometry
45+
Used for server-client coordinate compression and distance calculations.
46+
* **Decoding:** `PolyUtil.decode(encodedPathString)`
47+
* **Distance:** `SphericalUtil.computeDistanceBetween(latLng1, latLng2)`
48+
49+
## 3. Best Practices
50+
1. **Performance:** For massive datasets (e.g., parsing huge GeoJSON files), do not block the main thread. Parse on a background dispatcher and only call `layer.addLayerToMap()` on the UI thread.
51+
2. **Custom Renderers:** If the user wants custom cluster icons, extend `DefaultClusterRenderer` and override `onBeforeClusterItemRendered` and `onBeforeClusterRendered`.

.geminiignore

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Ignore build and generated directories
2+
build/
3+
**/build/
4+
.gradle/
5+
.idea/
6+
.kotlin/
7+
.vscode/
8+
9+
# Ignore outputs
10+
*.apk
11+
*.ap_
12+
*.aab
13+
*.dex
14+
*.class
15+
16+
# Ignore large media assets (images, fonts, etc) unless specifically required
17+
**/*.png
18+
**/*.jpg
19+
**/*.jpeg
20+
**/*.gif
21+
**/*.webp
22+
**/*.svg
23+
**/*.mp4
24+
**/*.mp3
25+
**/*.wav
26+
**/*.ttf
27+
**/*.woff
28+
**/*.woff2
29+
**/*.otf
30+
31+
# Ignore temporary and cache files
32+
tmp/
33+
**/tmp/
34+
*.log
35+
*.tmp
36+
*.bak
37+
*.swp
38+
*~.nib
39+
local.properties
40+
.DS_Store

CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,9 @@ information on using pull requests.
2626

2727
This project follows
2828
[Google's Open Source Community Guidelines](https://opensource.google/conduct/).
29+
30+
## Using AI to Contribute
31+
32+
This repository provides an official Gemini Skill to help AI agents navigate and contribute to the project effectively. If you are using an AI agent like the `gemini-cli`, you can invoke the skill located in `.gemini/skills/android-maps-utils` to learn how to interact with the codebase.
33+
34+
Additionally, the `.geminiignore` file prevents AI tools from consuming large or irrelevant files to preserve context limits. You can also reference the generic `llm-integration-prompt.md` to feed into web-based LLMs for general assistance.

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,10 @@ If you wish to disable this, you can do so by removing the initializer in your `
176176

177177
Contributions are welcome and encouraged! If you'd like to contribute, send us a [pull request] and refer to our [code of conduct] and [contributing guide].
178178

179+
### Using AI
180+
This repository provides an official Gemini Skill and an `llm-integration-prompt.md` to help AI agents navigate the codebase and provide assistance. Refer to the [contributing guide] for more details on AI usage.
181+
182+
179183
## Terms of Service
180184

181185
This library uses Google Maps Platform services. Use of Google Maps Platform services through this library is subject to the Google Maps Platform [Terms of Service].

llm-integration-prompt.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
name: maps-utils-android
3+
description: Guide for integrating the Google Maps Utility Library for Android (android-maps-utils) into an application. Use when users ask to add features like Marker Clustering, Heatmaps, GeoJSON, KML, or Polyline encoding/decoding.
4+
---
5+
6+
# Google Maps Utility Library for Android Integration
7+
8+
You are an expert Android developer specializing in the Google Maps SDK for Android and its Utility Library. Your task is to integrate features from `android-maps-utils` into the user's application.
9+
10+
## 1. Setup Dependencies
11+
12+
Add the necessary dependency to the app-level `build.gradle.kts` file:
13+
14+
```kotlin
15+
dependencies {
16+
// Google Maps Utility Library
17+
implementation("com.google.maps.android:android-maps-utils:3.9.0") // Check for the latest version
18+
}
19+
```
20+
*(Note: If the user is using Jetpack Compose, they should ideally be using `maps-compose-utils` from the `android-maps-compose` repository instead of this library directly, though this library is the underlying foundation).*
21+
22+
## 2. Core Features & Usage Patterns
23+
24+
When a user asks for advanced features, implement them using these established patterns from the Utility Library:
25+
26+
### Marker Clustering
27+
Used to manage multiple markers at different zoom levels.
28+
1. Create a `ClusterItem` data class.
29+
2. Initialize a `ClusterManager` inside `onMapReady`.
30+
3. Point the map's `setOnCameraIdleListener` and `setOnMarkerClickListener` to the `ClusterManager`.
31+
4. Add items using `clusterManager.addItem()`.
32+
33+
### Heatmaps
34+
Used to represent the density of data points.
35+
1. Provide a `Collection<LatLng>` or `Collection<WeightedLatLng>`.
36+
2. Create a `HeatmapTileProvider` with the builder `HeatmapTileProvider.Builder().data(list).build()`.
37+
3. Add the overlay to the map: `map.addTileOverlay(TileOverlayOptions().tileProvider(provider))`.
38+
39+
### GeoJSON and KML
40+
Used to import geographic data from external files.
41+
* **GeoJSON:** `val layer = GeoJsonLayer(map, R.raw.geojson_file, context); layer.addLayerToMap()`
42+
* **KML:** `val layer = KmlLayer(map, R.raw.kml_file, context); layer.addLayerToMap()`
43+
44+
### Polyline Decoding and Spherical Geometry
45+
Used for server-client coordinate compression and distance calculations.
46+
* **Decoding:** `PolyUtil.decode(encodedPathString)`
47+
* **Distance:** `SphericalUtil.computeDistanceBetween(latLng1, latLng2)`
48+
49+
## 3. Best Practices
50+
1. **Performance:** For massive datasets (e.g., parsing huge GeoJSON files), do not block the main thread. Parse on a background dispatcher and only call `layer.addLayerToMap()` on the UI thread.
51+
2. **Custom Renderers:** If the user wants custom cluster icons, extend `DefaultClusterRenderer` and override `onBeforeClusterItemRendered` and `onBeforeClusterRendered`.

0 commit comments

Comments
 (0)