It boggles my mind that a company as large spread as Google can have such an awfully designed API for a service as practically mandatory as geolocation in a language as widespread as Java.
Google provides a basic geolocation service for Java, Javascript, etc. For the Java code, this consists of, one HTML POST request and some JSON parsing. The equivalent of 4 lines in total, at its most basic level.
Google Maps itself is capable of determining my location within a 10 meter accuracy radius simply by clicking a single button on Google Maps. That means Google can roughly pinpoint my location
inside a building to an extent. I need this kind of accuracy for a project I'm working on. You would think this would hold true for their API, right?
Wrong.
One hundred kilometer accuracy radius. That's the size of the city I live in. At school, the accuracy radius is about 3 kilometers, and determines my location to be across the river.
"But wait", you might say, "doesn't Google have some sort of help forum you can use?"
Well jokes on you, because they don't. They don't even have a proper tutorial. They have a documentation guide (equally as useless) which tells you
how to format your POST request. None of their example code is in Java, instead they give you a cURL query you can make in Command Line instead. Because that's what's useful here, thanks Google.
But wait it gets better. Google doesn't have a help forum for this (necessary) service because their "support" page tells you to visit, drumroll please,
Stack Overflow. I am not even kidding,
that's what they tell you to do. Anyone who has used Stack Overflow will tell you exactly how helpful
that website is. On second thought,
let me tell you myself.
And how are you supposed to obtain accurate results according to Google's instructions? Well, first you need an intimate knowledge of the inner workings of your individual computer. You need an inherent knowledge of every wifi access point and cell tower connected to your device. And they must be hardcoded, because, surprise surprise, there is absolutely
no Java library in existence that can extract this data (except Micro Edition, but Micro Edition is completely incompatible with any sort of JSON parsing and HTML connection, somehow). The POST request is supposed to
automatically detect these wifi points. It does not, leading to these inaccurate results. Yet Google Maps can pinpoint my exact location on the same device. Funny.
And no one can give me an answer.
It has been
8 weeks since I started this.
The professor said that we could just give up on geolocation if we wanted. I refuse. I refuse to let Google's horrible design flaws beat me.
Comments
Also, I've had a few headaches from GPS lol. We built a mobile app for the client that had a feature where it detects whether or not you're on the client's place of business and if you were, where exactly in the property you were. Then it marked that location on a cute little custom map drawn up by our designers. The property was like on the other side of the island, so instead of driving out there to test it, we just input dummy coordinates corresponding to landmarks on the property. Worked great when we tested it. A loooong time later, the project manager drove down to the property to demonstrate the app to our client. The GPS kept crashing the app. He called me and panickedly told me to fix it fix it fix it fix it fix it within 30 minutes. To make matters WORSE, the wifi went down in the office, and the SDK I was using required that the app be built on SDK creator's servers. Ended up tethering off of one of my co-worker's phones lol. So I had to upload the code base to the server, download the resulting apk, then send it to the project manager, all on a 3G connection.
So I fixed the errors I could find (I didn't write that part of the app personally) and sent the installer to him. Didn't crash anymore, but also never accurately detected where in the property they were (they kept bouncing around). Sorta like in Pokemon Go. I'm guessing weak GPS signal in that area or something, since it's one of those naturey places. We've put that feature on hold as far as I can tell...
PCs don't normally have GPS.
So yes, in order to guess where your PC is located, one has to go by its IP address, ISP records, and all sorts of other detective work. It often fails.
I've had Nexon refuse to sell me NX because their system was certain I was in a town 10km from my billing address.
There was also an incident I saw on the old forums where people in the United Arab Emirates couldn't play GMS because for some reason their IP addresses seemed to be in Eastern Europe.
As for your computer, Google Maps uses Google's intimate knowledge of everything you've ever done on your computer. For example, if you keep asking for directions from a certain address to various other places, or you order stuff on the internet to a certain address, or you fill in forms with that address, it guesses with a high degree of confidence that that is your home address.
If you're not at home (which they can tell by your IP), they once again use "social engineering" techniques to guess at where you might be.
If you have an android phone with you and use the game google accounts (and why wouldn't you?), they can use its location as your location. (Might even work if you have an iPhone with Google Maps on it).
I think you can understand why they would not provide access to this algorithm in their public API.