Windows获取设备当前定位坐标—精确街道

Windows获取设备当前定位坐标—精确街道

Deng YongJie's blog 436 2024-04-14

使用powershell执行下面代码

Add-Type -AssemblyName System.Device #Required to access System.Device.Location namespace
$GeoWatcher = New-Object System.Device.Location.GeoCoordinateWatcher #Create the required object
$GeoWatcher.Start() #Begin resolving current locaton

while (($GeoWatcher.Status -ne 'Ready') -and ($GeoWatcher.Permission -ne 'Denied')) {
    Start-Sleep -Milliseconds 100 #Wait for discovery.
}  

if ($GeoWatcher.Permission -eq 'Denied'){
    Write-Error 'Access Denied for Location Information'
} else {
    $GeoWatcher.Position.Location | Select Latitude,Longitude #Select the relevent results.
}

获取到设备定位坐标

如果设备没开定位,那么会获取失败,会报错

坐标反查工具:

https://map.jiqrxx.com/jingweidu/

https://www.lddgo.net/convert/position

https://www.qvdv.net/tools/qvdv-coordinate.html

image-20240514191417786
image-20240514191314408

坐标反查效果

反查是为了溯源反制做铺垫
屏幕截图 2024-05-14 231550