[UWP] How can I get a street(2d) map?

I have confirmed that 3D maps can be imported through ‘Microsoft.Maps.Unity’ Pakage.

But I want to check the latitude and longitude(GPS) through 2d street maps on the UWP platform.

What should I do?

If you know how, please let me know.

I’m not familiar with that Package nor the 2D street maps, but some quick googling turned up this Microsoft maps doc:
Display maps with 2D, 3D, and Streetside views - UWP applications | Microsoft Learn. I’m assuming this is what you want to use.

There’s 2 options:

  • Use the Windows.UI.Xaml.Controls.Maps.MapControl class (in the above link) in a XAML app
  • Call the WinRT APIs under Windows.Devices Geolocation directly from your scripts

For option 1 you’ll need to select a “XAML Project” under the UWP “Build Type” under build settings (instead of D3D Project). This will create a Visual Studio project that integrates Unity with XAML allowing you to use the MapControl as you would in a regular UWP app.

Some doc for doing this:

(you can also google “Unity XAML” to get other samples and how-to videos)

The second option is simpler, were you directly invoke the Geolocation APIs from your scripts instead of using XAML. See this Unity doc link on how to do this: Unity - Manual: WinRT API in C# scripts for UWP

Refer to the Microsoft doc page for instructions on using Geolocation APIs: Get the user's location - UWP applications | Microsoft Learn

You’ll need to incorporate this code into your scripts and then wrap it with a #if
#if ENABLE_WINMD_SUPPORT … #endif. You can also use #if UNITY_WSA or #if UNITY_UWP (they all function the same now).

NOTE: The Windows specific Types are not visible to Mono and won’t compile within the Editor (also won’t work in Play Mode). However, when you build your actual UWP app the API calls are linked by Visual Studio and will work in your app.