# Extract location of my WIFI

**URL:** <https://discourse.nodered.org/t/extract-location-of-my-wifi/61762>\
**Category:** General\
**Created:** [25 April 2022 17:29 UTC](https://discourse.nodered.org/t/extract-location-of-my-wifi/61762 "2022-04-25T17:29:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nice\_to\_have](https://avatars.discourse-cdn.com/v4/letter/n/edb3f5/32.png) [@Nice\_to\_have](https://discourse.nodered.org/u/Nice_to_have)\
**Post date:** [25 April 2022 17:29 UTC](https://discourse.nodered.org/t/extract-location-of-my-wifi/61762/1 "2022-04-25T17:29:21Z")

</div>

Hi all,

Is there a way to extract my location from wifi?  
My laptop seems to have a pretty accurate idea of where I am when I connect to my phone hotspot. It also knows where it is when I connect to a MIFI.  
How can I extract my location in node red from my wifi connections?

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [25 April 2022 18:49 UTC](https://discourse.nodered.org/t/extract-location-of-my-wifi/61762/2 "2022-04-25T18:49:53Z")

</div>

On Windows, this PowerShell script will return your Latitude and Longitude to the best of the location API's ability.

```nohighlight
<#
 # To use this, you have to turn on Location settings and allow apps to use your location
 #>

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.
}

```

Just note that the location is based on a number of things including your IP address, ISP and Wi-Fi where available. If you are on a device that supports GPS, that will be used and if you are using a mobile device, the cell-tower information can also be used.

Just remember that this info gets sent to Microsoft in order to get your location. Use with caution.

You can also craft a web page that will request access to location info.

For my desktop PC, the script returns a point about 34m away from my seat! Somewhat scary, I leave it turned off most of the time.

---

<div class="post-metadata">

**Author:** ![Nice\_to\_have](https://avatars.discourse-cdn.com/v4/letter/n/edb3f5/32.png) [@Nice\_to\_have](https://discourse.nodered.org/u/Nice_to_have)\
**Post date:** [26 April 2022 10:23 UTC](https://discourse.nodered.org/t/extract-location-of-my-wifi/61762/3 "2022-04-26T10:23:18Z")

</div>

That's pretty accurate. This gave me the lat & lon of the house across the street from me.

Thanks

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [10 May 2022 10:23 UTC](https://discourse.nodered.org/t/extract-location-of-my-wifi/61762/4 "2022-05-10T10:23:51Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
