Getting Latitude and longitude 0.00000,0.00000
ShababShah opened this issue · 15 comments
I have tested the google location api on postman it is working fine and return correct location parameters. when i run this given example with wifi location on esp32 i get the following response.
{"macAddress":"F6:74:1E:2B:F2:80","signalStrength":-27,"channel":1}]
Latitude: 0.0000000
Longitude: 0.0000000
Accuracy: 40000
i have attached the picture when i executed the API on postman.
kindly help me out.
May you enable log on WifiLocation.h#L12 and post it here?
May you enable log on WifiLocation.h#L12 and post it here?
Yes i have enabled it.
May you enable log on WifiLocation.h#L12 and post it here?
but in picture its not response of esp32/esp8266 its from postman software. ApI works fine on softwares. I have also test it in PHP. it works fine every where except in Esp32 and esp8266.
But, where do you have the problem in?
Same isuse here. I have created API key as suggested, connected to the wifi but the coordinates returned are 0.00000 0.00000 :
I am running the example Arduino sketch. The only thing I have changed is added the api key, wifi name and password
Maybe worth mentioning that I am using ESP32 device.
To create an API key, I simply went to : https://console.cloud.google.com/apis/dashboard?project=test-898f8 , Select Credentials -> Create Credentials -> API Key
Had the same error, just rebooted and it showed my location very accurately ( scary actually)
Also on ESP32, without a valid key I doubt you would have had the serial
output that you show
Hi, This cannot be diagnosed without a log. Please enable debug log and paste it here using example sketch.
Hi, This cannot be diagnosed without a log. Please enable debug log and paste it here using example sketch.
I have done that by enabling debugging. It just says how many routers it scanned. other msg is same as
{"macAddress":"F6:74:1E:2B:F2:80","signalStrength":-27,"channel":1}]
Latitude: 0.0000000
Longitude: 0.0000000
Accuracy: 40000
That's not the debug log. It should be something like this. Don't forget to remove all private data.
You should enble debug setting DEBUG_WIFI_LOCATION
to 1 as stated on #15 (comment)
Attempting to connect to WPA SSID: SSID
Status = 6
Attempting to connect to WPA SSID: SSID
Status = 6
Attempting to connect to WPA SSID: SSID
Status = 6
Attempting to connect to WPA SSID: SSID
Status = 6
Attempting to connect to WPA SSID: SSID
Status = 6
Attempting to connect to WPA SSID: SSID
Status = 0
Attempting to connect to WPA SSID: SSID
Status = 0
Connected
Waiting for NTP time sync: .
Current time: Fri Apr 30 07:17:09 2021
Connected to API endpoint
23 WiFi networks found
WiFi list:
[{"macAddress":"XX:XX:XX:E1:E6:23","signalStrength":-74,"channel":3},
{"macAddress":"XX:XX:XX:81:B0:F5","signalStrength":-75,"channel":3},
{"macAddress":"XX:XX:XX:C9:11:F6","signalStrength":-76,"channel":11},
{"macAddress":"XX:XX:XX:D5:9F:F5","signalStrength":-82,"channel":6},
{"macAddress":"XX:XX:XX:03:E6:7F","signalStrength":-84,"channel":11},
{"macAddress":"XX:XX:XX:64:EA:FF","signalStrength":-85,"channel":6},
{"macAddress":"XX:XX:XX:1F:07:5C","signalStrength":-85,"channel":11},
{"macAddress":"XX:XX:XX:64:EA:FE","signalStrength":-87,"channel":6},
{"macAddress":"XX:XX:XX:64:EA:FC","signalStrength":-87,"channel":6},
{"macAddress":"XX:XX:XX:88:5C:7E","signalStrength":-89,"channel":11},
{"macAddress":"XX:XX:XX:0C:11:3E","signalStrength":-90,"channel":6},
{"macAddress":"XX:XX:XX:CB:06:ED","signalStrength":-90,"channel":7},
{"macAddress":"XX:XX:XX:1B:EC:49","signalStrength":-90,"channel":11},
{"macAddress":"XX:XX:XX:E9:5F:37","signalStrength":-91,"channel":6},
{"macAddress":"XX:XX:XX:CC:8A:50","signalStrength":-91,"channel":11},
{"macAddress":"XX:XX:XX:8A:A1:18","signalStrength":-92,"channel":6},
{"macAddress":"XX:XX:XX:D8:DD:4F","signalStrength":-92,"channel":8},
{"macAddress":"XX:XX:XX:65:1E:D9","signalStrength":-93,"channel":11},
{"macAddress":"XX:XX:XX:8C:DC:44","signalStrength":-94,"channel":6},
{"macAddress":"XX:XX:XX:6B:77:55","signalStrength":-94,"channel":11},
{"macAddress":"XX:XX:XX:4A:F8:B4","signalStrength":-95,"channel":11},
{"macAddress":"XX:XX:XX:C0:C2:90","signalStrength":-95,"channel":11},
{"macAddress":"XX:XX:XX:B8:0D:3C","signalStrength":-95,"channel":11}]
requesting URL: /geolocation/v1/geolocate?key=AIxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxUI
request:
POST /geolocation/v1/geolocate?key=AIxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxUI HTTP/1.1
Host: www.googleapis.com
User-Agent: ESP8266
Content-Type:application/json
Content-Length:1639
Connection: keep-alive
{"considerIP":false,"wifiAccessPoints":[
{"macAddress":"XX:XX:XX:E1:E6:23","signalStrength":-74,"channel":3},
{"macAddress":"XX:XX:XX:81:B0:F5","signalStrength":-75,"channel":3},
{"macAddress":"XX:XX:XX:C9:11:F6","signalStrength":-76,"channel":11},
{"macAddress":"XX:XX:XX:D5:9F:F5","signalStrength":-82,"channel":6},
{"macAddress":"XX:XX:XX:03:E6:7F","signalStrength":-84,"channel":11},
{"macAddress":"XX:XX:XX:64:EA:FF","signalStrength":-85,"channel":6},
{"macAddress":"XX:XX:XX:1F:07:5C","signalStrength":-85,"channel":11},
{"macAddress":"XX:XX:XX:64:EA:FE","signalStrength":-87,"channel":6},
{"macAddress":"XX:XX:XX:64:EA:FC","signalStrength":-87,"channel":6},
{"macAddress":"XX:XX:XX:88:5C:7E","signalStrength":-89,"channel":11},
{"macAddress":"XX:XX:XX:0C:11:3E","signalStrength":-90,"channel":6},
{"macAddress":"XX:XX:XX:CB:06:ED","signalStrength":-90,"channel":7},
{"macAddress":"XX:XX:XX:1B:EC:49","signalStrength":-90,"channel":11},
{"macAddress":"XX:XX:XX:E9:5F:37","signalStrength":-91,"channel":6},
{"macAddress":"XX:XX:XX:CC:8A:50","signalStrength":-91,"channel":11},
{"macAddress":"XX:XX:XX:8A:A1:18","signalStrength":-92,"channel":6},
{"macAddress":"XX:XX:XX:D8:DD:4F","signalStrength":-92,"channel":8},
{"macAddress":"XX:XX:XX:65:1E:D9","signalStrength":-93,"channel":11},
{"macAddress":"XX:XX:XX:8C:DC:44","signalStrength":-94,"channel":6},
{"macAddress":"XX:XX:XX:6B:77:55","signalStrength":-94,"channel":11},
{"macAddress":"XX:XX:XX:4A:F8:B4","signalStrength":-95,"channel":11},
{"macAddress":"XX:XX:XX:C0:C2:90","signalStrength":-95,"channel":11},
{"macAddress":"XX:XX:XX:B8:0D:3C","signalStrength":-95,"channel":11}]}
request sent
Free heap: 228344
.
Got response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Vary: X-Origin
Vary: Referer
Date: Fri, 30 Apr 2021 07:17:14 GMT
Server: scaffolding on HTTPServer2
Cache-Control: private
X-XSS-Protection: 0
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Alt-Svc: h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
Accept-Ranges: none
Vary: Origin,Accept-Encoding
Transfer-Encoding: chunked
60
{
"location": {
"lat": 20.956578462,
"lng": 12.2999999995
},
"accuracy": 95
}
0
Lat: 20.9565784
Lon: 12.3
Accuracy: 95
Location request data
23 WiFi networks found
WiFi list:
[{"macAddress":"XX:XX:XX:81:B0:F5","signalStrength":-75,"channel":3},
{"macAddress":"XX:XX:XX:E1:E6:23","signalStrength":-75,"channel":3},
{"macAddress":"XX:XX:XX:C9:11:F6","signalStrength":-76,"channel":11},
{"macAddress":"XX:XX:XX:D5:9F:F5","signalStrength":-84,"channel":6},
{"macAddress":"XX:XX:XX:03:E6:7F","signalStrength":-84,"channel":11},
{"macAddress":"XX:XX:XX:1F:07:5C","signalStrength":-84,"channel":11},
{"macAddress":"XX:XX:XX:CB:06:ED","signalStrength":-85,"channel":7},
{"macAddress":"XX:XX:XX:1B:EC:49","signalStrength":-85,"channel":11},
{"macAddress":"XX:XX:XX:64:EA:FC","signalStrength":-86,"channel":6},
{"macAddress":"XX:XX:XX:64:EA:FF","signalStrength":-86,"channel":6},
{"macAddress":"XX:XX:XX:64:EA:FE","signalStrength":-87,"channel":6},
{"macAddress":"XX:XX:XX:CC:8A:50","signalStrength":-88,"channel":11},
{"macAddress":"XX:XX:XX:E9:5F:37","signalStrength":-91,"channel":6},
{"macAddress":"XX:XX:XX:8A:A1:18","signalStrength":-91,"channel":6},
{"macAddress":"XX:XX:XX:0C:11:3E","signalStrength":-91,"channel":6},
{"macAddress":"XX:XX:XX:88:5C:7E","signalStrength":-91,"channel":11},
{"macAddress":"XX:XX:XX:23:7B:C9","signalStrength":-92,"channel":13},
{"macAddress":"XX:XX:XX:66:61:30","signalStrength":-93,"channel":6},
{"macAddress":"XX:XX:XX:8C:DC:44","signalStrength":-93,"channel":6},
{"macAddress":"XX:XX:XX:B8:0D:3C","signalStrength":-94,"channel":11},
{"macAddress":"XX:XX:XX:49:4E:89","signalStrength":-95,"channel":9},
{"macAddress":"XX:XX:XX:65:1E:D9","signalStrength":-95,"channel":11},
{"macAddress":"XX:XX:XX:6B:77:55","signalStrength":-95,"channel":11}]
[{"macAddress":"XX:XX:XX:81:B0:F5","signalStrength":-75,"channel":3},
{"macAddress":"XX:XX:XX:E1:E6:23","signalStrength":-75,"channel":3},
{"macAddress":"XX:XX:XX:C9:11:F6","signalStrength":-76,"channel":11},
{"macAddress":"XX:XX:XX:D5:9F:F5","signalStrength":-84,"channel":6},
{"macAddress":"XX:XX:XX:03:E6:7F","signalStrength":-84,"channel":11},
{"macAddress":"XX:XX:XX:1F:07:5C","signalStrength":-84,"channel":11},
{"macAddress":"XX:XX:XX:CB:06:ED","signalStrength":-85,"channel":7},
{"macAddress":"XX:XX:XX:1B:EC:49","signalStrength":-85,"channel":11},
{"macAddress":"XX:XX:XX:64:EA:FC","signalStrength":-86,"channel":6},
{"macAddress":"XX:XX:XX:64:EA:FF","signalStrength":-86,"channel":6},
{"macAddress":"XX:XX:XX:64:EA:FE","signalStrength":-87,"channel":6},
{"macAddress":"XX:XX:XX:CC:8A:50","signalStrength":-88,"channel":11},
{"macAddress":"XX:XX:XX:E9:5F:37","signalStrength":-91,"channel":6},
{"macAddress":"XX:XX:XX:8A:A1:18","signalStrength":-91,"channel":6},
{"macAddress":"XX:XX:XX:0C:11:3E","signalStrength":-91,"channel":6},
{"macAddress":"XX:XX:XX:88:5C:7E","signalStrength":-91,"channel":11},
{"macAddress":"XX:XX:XX:23:7B:C9","signalStrength":-92,"channel":13},
{"macAddress":"XX:XX:XX:66:61:30","signalStrength":-93,"channel":6},
{"macAddress":"XX:XX:XX:8C:DC:44","signalStrength":-93,"channel":6},
{"macAddress":"XX:XX:XX:B8:0D:3C","signalStrength":-94,"channel":11},
{"macAddress":"XX:XX:XX:49:4E:89","signalStrength":-95,"channel":9},
{"macAddress":"XX:XX:XX:65:1E:D9","signalStrength":-95,"channel":11},
{"macAddress":"XX:XX:XX:6B:77:55","signalStrength":-95,"channel":11}]
Location: 20.9565784,12.3
Accuracy: 95
Result: OK
I'm facing the same issue. Tried rebooting but no luck. Here is the log output of DEBUG_WIFI_LOCATION (Where i found HTTP/1.1 404 Not Found) :
Attempting to connect to WPA SSID: X:X:X:X:X:X
Status = 3
192.168.0.111
Connected
Waiting for NTP time sync: ............................................................
Current time: Sun May 16 14:53:27 2021
Connected to API endpoint
9 WiFi networks found
WiFi list:
[{"macAddress":"X:X:X:X:X:X","signalStrength":-69,"channel":1},
{"macAddress":"X:X:X:X:X:X","signalStrength":-87,"channel":1},
{"macAddress":"X:X:X:X:X:X","signalStrength":-83,"channel":1},
{"macAddress":"X:X:X:X:X:X","signalStrength":-89,"channel":1},
{"macAddress":"X:X:X:X:X:X","signalStrength":-67,"channel":3},
{"macAddress":"X:X:X:X:X:X","signalStrength":-67,"channel":3},
{"macAddress":"X:X:X:X:X:X","signalStrength":-75,"channel":5},
{"macAddress":"X:X:X:X:X:X","signalStrength":-88,"channel":6},
{"macAddress":"X:X:X:X:X:X","signalStrength":-81,"channel":10}]
requesting URL: /geolocation/v1/geolocate?key=X:X:X:X:X:X
request:
POST /geolocation/v1/geolocate?key=X:X:X:X:X:X HTTP/1.1
Host: www.googleapis.com
User-Agent: ESP8266
Content-Type:application/json
Content-Length:662
Connection: keep-alive
{"considerIP":false,"wifiAccessPoints":[{"macAddress":"X:X:X:X:X:X","signalStrength":-69,"channel":1},
{"macAddress":"X:X:X:X:X:X","signalStrength":-87,"channel":1},
{"macAddress":"X:X:X:X:X:X","signalStrength":-83,"channel":1},
{"macAddress":"X:X:X:X:X:X","signalStrength":-89,"channel":1},
{"macAddress":"X:X:X:X:X:X","signalStrength":-67,"channel":3},
{"macAddress":"X:X:X:X:X:X","signalStrength":-67,"channel":3},
{"macAddress":"X:X:X:X:X:X","signalStrength":-75,"channel":5},
{"macAddress":"X:X:X:X:X:X","signalStrength":-88,"channel":6},
{"macAddress":"X:X:X:X:X:X","signalStrength":-81,"channel":10}]}
request sent
Free heap: 19720
.
Got response:
HTTP/1.1 404 Not Found
Vary: X-Origin
Vary: Referer
Content-Type: application/json; charset=UTF-8
Date: Sun, 16 May 2021 14:53:31 GMT
Server: scaffolding on HTTPServer2
Cache-Control: private
X-XSS-Protection: 0
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Alt-Svc: h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
Accept-Ranges: none
Vary: Origin,Accept-Encoding
Transfer-Encoding: chunked
108
{
"error": {
"code": 404,
"message": "Requested entity was not found.",
"errors": [
{
"message": "Requested entity was not found.",
"domain": "global",
"reason": "notFound"
}
],
"status": "NOT_FOUND"
}
}
0
Location request data
8 WiFi networks found
WiFi list:
[{"macAddress":"X:X:X:X:X:X","signalStrength":-66,"channel":1},
{"macAddress":"X:X:X:X:X:X","signalStrength":-79,"channel":1},
{"macAddress":"X:X:X:X:X:X","signalStrength":-81,"channel":1},
{"macAddress":"X:X:X:X:X:X","signalStrength":-86,"channel":1},
{"macAddress":"X:X:X:X:X:X","signalStrength":-67,"channel":3},
{"macAddress":"X:X:X:X:X:X","signalStrength":-65,"channel":3},
{"macAddress":"X:X:X:X:X:X","signalStrength":-90,"channel":6},
{"macAddress":"X:X:X:X:X:X","signalStrength":-90,"channel":10}]
[{"macAddress":"X:X:X:X:X:X","signalStrength":-66,"channel":1},
{"macAddress":"X:X:X:X:X:X","signalStrength":-79,"channel":1},
{"macAddress":"X:X:X:X:X:X","signalStrength":-81,"channel":1},
{"macAddress":"X:X:X:X:X:X","signalStrength":-86,"channel":1},
{"macAddress":"X:X:X:X:X:X","signalStrength":-67,"channel":3},
{"macAddress":"X:X:X:X:X:X","signalStrength":-65,"channel":3},
{"macAddress":"X:X:X:X:X:X","signalStrength":-90,"channel":6},
{"macAddress":"X:X:X:X:X:X","signalStrength":-90,"channel":10}]
Location: 0.0000000,0.0000000
Accuracy: 40000
Result: OK
My Google Dev account statistics are showing the hit count number
I'm running ESP8266 Core 2.7.3 and ESP32 1.0.4. Tried upgrading to latests ones (3.0.0 & 1.0.6 respectively), but no luck.
Anyone got any luck with this?
I have noticed that this problem seems to hit windows platform, My group in school is doing an assignment and 3 with windows computers got the problem of null problems while the Macs got it working. Something in the compiling state ?
I would say that API key is wrong. Check that it has this format: AIxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxUI
It may be another reason: Has you enabled Geolocation API in your project in Google Dev Console?
I have noticed that this problem seems to hit windows platform, My group in school is doing an assignment and 3 with windows computers got the problem of null problems while the Macs got it working. Something in the compiling state ?
I am on MAC too.... not tried on Windows yet
I would say that API key is wrong. Check that it has this format: AIxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxUI
It may be another reason: Has you enabled Geolocation API in your project in Google Dev Console?
Hi, thanks for your response. As you see, I am getting hits on my Google Dev portal for the API Token I am using (I had enclosed the screen shot of my Google Geo Page Dev Console in my previous post). So I am presuming the key is correct.
Also as many times I tried with the API Key, my hit counts on key increases... which also means my API key is activated too...
Any suggestions?
Hi, just got an update from Google support team. Though the API console was showing the number of hits, I guess the issue is with their system, and not with the code or tries..
here's the brief of the response:
Hello, I see that the project you opened this case with has a billing account with an INR currency
Google cannot currently charge customers in your country within the new Maps Platform model due to tax and legal regulations
because of this, you will need to create a new billing account to be used with your project
I guess, this answers the issue....