|
1 | | -# Using the Gemini API and Google Maps Platform with TypeScript |
| 1 | +# GeoAI-Navigator |
2 | 2 |
|
3 | | -This template provides a sample app demonstrating use of the Gemini API with multimodal inputs (images and text) and the Google Maps JavaScript API. |
| 3 | +A sample web application demonstrating how to integrate Google’s Gemini generative AI with the Google Maps Platform (Maps JavaScript API) using TypeScript and Vite. |
| 4 | + |
| 5 | +## Table of ContentsFeatures |
| 6 | + |
| 7 | +1. [Features](#features) |
| 8 | +2. [Prerequisites](#prerequisites) |
| 9 | +3. [Getting Started](#getting-started) |
| 10 | +4. [Environment Variables](#environment-variables) |
| 11 | +5. [Folder Structure](#folder-structure) |
| 12 | +6. [Usage](#usage) |
| 13 | +7. [Contributing](#contributing) |
| 14 | +8. [License](#license) |
| 15 | + |
| 16 | +## Features |
| 17 | + |
| 18 | +- **Multimodal Place Recognition**: Upload an image and ask the Gemini API “Where can I see this?” |
| 19 | +- **Text Prompt Refinement**: Use the Gemini API to enhance and refine user-generated review text. |
| 20 | +- **Photorealistic 3D Map** (Experimental): Render a tilt‑and‑heading controlled 3D map view. |
| 21 | +- **Geocoding**: Convert AI‑generated place names into latitude/longitude coordinates. |
| 22 | +- **Nearby Lodging Search**: Retrieve and display lodging options around the identified location. |
| 23 | +- **Split-Layout UI**: Display interactive map and place overview cards in a responsive split layout using Google’s Extended Component Library. |
4 | 24 |
|
5 | 25 | ## Prerequisites |
6 | 26 |
|
7 | | -### Gemini API |
| 27 | +- Node.js (v16+) |
| 28 | +- npm or yarn |
| 29 | +- A Google Cloud project with: |
| 30 | + - **Gemini AI** enabled |
| 31 | + - **Maps JavaScript API** enabled |
8 | 32 |
|
9 | | -In order for the Gemini API features to work, you'll need to add a Gemini API key as a local variable. |
| 33 | +## Getting Started |
10 | 34 |
|
11 | | -1. Open the Project IDX view by pressing Ctrl+Shift+P / Cmd+Shift+P and type "IDX focus", then select "IDX: Focus on Project IDX View" |
12 | | -2. Click on the "Gemini API" integration and authenticate. |
13 | | -3. Click "Get API Key" to get an API key. |
14 | | -4. Create or open a file named .env.local in the root directory. The .local suffix keeps secrets out of source control. |
15 | | -5. In the file, add the line: VITE_GEMINI_API_KEY=YOUR_API_KEY. |
16 | | -6. Replace YOUR_API_KEY with the API key you got in step 3. |
| 35 | +1. Clone the repository |
| 36 | + ```bash |
| 37 | + git clone https://github.com/CodeRTX/GeoAI-Navigator.git |
| 38 | + cd GeoAI-Navigator |
| 39 | + ``` |
| 40 | +2. Install dependencies |
| 41 | + ```bash |
| 42 | + npm install |
| 43 | + # or |
| 44 | + yarn install |
| 45 | + ``` |
| 46 | +3. Setup environment variables (see [Environment Variables](#environment-variables)) |
| 47 | +4. Start the development server |
| 48 | + ```bash |
| 49 | + npm run dev |
| 50 | + # or |
| 51 | + yarn devVisit |
| 52 | + ``` |
| 53 | +5. `http://localhost:5173` in your browser. |
17 | 54 |
|
18 | | -### Google Maps Platform, Maps JavaScript API |
| 55 | +## Environment Variables |
19 | 56 |
|
20 | | -In order for the Maps JavaScript API features to work, you'll need to add a Google Maps Platform API key as a local variable. |
| 57 | +Create a file named `.env.local` in the project root with the following keys: |
| 58 | + VITE_GEMINI_API_KEY=YOUR_GEMINI_API_KEY |
| 59 | + VITE_MAPS_API_KEY=YOUR_GOOGLE_MAPS_API_KEY |
| 60 | +> **Note**: The `.local` suffix prevents accidental commits of sensitive keys to source control. |
21 | 61 |
|
22 | | -1. Open the Project IDX view by pressing Ctrl+Shift+P / Cmd+Shift+P and type "IDX focus", then select "IDX: Focus on Project IDX View" |
23 | | -2. Click on the "Google Maps Platform" integration. |
24 | | -3. Click "Enable APIs" to enable the Google Maps Platform APIs. |
25 | | -4. Click "Get API Key" to get an API key. |
26 | | -5. Create or open the file named .env.local in the root directory. The .local suffix keeps secrets out of source control. |
27 | | -6. In the file, add the line: VITE_MAPS_API_KEY=YOUR_API_KEY. |
28 | | -7. Replace YOUR_API_KEY with the API key you got in step 4. |
| 62 | +## Folder Structure |
29 | 63 |
|
30 | | -## Features |
| 64 | +GeoAI-Navigator/ |
| 65 | +├── public/ # Static assets (index.html, favicon) |
| 66 | +├── src/ # Application source code |
| 67 | +│ ├── main.ts # Entry point |
| 68 | +│ └── style.css # Basic styles |
| 69 | +├── .env.local # Environment variables (not shown) |
| 70 | +├── .gitignore |
| 71 | +├── package.json |
| 72 | +├── tsconfig.json |
| 73 | +├── vite.config.js |
| 74 | +└── README.md |
| 75 | + |
| 76 | +## Usage |
| 77 | + |
| 78 | + -Placeholder- |
31 | 79 |
|
32 | | -Most of the code powering the features of this sample are in the `src/main.ts` file. |
| 80 | +## Contributing |
33 | 81 |
|
34 | | -### Gemini API |
| 82 | +Contributions are welcome! Please open an issue or submit a pull request with a clear description of your changes. |
35 | 83 |
|
36 | | -- Image + text prompt: When the user selects an image and presses the "Where can I see this?" button, that image and a text prompt are sent to the Gemini API. |
37 | | -- Text-only prompt: The Gemini API is used to augment and refine the draft review of a destination. |
| 84 | +## License |
38 | 85 |
|
| 86 | +This project is licensed under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). |
| 87 | + |
39 | 88 | ### Google Maps Platform, Maps JavaScript API |
40 | 89 |
|
41 | 90 | - [Photorealistic 3D map (Experimental)](https://developers.google.com/maps/documentation/javascript/3d-maps-overview) in the Maps JavaScript API |
|
0 commit comments