Addition to my question, I discovered your example for screen coordinate to geographic coordinate conversion.
I adapted the script for touch position like this:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DetectTapOnRoute : MonoBehaviour
{
public OnlineMapsControlBase control;
void Start()
{
if (control == null) control = OnlineMapsControlBase.instance;
}
// Update is called once per frame
void Update()
{
if (Input.touchCount > 0)
{
Touch touch = Input.GetTouch(0);
// Screen coordinate of the touch.
Vector3 touchPosition = new Vector3(touch.position.x, touch.position.y, 0);
// Converts the screen coordinates to geographic.
Vector3 touchGeoLocation = control.GetCoords(touchPosition);
// Showing geographical coordinates in the console.
Debug.Log("touch geo location " + touchGeoLocation);
}
}
}
But it doesn't work reliably yet. Of course, when dragging the map, I get back 0,0,0.
Unfortunately I also get 0,0,0 most of the time when tapping on random positions on the map.
In between, there are some random successful hits with kind of fitting geographic coordinates, but I only get back coordinates (other than 0,0,0) for like 10% of the taps. Any ideas on why it only works for a fraction of my taps?