[Angular] Migrate marks-site area drawing off google.maps.drawing.DrawingManager (Terra Draw) and unpin @types/google.maps / v=3.64 #1162

Open
opened 2026-10-02 04:44:19 +00:00 by spikerj · 1 comment
Owner

Why

Google removed the Maps JS Drawing Library — it is "no longer available in the Maps JavaScript API as of version 3.65" (May 2026). Our marks-site map only still draws because:

  • the runtime loader pins v=3.64&libraries=marker,drawing (projects/spikersoft/src/app/_services/marks-site/google-maps-loader.service.ts:19, see #236 comment), and Google retires pinned versions ~12 months after release → hard deadline ≈ mid-2027;
  • @types/google.maps is exact-pinned at 3.64.1 (commit c1c48f60) because from 3.65 DrawingManager is an empty class (setMap/setDrawingMode/options/events gone). 3.66.4 (latest) is the same.

Google's migration recommendation is Terra Draw (terra-draw + terra-draw-google-maps-adapter).

Side effect today: @angular/google-maps 22.x already depends on @types/google.maps ^3.65.1, so the lockfile carries two copies (3.64.1 root, 3.65.x nested) — fragile.

Markers are fine: we already use Advanced Markers (MapAdvancedMarker, PinElement, mapId), no legacy google.maps.Marker.

What changes for us

  • marks-drawing.service.ts (DrawingManager at ~L17, 28, 67-68, 95, 109, 149, 167) → Terra Draw rectangle / circle / polygon modes, port the blue fill/stroke styles, keep editable/draggable.
  • overlaycomplete handler → Terra Draw emits GeoJSON features, not google.maps.Rectangle/Circle/Polygon:
    • filterMarkersByDrawnAreas in marks-marker.service.ts (uses geometry.poly / spherical on overlays)
    • the instanceof google.maps.Rectangle → setSelectedAreaBounds branch
    • getDrawnOverlays() in marks-map.component.ts (~L336)

Acceptance criteria

  • Drawing rectangle / circle / polygon and marker filtering work as today (specs updated)
  • Loader drops drawing from libraries= and drops the v=3.64 pin; #236 comment removed
  • @types/google.maps unpinned to ^3.66; only one copy in pnpm-lock.yaml

Size: M (~2-3 days).

Links: Unrelated to #1165; can land any time.


Filed from the 2026-10-02 spikersoft-angular pnpm outdated changelog review.

## Why Google removed the Maps JS **Drawing Library** — it is "no longer available in the Maps JavaScript API as of version 3.65" (May 2026). Our marks-site map only still draws because: - the runtime loader pins `v=3.64&libraries=marker,drawing` (`projects/spikersoft/src/app/_services/marks-site/google-maps-loader.service.ts:19`, see #236 comment), and Google retires pinned versions ~12 months after release → **hard deadline ≈ mid-2027**; - `@types/google.maps` is exact-pinned at **3.64.1** (commit c1c48f60) because from 3.65 `DrawingManager` is an empty class (`setMap`/`setDrawingMode`/options/events gone). 3.66.4 (latest) is the same. Google's migration recommendation is **Terra Draw** (`terra-draw` + `terra-draw-google-maps-adapter`). Side effect today: `@angular/google-maps` 22.x already depends on `@types/google.maps ^3.65.1`, so the lockfile carries two copies (3.64.1 root, 3.65.x nested) — fragile. Markers are fine: we already use Advanced Markers (`MapAdvancedMarker`, `PinElement`, `mapId`), no legacy `google.maps.Marker`. ## What changes for us - `marks-drawing.service.ts` (DrawingManager at ~L17, 28, 67-68, 95, 109, 149, 167) → Terra Draw rectangle / circle / polygon modes, port the blue fill/stroke styles, keep editable/draggable. - `overlaycomplete` handler → Terra Draw emits GeoJSON features, not `google.maps.Rectangle/Circle/Polygon`: - `filterMarkersByDrawnAreas` in `marks-marker.service.ts` (uses `geometry.poly` / `spherical` on overlays) - the `instanceof google.maps.Rectangle` → `setSelectedAreaBounds` branch - `getDrawnOverlays()` in `marks-map.component.ts` (~L336) ## Acceptance criteria - [ ] Drawing rectangle / circle / polygon and marker filtering work as today (specs updated) - [ ] Loader drops `drawing` from `libraries=` and drops the `v=3.64` pin; #236 comment removed - [ ] `@types/google.maps` unpinned to `^3.66`; only one copy in `pnpm-lock.yaml` Size: **M** (~2-3 days). **Links:** Unrelated to #1165; can land any time. --- _Filed from the 2026-10-02 spikersoft-angular `pnpm outdated` changelog review._
spikerj added the enhancement label 2026-10-02 04:44:19 +00:00
Author
Owner

Tracker sweep 2026-10-06. The code is merged (spikerj/spikersoft-angular#1421, 2026-10-04). Leaving this open only for a real-browser check.

Checked against angular master:

  • Loader: google-maps-loader.service.ts now loads libraries=marker&loading=async, with no drawing and no v= pin. The #236 pin comment is replaced by a note on why the pin is gone.
  • Types: @types/google.maps is ^3.66.4, and pnpm-lock.yaml has a single copy (3.66.4).
  • Drawing: marks-drawing.service.ts runs on terra-draw ^1.35.0 + terra-draw-google-maps-adapter ^1.6.2. DrawingManager appears only in comments. The marks-site specs (132 tests) cover the drawing service, containment for every shape type, and the toolbar.
  • "Works as today": the PR states it was not tested in a real browser against the live Maps runtime. Its "Before merging" checklist for /mark/map, signed in, never got ticked: draw, move and resize a rectangle, a circle and a polygon; Stop Drawing; Filter Pins; Area → Waypoints; Clear Shapes; info windows.

Running that checklist once on production is the last step. Close this if it passes. If something fails, file it in spikerj/spikersoft-angular with the step number.

**Tracker sweep 2026-10-06. The code is merged (spikerj/spikersoft-angular#1421, 2026-10-04). Leaving this open only for a real-browser check.** Checked against angular `master`: - [x] **Loader:** `google-maps-loader.service.ts` now loads `libraries=marker&loading=async`, with no `drawing` and no `v=` pin. The #236 pin comment is replaced by a note on why the pin is gone. - [x] **Types:** `@types/google.maps` is `^3.66.4`, and `pnpm-lock.yaml` has a single copy (`3.66.4`). - [x] **Drawing:** `marks-drawing.service.ts` runs on `terra-draw ^1.35.0` + `terra-draw-google-maps-adapter ^1.6.2`. `DrawingManager` appears only in comments. The marks-site specs (132 tests) cover the drawing service, containment for every shape type, and the toolbar. - [ ] **"Works as today":** the PR states it was **not tested in a real browser** against the live Maps runtime. Its "Before merging" checklist for `/mark/map`, signed in, never got ticked: draw, move and resize a rectangle, a circle and a polygon; Stop Drawing; Filter Pins; Area → Waypoints; Clear Shapes; info windows. Running that checklist once on production is the last step. Close this if it passes. If something fails, file it in spikerj/spikersoft-angular with the step number.
Sign in to join this conversation.