2

I'm using the Google Geolocation API to approximate location based on cell towers that are visible. However, I always get the same location as the result.

Using the following body:

{
    "considerIp": false,
    "radioType": "lte",
    "cellTowers": [{
        "signalStrength": -78,
        "cellId": 133978007,
        "mobileNetworkCode": 410,
        "mobileCountryCode": 310,
        "locationAreaCode": 27196
    }]
}

Produces the following result: {"location": {"lat": 31.968598800000002, "lng": -99.9018131}, "accuracy": 1457406}

The actual location of that tower/cell is approx (32.783062, 96.795769). In fact, the cell tower specified is take directly from OpenCellID's database (opencellid.org)

If I then select a tower somewhere else (e.g. Palo Alto)

{
    "considerIp": false,
    "radioType": "lte",
    "cellTowers": [{
        "signalStrength": -78,
        "cellId": 84785686,
        "mobileNetworkCode": 480,
        "mobileCountryCode": 311,
        "locationAreaCode": 7943
    }]
}

The response is: {"location": {"lat": 31.968598800000002, "lng": -99.9018131}, "accuracy": 1457406} which is exactly the same.

If I can my public IP (via changing VPN end-point location) the results DO change. Using the same Palo Alto query but changing from a Texas to Chicago end-node my result changes to: {"location": {"lat": 37.09024, "lng": -95.712891}, "accuracy": 1488703}

It looks like the considerIp=false argument is being ignored and that is only being used instead of the provided cell tower.

Any ideas how to fix this? Thanks!

spockmay
  • 66
  • 3

2 Answers2

3

I figured it out. Apparently if the Content-Type is not being explicitly set to application/json then the body is silently ignored and only the local IP is considered.

I would like to request that Google updates the API response body to include something to that effect.

spockmay
  • 66
  • 3
0

Include a flag "considerIp": false,,in the request body.

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 09 '23 at 01:04