What reason would there be a discrepancy in location between Esri maps using default Windows Location Services, getting a GPS signal (i.e. not a default wi-fi location) and Windows Location Services getting a location using Powershell?
Our application in UWP uses the below code to enable GPS location in Esri using Windows Location Services (default).
C# code below
Map.LocationDisplay.IsEnabled = true;
Map.LocationDisplay.DataSource.LocationChanged += (sender, eventArgs) => OnDeviceLocationChanged(sender, eventArgs);
private void OnDeviceLocationChanged(object sender, Location e)
{
_ = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
logger.Info($"Current Device Location:
Easting = { position.Easting}
Northing = { position.Northing}");
});
}
The log entry generated using Esri data is below.
Device Location: Easting = 631010.XXXXXXXXX Northing = 143140.XXXXXXXXX
Using a converter (https://gridreferencefinder.com/) to convert to Lat and Long, result is Lat
51.14 , long 1.30
Using System.Device.Location.GeoCoordinateWatcher using the powershell script below to capture GPS coordinates at the same time returns Lat 51.25, Long 0.514)
Powershell code below
Add-Type -AssemblyName System.Device
$GeoWatcher = New-Object System.Device.Location.GeoCoordinateWatcher
$GeoWatcher.Start()
while (($GeoWatcher.Status -ne 'Ready') -and ($GeoWatcher.Permission -ne 'Denied')) {
Start-Sleep -Milliseconds 100 #Wait for discovery.
}
$GeoWatcher.Position.Location | Select Latitude,Longitude
See: https://learn.microsoft.com/en-us/dotnet/api/system.device.location.geocoordinatewatcher?view=netfra...
