React + Vite + TypeScript (@vis.gl/react-google-maps) — Map, AdvancedMarkerElement, PlaceAutocompleteElement, Place.searchByText, ElevationService — Enterprise GIS Workbench, GeoJSON Zones & Deck.gl Analytics
An enterprise Web GIS spatial analytics workbench centered on New York City (40.73061, -73.98661), integrating:
- Google Maps JavaScript API via
@vis.gl/react-google-maps(<APIProvider>,<Map>,<AdvancedMarker>,<Pin>,<InfoWindow>) withmapId="DEMO_MAP_ID"andinternalUsageAttributionIds={['gmp_git_agentsamples_v1.0.0']}. - Live Basemap Switcher: Switch between
roadmap,satellite,hybrid, andterrainbasemaps in real time. - GeoJSON Infrastructure Districts Layer: Dedicated
google.maps.Datalayer rendering NYC infrastructure districts styled by capacity load (Optimal <66%,Elevated 66–81%,Critical ≥82%) with smoothmap.fitBounds()zoom-on-select. - WebGL-Accelerated deck.gl Overlay: Toggleable
ScatterplotLayerandHexagonLayerviaGoogleMapsOverlayvisualizing 2,400 NYC infrastructure sensor nodes with a pre-flight WebGL2 capability check for zero-error graceful fallback in headless environments. - Interactive Terra Draw Polygon Tool: Powered by
terra-drawandterra-draw-google-maps-adapter(TerraDrawPolygonMode,TerraDrawSelectMode,TerraDrawRenderMode) to draw and edit custom study zones, compute point-in-polygon metrics, and measure geodesic area. - Terrain Elevation Inspector: Live
ElevationService.getElevationForLocations()profiling across Terra Draw polygon vertices, district boundaries, or a NYC harbor transect. - Places API (New): Imperative
PlaceAutocompleteElement(gmp-selectevent) for location jumping andPlace.searchByText()for live NYC civic transit hub reference markers.
Option A — Free Maps Demo Key (Prototyping, Zero Billing Setup):
- Open Maps Demo Key Quickstart.
- Sign in with any Google account (no billing card or Cloud project required).
- Accept the Maps Demo Project Terms and click to generate/reveal your key. (Note: Maps Demo Keys have a daily reset limit and are intended for prototyping only.)
Option B — Google Cloud Console Key (Production):
- Create or select a project in Google Cloud Console Credentials.
- Enable Maps JavaScript API, Places API (New), and Elevation API.
- Restrict your API key by HTTP referrer and API scope following API Security Best Practices.
cp .env.example .env.local
# Edit .env.local and set:
# VITE_GOOGLE_MAPS_API_KEY=your_key_here
npm install --no-audit --no-fund
npm run devnpx tsc --noEmit
npm run build
npx vite preview --host 127.0.0.1 --port 4173 --strictPort| Module | Responsibility |
|---|---|
src/App.tsx |
Root state, <APIProvider>, <Map>, MapServicesBridge (Place.searchByText, ElevationService), and <AdvancedMarker> civic hubs. |
src/components/GeoJsonDistrictLayer.tsx |
Isolated google.maps.Data layer for NYC district polygons styled by capacity tier. |
src/components/DeckGlSensorsOverlay.tsx |
WebGL2-guarded GoogleMapsOverlay rendering ScatterplotLayer and HexagonLayer. |
src/components/TerraDrawController.tsx |
TerraDraw + TerraDrawGoogleMapsAdapter lifecycle for custom polygon study zones. |
src/components/PlaceAutocompleteControl.tsx |
Imperative PlaceAutocompleteElement mounted via useRef + useEffect (gmp-select). |
src/utils/geometry.ts |
Ray-casting point-in-polygon filtering, geodesic area (km²), bounds, and WebGL2 detection. |
<APIProvider apiKey={apiKey} libraries={['places', 'marker', 'elevation']} language="en" region="US">
<GoogleMap
defaultCenter={{ lat: 40.73061, lng: -73.98661 }}
defaultZoom={12}
mapId="DEMO_MAP_ID"
mapTypeId={basemap}
internalUsageAttributionIds={['gmp_git_agentsamples_v1.0.0']}
gestureHandling="greedy"
>
<GeoJsonDistrictLayer visible={showGeoJson} selectedDistrictId={selectedDistrictId} onSelectDistrict={handleSelectDistrict} />
<DeckGlSensorsOverlay allSensors={NYC_SENSORS} activeSensorIds={activeSensorIds} mode={deckMode} isDrawingMode={drawMode !== 'static'} />
<TerraDrawController activeMode={drawMode} clearSignal={clearDrawSignal} onPolygonsChange={handlePolygonsChange} />
</GoogleMap>
</APIProvider>- Maps JavaScript API Documentation
- Places API (New) Overview
- Elevation API Overview
- Google Maps Platform Terms of Service
static-vanilla-jsreact-vite(current implementation)nextjssveltekitvue-viteangularpython-fastapinodejs-web
- Cost Notice: "Usage of Google Maps Platform products and services may incur costs against your Google Cloud project billing account." Requires a billed Google Cloud key for Elevation API (REST) (a Maps Demo Key covers Maps JS/Places/Routes/Geocoding/Weather prototyping only).
- API Key Restrictions: Restrict production keys by HTTP referrer (client) or IP address (server) and allowed APIs via Add API Key Restrictions.
- License Scope: Google-sourced code snippets are provided "as-is" under the Apache 2.0 License (applies to Google-sourced snippets only, not the full generated project).
- Terms of Service: Subject to the Google Maps Platform Terms of Service, EEA Service Specific Terms, and Prohibited Territories. Do not cache non-
place_idPlaces data or use GMP content for AI/ML training. - Browse Catalog:
../README.md·../AGENTS.md·../../AGENTS.md·../../INDEX.md