Google Maps Drawing Tools for Odoo
A developer framework that adds full GIS-style drawing to any Odoo model — draw, store, measure, and query geographic shapes as standard GeoJSON data, all inside Odoo, without relying on any deprecated Google library.
Product Overview
Google Maps Drawing Tools for Odoo is a developer framework that brings full GIS-style spatial drawing into the Odoo map view. Once a developer applies the bundled google.drawing.shape mixin to a model and adds a drawing map view, users on that model can draw polygons, circles, rectangles, lines, and points directly on the map, then save those shapes as structured GeoJSON on the record — no external GIS software, no file import/export cycle, no leaving Odoo.
Under the hood, the product uses Terra Draw for interactive editing and switches automatically to Deck.gl's GPU-accelerated renderer when a dataset exceeds the threshold for smooth browser performance. Turf.js provides on-the-fly area and distance calculations, and PostgreSQL JSONB operators enable server-side spatial filtering directly from Odoo domain expressions. The result is a drawing toolkit that handles everything from a handful of sales territories to tens of thousands of GeoJSON features without freezing the browser.
A bundled example module — contact_area — demonstrates the complete integration on the res.partner model, giving developers a working reference they can adapt for any model in minutes.
Who It's For
This is a developer framework, not a plug-and-play end-user application. It provides the infrastructure — a reusable model mixin, a GeoJSON field type, custom ORM operators, and the drawing UI — that developers use to add spatial drawing capability to any Odoo model. A bundled contact_area example module shows the complete integration on res.partner.
google.drawing.shape on any model, add a view, and the full drawing toolbar, GeoJSON storage, JSONB operators, and Deck.gl renderer are available immediately. The contact_area reference module is the fastest starting point — copy it, rename the model, and adapt the field mappings.
The Problem It Solves
The google.maps.drawing library that most map-drawing integrations relied on was officially deprecated. Solutions built on it stopped working or became unsupported overnight. This product is built entirely on Terra Draw and Deck.gl — no dependency on the deprecated library, no future deprecation risk from the same source.
The standard Odoo map view renders markers and clusters, but has no built-in way to draw shapes, define areas, or edit existing geometries. Every team that needs this today either skips the requirement or routes around Odoo with an external tool — then manually syncs the data back.
Drawing a territory in QGIS or Google My Maps is useful, but the result is a file — not a linked Odoo record. There is no automatic connection between the drawn boundary and the partners, leads, or tasks that fall within it. Drawing Tools stores the shape directly on the record, so filtering and actions are immediate.
Rendering thousands of GeoJSON features with a standard map library causes visible lag or crashes the browser tab. This product automatically switches from Terra Draw to the Deck.gl GPU renderer above 3,000 features or 5,000 vertices — keeping the map fluid regardless of dataset size.
Even if you store GeoJSON in a text field, standard Odoo domain filters can't query inside it. This product adds custom PostgreSQL JSONB operators (json_eq, json_ne, json_contains, json_not_contains) so spatial data is filterable with the same domain syntax used everywhere else in Odoo.
What's Inside
Three modules work together to deliver drawing capability: two shared foundation modules provide the map view infrastructure, and one drawing framework module adds the full spatial editing layer on top.
Base Google Map
The core infrastructure module that registers the google_map view type as a first-class Odoo view, initialises the Google Maps JavaScript API with the modern @googlemaps/js-api-loader, and provides the shared OWL components — including AdvancedMarkerElement and MarkerClusterer — that all other modules in this suite depend on.
Why It Exists
Every module in this suite needs a stable, version-controlled entry point to the Google Maps API and a set of reusable OWL components. base_google_map provides that shared foundation so individual feature modules don't each bundle their own copy of the API loader or reinvent marker rendering.
Web View Google Map
Implements the full google_map view type within the Odoo web client. It renders records as clustered map markers, handles view switching between map and list, exposes MapRenderer and MapController OWL components, and manages marker click, hover, and popup behaviour. Any Odoo model with latitude and longitude fields can be displayed in a map view simply by adding a view definition.
Why It Exists
The map view type is declared in base_google_map but the client-side rendering — how markers appear, how clusters work, how popups open — lives here. Separating declaration from implementation keeps the foundation module minimal and makes the renderer independently upgradeable.
Web View Google Map Drawing
Extends the google_map view with a full spatial drawing and editing toolbar powered by Terra Draw. Users can draw polygons, rectangles, circles, lines, and points directly on the map; edit existing shapes by dragging vertices; and delete or reset drawings without leaving the form or list view. All shapes are stored as standard GeoJSON (RFC 7946) in a fields.Json field on the record — a valid, interoperable GeoJSON object, not a proprietary encoding.
For large datasets the module automatically switches the renderer from Terra Draw's interactive canvas to Deck.gl's GPU-accelerated layer above 3,000 features or 5,000 total vertices — maintaining smooth performance regardless of data volume. Turf.js computes area and perimeter measurements when the user clicks the Save button on the drawing toolbar; in the map view this happens live, while in the form view it is triggered explicitly. On save, a Douglas-Peucker simplification pass reduces vertex count without compromising visual accuracy. GeoJSON can also be imported from or exported to .geojson files at any time.
Why It Exists
Odoo has no native concept of a geometric shape stored on a record. This module fills that gap with a production-ready drawing layer that covers the full lifecycle: draw → edit → measure → simplify → store → filter → export. The google.drawing.shape mixin makes adding this capability to any custom model a matter of inheriting one class and adding a map view.
Custom Domain Operators
The module registers four PostgreSQL JSONB operators directly in Odoo's ORM so GeoJSON fields can be used in standard domain expressions:
- json_eq — exact GeoJSON equality match
- json_ne — exclude records with a specific GeoJSON value
- json_contains — records whose GeoJSON contains a given sub-structure
- json_not_contains — records whose GeoJSON does not contain a given sub-structure
contact_area — Working Reference Implementation
Bundled inside web_view_google_map_drawing as an example/ folder, contact_area is a fully working demo module that adds drawing capability to res.partner. It applies the google.drawing.shape mixin, adds a geojson field to contacts, and wires up the drawing toolbar in the partner map view. Install it in a development database to see the complete integration in action — then use it as a template when extending any other model.
How It Works
From opening the map to querying records by their drawn boundaries, the workflow is entirely within Odoo — no external tools, no file exports mid-process.
- There are two distinct entry points depending on what you want to do. To draw or edit a shape on a record, open the record's form view — the
google_map_terra_drawwidget must be applied to thefields.Jsonfield that stores the GeoJSON data; this renders the map with the full drawing toolbar inline. To browse all saved shapes at once, open thegoogle_mapview; every record's stored GeoJSON is rendered on the map, and hovering any shape shows a tooltip with its geometry data — including the total area measurement calculated by Turf.js at save time. - Select a drawing mode — polygon, rectangle, circle, line, or point — and draw directly on the map in the form view. Vertex snapping and freehand modes are both available. When finished, click the Save button on the drawing toolbar to trigger Turf.js measurement calculation and persist the shape.
- Edit or refine the shape by dragging vertices, adding new ones, or switching to the erase mode to remove sections. When you are satisfied, click the Save button on the toolbar to recalculate measurements and commit the updated geometry.
- Save the record. The module runs a Douglas-Peucker simplification pass to reduce vertex count, then stores the result as a standard GeoJSON object (RFC 7946) in the record's
fields.Jsonfield. No separate geocoding or conversion step is required. - Import existing shapes by uploading a
.geojsonfile directly onto the map view — useful for migrating legacy territory data or loading externally authored boundaries without redrawing them. - Filter records by shape using standard Odoo domain expressions with the custom JSONB operators. For example, filter contacts whose saved area contains a specific coordinate, or exclude partners with no area defined.
- For datasets above 3,000 features or 5,000 vertices, the renderer switches automatically from Terra Draw's interactive canvas to Deck.gl's GPU layer — the map stays responsive and no action is required from the user.
- Export the GeoJSON at any time for use in external tools, reporting pipelines, or handoff to other systems.
Key Features
A full-stack spatial drawing toolkit — from interactive editing to server-side querying — built natively into Odoo.
Data & Storage
- Standard GeoJSON storage — Shapes are stored in
fields.Jsonfollowing the standard GeoJSON format (RFC 7946) — not a proprietary encoding. The stored value is a valid GeoJSON object, interoperable with any GIS tool, mapping library, or service that understands the format, and queryable directly in PostgreSQL as JSONB. - Custom JSONB domain operators —
json_eq,json_ne,json_contains, andjson_not_containsplug into standard Odoo domains so spatial filtering works everywhere domains work: views, actions, automated rules, and reports. - google.drawing.shape mixin — Adds the GeoJSON field, the drawing toolbar hook, and the simplification logic to any model with a single
_inheritdeclaration.
Developer Experience
- contact_area reference module — A complete, installable example that demonstrates the mixin on res.partner — copy, rename, adapt.
- No deprecated Google Drawing Library — Built entirely on Terra Draw and Deck.gl; no dependency on the
google.maps.drawingnamespace deprecated in August 2025. - Odoo-native architecture — OWL components, standard view inheritance, and ORM operators mean the drawing tools follow Odoo upgrade conventions rather than fighting them.
Drawing & Editing
- Seven drawing modes — Polygon, rectangle, circle, line, point, freehand polygon, and freehand line — covering every common spatial shape type.
- Vertex editing — Drag any vertex to reshape an existing geometry. Add or remove vertices without redrawing the entire shape.
- Turf.js measurements — Area (m² / km² / acres) and perimeter (m / km / miles) are computed by Turf.js when the user clicks the Save button on the drawing toolbar in the form view. Saved measurements are then visible as hover tooltips on shapes in the
google_mapview. - GeoJSON import — Upload a
.geojsonfile to populate the field from existing data without manual redrawing. - GeoJSON export — Download the stored shape as a standards-compliant
.geojsonfile at any time.
Performance & Rendering
- Smart renderer switching — Terra Draw handles interactive editing at normal dataset sizes; Deck.gl's GPU-accelerated WebGL layer takes over above 3,000 features or 5,000 vertices — automatically, with no user action required.
- Douglas-Peucker simplification — Applied on save to reduce stored vertex count while preserving the visual shape, keeping database payloads lean.
- MarkerClusterer integration — Point markers cluster at lower zoom levels so even dense datasets remain navigable.
Use Cases & Benefits
Build Territory or Zone Features on Any Model
Apply the google.drawing.shape mixin to any custom model — a sale.territory, a service.zone, a project.site — and the drawing toolbar, GeoJSON storage, measurements, and Deck.gl renderer are immediately available. The framework provides the infrastructure; the business logic lives in the model.
Working Example Included
The bundled contact_area example module applies the full integration to res.partner and is installable in any development database. It covers the mixin, the field, the drawing view, and the domain operators — copy it as a starting point for any custom model.
Legacy GeoJSON Migration
Import existing shapefiles converted to GeoJSON and attach them to the correct Odoo records in one step. No redrawing, no custom import script — just upload and save.
Spatial Filtering in Standard Domains
The custom JSONB operators make GeoJSON fields filterable everywhere Odoo domains are used — scheduled actions, email filters, report groupings, and security rules — without writing raw SQL.
Smooth Performance at Any Scale
Whether you have 10 polygons or 50,000 features, the automatic Terra Draw ↔ Deck.gl switch keeps rendering fluid. No manual configuration, no separate "large dataset mode" to enable.
Accurate Shape Measurements On-the-Fly
Turf.js area and perimeter calculations are triggered on save, so sales territory sizing, coverage calculations, or infrastructure planning decisions are available immediately after committing a shape — no post-processing required.
Fast Custom Model Integration
The google.drawing.shape mixin and the contact_area example reduce adding drawing capability to a custom model from a multi-week project to an afternoon of configuration and testing.
Future-Proof Architecture
No dependency on the deprecated Google Drawing Library means you won't face a forced migration when that API is removed. Terra Draw and Deck.gl are actively maintained, vendor-neutral libraries with long support horizons.
What's in the Bundle
Three modules — two shared infrastructure layers and one drawing framework — plus a bonus example module that puts everything together on the res.partner model.
Foundation
base_google_map— Google Maps API loader, OWL component library, andgoogle_mapview type declarationweb_view_google_map— Fullgoogle_mapview renderer: markers, clustering, popups, and view switching
Drawing Framework
web_view_google_map_drawing— Terra Draw toolbar, Deck.gl GPU renderer, Turf.js measurements, GeoJSON field, JSONB operators, andgoogle.drawing.shapemixin
Bonus Example (included in web_view_google_map_drawing)
contact_area— Reference implementation: drawing capability applied to res.partner, ready to install in a development database