Skip to content

# 🧩 Feature Request: Add Projection3D API (toScreenLocation(), fromScreenLocation()) and full map click listener support in Maps 3D SDK #21

@tejbhansahu

Description

@tejbhansahu

When using the Google Maps 3D SDK (play-services-maps3d:0.1.0), developers currently cannot convert between world coordinates and screen positions like in the 2D Maps SDK.

In the 2D version, these methods are essential:

val point = map.projection.toScreenLocation(latLng)
val latLng = map.projection.fromScreenLocation(point)

These are critical for:

  • Aligning custom overlays and UI with 3D map elements
  • Converting screen touches into real-world coordinates
  • Implementing accurate polygon, model, or ground-level interaction
  • AR-style or analytics overlays that rely on projection math

Additionally, the 3D SDK currently detects only marker and model clicks, but not map surface clicks.
Developers need a setOnMapClickListener { latLngAltitude -> ... } callback that triggers anywhere on the visible 3D surface, not just on placed elements.

Without these APIs, developers have no reliable way to interact with or overlay UI on the 3D map.


Describe the solution you'd like

✅ 1. Projection3D API

Add a Projection3D object similar to the 2D SDK’s Projection, supporting:

val projection3D = map3D.projection

val screenPoint: Point = projection3D.toScreenLocation(latLngAltitude)
val latLngAltitude: LatLngAltitude = projection3D.fromScreenLocation(point)

Expected behavior:

  • toScreenLocation() returns screen pixel coordinates for a given LatLngAltitude, considering camera tilt, heading, and range.
  • fromScreenLocation() returns the LatLngAltitude corresponding to a given screen point, projected onto the visible ground plane.

✅ 2. Full Map Click Listener

Add an API similar to the classic setOnMapClickListener that triggers for all visible map areas, not just markers or models:

map3D.setOnMapClickListener { latLngAltitude ->
    // Called when user taps anywhere on the 3D map surface
}

Expected behavior:

  • Detects taps on the map terrain and buildings, even where no markers or models exist.
  • Returns a LatLngAltitude corresponding to the tap position.
  • Coexists with existing marker/model click listeners.

This is crucial for building interactive 3D tools where user input on the surface matters (e.g., network planning, annotations, AR overlays, and measurement apps).


Additional context

Environment:

Component Version
Maps 3D SDK com.google.android.gms:play-services-maps3d:0.1.0
Android SDK 34
Devices Tested Pixel 7 Pro, Samsung Galaxy S24
Language Kotlin

Example Use Case:

map3D.setOnMapClickListener { latLngAltitude ->
    val screenPoint = map3D.projection.toScreenLocation(latLngAltitude)
    showOverlayAt(screenPoint.x, screenPoint.y)
}

val worldPoint = map3D.projection.fromScreenLocation(Point(x, y))
map3D.addMarker(markerOptions { position = worldPoint })

Why it matters:
These APIs are foundational for developing interactive, spatially accurate 3D applications — from smart city visualizations to GIS tools and augmented reality layers.


Request Summary

  • Add Projection3D.toScreenLocation() and Projection3D.fromScreenLocation()
  • Add setOnMapClickListener() for full 3D map surface interaction
  • Ensure both APIs account for tilt, heading, range, and altitude context

These additions would bring the Maps 3D SDK much closer to production readiness and feature parity with the 2D SDK.

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage meI really want to be triaged.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions