Looks like you have an extra backslash pasted in at the end of your key that's making it invalid.
Also as a reminder you shouldn't post your personal keys in a public forum.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I put in my map service token key and my search bar to search for any location is not working on the bottom of screen is saying Warning: Map Service Token not specified for my uwp google earth like app
Looks like you have an extra backslash pasted in at the end of your key that's making it invalid.
Also as a reminder you shouldn't post your personal keys in a public forum.
How do i create a code snippet
<Page
x:Class="Lukes_Earth.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Lukes_Earth"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:Custom="using:Windows.UI.Xaml.Controls.Maps"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
<Custom:MapControl x:Name="MapTest" Style="Aerial3DWithRoads" ZoomInteractionMode="GestureAndControl"
TiltInteractionMode="GestureAndControl" Loaded="MapControl_Loaded" MapServiceToken="BsqK8Q26ZVYD3EzSZuGw~LAgyqIvV7_2lQX4a0wuauw~AkrEhdJtQH9Tm4GQ3YVuvD7GDzdxj9iYygh8-vRl_pq_3g0SqIa7O7YHwhn-mQDS/">
<SearchBox x:Name="searchBox" Width="150" Background="White" QuerySubmitted="SearchBox_QuerySubmitted"/>
</Custom:MapControl>
</Grid>
</Page>
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Threading.Tasks;
using Windows.Devices.Geolocation;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.Services.Maps;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Maps;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
namespace Lukes_Earth
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
private async void SearchBox_QuerySubmitted(SearchBox sender, SearchBoxQuerySubmittedEventArgs args)
{
string addressToGeocode = searchBox.QueryText;
// The nearby location to use as a query hint.
BasicGeoposition queryHint = new BasicGeoposition();
queryHint.Latitude = 47.643;
queryHint.Longitude = -122.131;
Geopoint hintPoint = new Geopoint(queryHint);
// Geocode the specified address, using the specified reference point
// as a query hint. Return no more than 3 results.
MapLocationFinderResult result =
await MapLocationFinder.FindLocationsAsync(
addressToGeocode,
hintPoint,
3);
// If the query returns results, display the coordinates
// of the first result.
if (result.Status == MapLocationFinderStatus.Success)
{
BasicGeoposition cityPosition = result.Locations[0].Point.Position;
var cityCenter = new Geopoint(cityPosition);
await MapTest.TrySetViewAsync(cityCenter, 12);
}
}
private async void MapControl_Loaded(object sender, RoutedEventArgs e)
{
BasicGeoposition cityPosition = new BasicGeoposition() { Latitude = -36.163656, Longitude = 150.109979 };
var cityCenter = new Geopoint(cityPosition);
await (sender as MapControl).TrySetViewAsync(cityCenter, 12);
}
}
}
I took out the backslash and got it working