google-maps-api

Complete Google Maps Platform API client - 20+ APIs including geocoding, routes, places, weather, air quality, pollen, solar, elevation, timezone, address validation, roads, street view, and more

By tivojn · 391 installs

npx skills add tivojn/google-maps-api-skill --skill google-maps-api

Source repository · Upstream listing

Google Maps Platform Universal API Skill Critical Behavior Rules These rules override all other instructions in this skill: 1. Communicate blockers immediately. When ANY API call fails (403, REQUEST DENIED, "not enabled", etc.), STOP and tell the user what happened in plain language. Do NOT silently work around it with web search or other fallbacks. Offer to fix it via Playwright (see "Guided API Enablement" section below). 2. Ask before generating HTML. NEVER start writing an HTML page without asking the user first. They may just want a text answer, JSON output, or a quick summary. Ask: "Want me to make an interactive HTML page for this, or is a text summary enough?" 3. Ask before choosing output format. When the user's request could be answered as text, JSON, or a visual page, ask which they prefer. Don't assume. Overview Full featured CLI client for every Google Maps Platform REST API. Unlike the browser based google maps skill, this skill calls Google's APIs directly for fast, structured JSON responses. Covers 20+ APIs across maps, routes, places, environment, and geospatial services. Setup 1. Get a Google Maps API Key 1. Go to [Google Cloud Console](https://console.cloud.google.com/) 2. Create or select a project 3. Enable the APIs you need (see API list below) 4. Go to APIs & Services Credentials and create an API key 5. (Recommended) Restrict the key to only the APIs you need 2. Save the API Key Add to your .env file in any of these locations (searched in order): 3. Enable Required APIs In Google Cloud Console APIs & Services Library, enable the APIs you need: API Name Console Name Geocoding Geocoding API Routes Routes API Places Places API (New) Elevation Elevation API Time Zone Time Zone API Air Quality Air Quality API Pollen Pollen API Solar Solar API Weather Weather API Address Validation Address Validation API Roads Roads API Street View Street View Static API Static Maps Maps Static API Geolocation Geolocation API Aerial View Aerial View API Route Optimization Route Optimization API Places Aggregate Places Insights API Script Location No external dependencies required uses only Python standard library ( urllib , json , ssl ). Complete API Reference 1. Geocoding Forward geocode address to coordinates: Reverse geocode coordinates to address: 2. Routes & Directions Get directions between two locations: Distance matrix multiple origins/destinations: 3. Places Text search find places by query: Nearby search find places near coordinates: Place details full info for a place: Autocomplete type ahead suggestions: Place photo get photo URL: 4. Air Quality Current conditions : Historical data (up to 30 days): Forecast (up to 96 hours): 5. Pollen Pollen forecast (up to 5 days, grass/weed/tree): Returns: Universal Pollen Index (UPI) for 3 plant types and 15 species. 6. Solar Building solar potential : Returns: roof area, sunlight hours, optimal panel layout, energy/cost estimates. Solar data layers (DSM, flux, shade rasters): 7. Weather Current conditions : Hourly forecast (up to 240 hours): Daily forecast (up to 10 days): Recent history (up to 24 hours): 8. Elevation 9. Time Zone 10. Address Validation Returns: deliverability verdict, corrected address, component level confirmation, USPS CASS data. 11. Roads Snap to roads align GPS traces: Nearest roads : 12. Street View CLI data use (server side image download, costs $7/1,000): For HTML pages — ALWAYS use a direct Google Maps link instead (zero cost, zero key exposure): See "Street View in HTML" section below for details. WARNING: Do NOT use the old shorthand format @{lat},{lng},3a,75y,{heading}h,90t — it is unreliable and often opens a zoomed out world map instead of Street View. Always use the map action=pano format above. 13. Static Maps 14. Geolocation 15. Aerial View (US only) 16. Route Optimization Solve vehicle routing problems (VRP): Input JSON format: {"model": {"shipments": [...], "vehicles": [...]}} per Google Route Optimization API spec. 17. Places Aggregate (Insights) Count or list places matching filters in an area: 18. Maps Embed URL (Free) Generate embeddable map URLs (free, unlimited): Usage Patterns for Claude When the user asks location/geography/environment questions, use the appropriate command: User Intent Command "Where is...?" geocode "What address is at...?" reverse geocode "How do I get from A to B?" directions "How far is A from B?" distance matrix "Find restaurants near..." places search or places nearby "What are the hours for...?" place details "What's the air quality in...?" air quality "Is the pollen bad today?" pollen "What's the weather in...?" weather "Is this address valid?" validate address "What's the elevation of...?" elevation "What timezone is...?" timezone "Show me a map of..." static map "Can I put solar panels on my roof?" solar "Optimize delivery routes" route optimize "How many coffee shops in area?" places aggregate Interactive HTML Output IMPORTANT: Always ASK before generating HTML. Never start writing an HTML file without the user's explicit approval. After delivering results as text, ask: "Want me to put this into an interactive HTML page you can open in the browser? Default theme is Warm Stone Sunrise (light, warm toned, premium)." If the user says yes (or explicitly asks for HTML/a page/a map), then generate it. If they don't respond or say no, just give them the text/JSON results. By default, generate zero key HTML pages using Google Maps embed iframes ( output=embed ) — no API key needed, no key exposure risk. Only use the Maps JavaScript API ( <script src="https://maps.googleapis.com/maps/api/js?key=..." ) when the user explicitly requests advanced interactive features (custom markers, polylines, clustering, etc.) that embeds can't support. Zero Key Embed Iframes (Default) Use these iframe formats for maps — they require no API key and are free: Location/place map: Directions map: Parameters: q — place name or address (URL encoded, use + for spaces) saddr / daddr — origin/destination for directions z — zoom level (1 20, default ~12) output=embed — required, makes it embeddable ll — optional center coordinates lat,lng WARNING: Do NOT use loading="lazy" on Google Maps embed iframes. Lazy loading prevents off screen iframes from loading, causing maps below the fold to appear permanently blank. Always omit the loading attribute or use loading="eager" . Result Type Default HTML Element Street View Direct Google Maps link ( map action=pano ) — opens full interactive Street View in new tab. See "Street View in HTML" section. Directions Embed iframe with saddr / daddr + output=embed Places search Embed iframe with q=place+name + output=embed + info cards Nearby search Embed iframe centered on location + place cards Static map Embed iframe with q and z (zoomable, draggable) Weather/Air Quality Embed iframe for location + condition cards, icons, charts Elevation Elevation profile chart + embed iframe with path markers Solar Embed iframe for building location + solar potential stats Trip plans Combined multi section page: embed iframe maps, place cards, weather widget When generating HTML pages: 1. Use a single self contained .html file (inline CSS/JS, no external dependencies) 2. Default to zero key embed iframes ( output=embed ) for all maps — NO API key in HTML 3. NEVER use google.maps.StreetViewPanorama or the Street View JS API in HTML pages. Always use direct Google Maps links with map action=pano for Street View. This is a hard rule. 4. NEVER include a Google Maps JS API <script tag unless the user explicitly requests advanced interactive features. The output=embed iframe approach handles most use cases without any API key. 5. Save to the current working directory with a descriptive name (e.g., marea streetview.html , nyc trip plan.html ) 6. Open automatically in the browser via open <file (macOS) after creation Street View in HTML — Zero Key Exposure HARD RULE: Never embed Street View using the JavaScript API or Embed API in HTML pages. Both approaches expose the API key in client side code. Instead, ALWAYS use a direct Google Maps link that opens the full interactive Street View experience in the user's browser — zero cost, zero API key exposure. Direct link format (Google Maps URLs API — reliable): Parameters: viewpoint={lat},{lng} — coordinates of the Street View location heading — compass heading in degrees (0=North, 90=East, 180=South, 270=West) pitch — pitch angle ( 90=down, 0=level, 90=up) fov — field of view in degrees (10 100, default 90) map action=pano — required — explicitly triggers Street View panorama mode WARNING: Do NOT use the old shorthand format @{lat},{lng},3a,75y,{heading}h,{pitch}t — it is unreliable and often fails to open Street View, instead showing a zoomed out world map. Always use the map action=pano format. Examples: How to implement in HTML pages: For a standalone Street View button: For a JavaScript function (e.g., in trip plan pages with many locations): For a card/preview with context: In consolidated trip plan pages , replace the former StreetViewPanorama section with a styled button/link card. The user clicks to open full Street View in a new tab — they get the complete interactive experience directly from Google Maps. Why this approach: Zero API key exposure — no key in HTML source at all Zero cost — no API calls, no billing Better experience — full Google Maps Street View with navigation, not a limited embed Works for all deployment modes (personal, BYOK, platform key) Consolidated One Stop Pages For multi part requests (trip plans, location research, comparisons), always offer to generate a single consolidated HTML page that combines ALL collected data into one interactive dashboard. The user should be able to see everything in one stop rather than scrolling through terminal output. A consolidated page should include every piece of data gathered during the conversation, for example a trip plan page might combine: Interactive route map with driving directions polyline Weather widget for the destination Hotel/place cards with photos, ratings, hours Restaurant recommendation with Street View link (opens full 360° view in Google Maps) Timeline/itinerary section Rental car & airport info Design principles for consolidated pages: Use a clean, modern dashboard layout with distinct sections Each section should be visually rich: maps, cards, icons, badges — not just text Include smooth scroll navigation (sticky frosted glass nav with active link highlighting) Scroll reveal animations (IntersectionObserver fade up on each section) Fully responsive: desktop ( 1024px), tablet (641 1024px), mobile (<=640px), small phone (<=380px) Cards, buttons, travel chips, and stat grids stack to single column on mobile Maps reduce height on mobile (280px), buttons go full width Default Theme: Warm Stone Sunrise All HTML pages use this theme by default unless the user requests otherwise. Color palette: Background: fafaf9 (warm off white) Surface: ffffff cards, f5f5f4 alt surfaces Borders: e7e5e4 (warm stone), f0eeec (light dividers) Text: 1c1917 primary, 57534e secondary, a8a29e tertiary Accent: 4f46e5 (indigo) with e