Function getLocationStandardURL

  • Generates a standard URL for a given geographic location based on the device's operating system.

    On iOS devices, it returns a URL for Apple Maps. On other devices, it returns a geo URI.

    Parameters

    • latitude: number

      The latitude of the location.

    • longitude: number

      The longitude of the location.

    Returns string

    A string representing the URL or URI for the location.

    const url = getLocationStandardURL(37.7749, -122.4194);
    console.log(url); // On iOS: "https://maps.apple.com/?ll=37.7749,-122.4194"
    // On other devices: "geo:37.7749,-122.4194?q=37.7749,-122.4194"