Google geolocation api returns server location where the app is deployed
Assuming you are referring to this Google Maps Geolocation API, please make sure your client is invoking the HTTP GET request to the www.googleapis.com
API endpoint, and not the server. That should help the API backend detect your client's public IP address correctly for the considerIp
configuration.
HTML5 geolocation vs Google Maps Geolocation api
The Google Maps Geolocation API is an HTTP endpoint that accepts user-supplied JSON data about nearby Wifi networks and cell towers and produces an estimate of the user's location.
The HTML5 navigator.geolocation
object supplies a browser API that does some set of operations and then produces an estimate of the user's location. From the W3C geolocation spec:
TheThe API itself is agnostic of the underlying location information sources. Common sources of location information include Global Positioning System (GPS) and location inferred from network signals such as IP address, RFID, WiFi and Bluetooth MAC addresses, and GSM/CDMA cell IDs, as well as user input.
navigator.geolocation
function may make use of any information available to the browser application, including any information from the device's GPS hardware, if it has any. Of course, it may also make use of any third-party Web APIs (including, possibly, the Google Maps Geolocation API) that can be reached. There is no specified required approach or inputs that must or must be used; the browser can do anything in its power to make a location estimate. It may do a better or worse job than Google's approach, depending on their particular implementations, or the browser may (as you suggest) actually directly use Google's API.In short, Google's API is a way to ask, "Based on this cell and Wifi info, tell me where I am." The HTML5 API is a way to tell the browser, "You have access to the Internet and all the physical inputs available to my device; find out where I am, somehow."
I'm not surprised to learn that, if no GPS is present, the browser might outsource its geolocation work to a third-party service like Google. Browser vendors are generally interested in making browsers, not writing a robust service to solve the hard problem of transforming cell/Wifi data into location information. Furthermore, it requires a tremendous amount of geospatial data about the locations of various towers and Wifi SSIDs. It would bloat the browser to hold all the information locally, and any attempt for thevendor to host the information remotely would functionally be setting up a competitor to Google's already known-good service.
Calling geolocation api in http on AWS
I found that it is a http, https thing. I registered a domain using github student developer pack and used that to setup ssl and it worked like a charm.
Related Topics
How to Check Is Timezone Identifier Valid from Code
Having Trouble Writing to a File with PHP on Ubuntu
Datetime Now PHP MySQL (+ Pdo Variant)
Check If Two PHP Datetime Objects Are Set to the Same Date ( Ignoring Time )
How to Get the Root Url of the Site
Upload Progress Using Pure PHP/Ajax
Efficient Reloading Data/Pushing Data from Server to Client
SQL - Insert and Catch the Id Auto-Increment Value
How Would You Transform a Pre-Existing Web App into a Multilingual One
How to Auto-Resize a Div with CSS While Keeping Aspect Ratio
Looping Through a Simplexml Object, or Turning the Whole Thing into an Array
Z-Scores(Standard Deviation and Mean) in PHP
Codeigniter Force Download Files