Skip to content

Latest commit

 

History

History

angular

README.md

Enterprise GIS Workbench, GeoJSON Zones & Deck.gl Analytics — Angular Standalone Components + TypeScript (@angular/google-maps, AdvancedMarkerElement, PlaceAutocompleteElement, Place, ElevationService)

An enterprise Web GIS spatial analytics workbench centered on New York City (40.73061, -73.98661), built with Angular Standalone Components, TypeScript, @angular/google-maps (GoogleMap, MapAdvancedMarker), deck.gl (GoogleMapsOverlay, ScatterplotLayer, HexagonLayer), Terra Draw (terra-draw + terra-draw-google-maps-adapter), and the Google Maps Platform (Maps JavaScript API, Places API (New), Elevation API).


Features & Architecture

  • Dynamic Google Maps JS API Loader (@googlemaps/js-api-loader v2): Uses setOptions() + importLibrary() to load core, maps, marker, places, and elevation dynamically using runtime configuration served from /env-config.js (never hardcoded in environment.ts).
  • Official Angular Google Maps Integration (@angular/google-maps): Renders <google-map> with mapId: 'DEMO_MAP_ID' and internalUsageAttributionIds: ['gmp_git_agentsamples_v1.0.0'], plus <map-advanced-marker> for live civic reference hubs and search results.
  • Basemap Switcher: Instant switching across roadmap, satellite, hybrid, and terrain.
  • GeoJSON District Boundary Layer (google.maps.Data): 8 NYC infrastructure districts styled by capacity utilization (< 70%, 70–84%, >= 85%) with smooth map.fitBounds() zoom-on-select from either the map or sidebar directory.
  • WebGL-Accelerated deck.gl Analytics (GoogleMapsOverlay): Visualizes 2,400 NYC infrastructure sensor points with toggleable ScatterplotLayer and HexagonLayer modes, guarded by explicit WebGL2 availability checks so headless environments emit zero console errors.
  • Interactive Terra Draw Polygon Filtering: Uses TerraDraw and TerraDrawGoogleMapsAdapter (isolatedData: true) for drawing, selecting, and editing custom study-zone polygons with real-time point-in-polygon telemetry and spherical polygon area computation (km²).
  • Terrain Elevation Inspector (ElevationService): Queries surface elevation (min, mean, max, and DEM resolution in meters) for the active district, custom Terra Draw zone, or NYC centroids.
  • Live Civic Reference Hubs (Place.searchByText & PlaceAutocompleteElement): Populates NYC civic transit hubs at startup via Place.searchByText and mounts a live <gmp-place-autocomplete> widget listening to the gmp-select event.

Core Implementation Snippet

// Dynamically load Maps JS API libraries via @googlemaps/js-api-loader v2
setOptions({
  key: apiKey,
  v: 'weekly',
  language: 'en',
  region: 'US',
});

await Promise.all([
  importLibrary('core'),
  importLibrary('maps'),
  importLibrary('marker'),
  importLibrary('places'),
  importLibrary('elevation'),
]);

// Map options passed to <google-map>
const mapOptions: google.maps.MapOptions = {
  mapId: 'DEMO_MAP_ID',
  internalUsageAttributionIds: ['gmp_git_agentsamples_v1.0.0'],
};

Setup & Running Locally

1. Obtain a Google Maps Platform API Key

Option A: Free Zero-Billing Maps Demo Key (Prototyping)

  1. Open the Maps Demo Key portal.
  2. Sign in with any Google account (no billing card or Cloud project required).
  3. Accept the Maps Demo Project Terms when prompted.
  4. Generate/reveal your Demo Key and copy it.

Note: The Maps Demo Key has daily reset limits, is not intended for production usage, and covers Maps JavaScript API and Places API (New). For full Elevation API support and production deployments, use Option B.

Option B: Production Google Cloud API Key

  1. Create or select a project in the Google Cloud Console Credentials page.
  2. Enable Maps JavaScript API, Places API (New), and Elevation API.
  3. Restrict your key by HTTP referrer and API restrictions following the API Security Best Practices guide.

2. Configure .env

cp .env.example .env
# Edit .env and set GOOGLE_MAPS_API_KEY=<your_key>

3. Install, Typecheck, Build & Serve

npm install --no-audit --no-fund
npx tsc --noEmit && node --check serve-dist.mjs
npm run build
node serve-dist.mjs --host 127.0.0.1 --port 4200

Then open http://127.0.0.1:4200 in your browser.


Documentation & Terms


Other Stack Implementations


Google Maps Platform Compliance & Licensing Notice