I've tried to find a solution for my task everywhere and got nothing. So I am here.
I'm trying to detect user's location with very high accuracy, but I am looking for the city only.
What I mean: Device located in some quadratic or o-shaped city (Moscow for example). Now the app should detect current location of user's device - is it in Moscow or outside.. with high accuracy as I said earlier.
I don't understand how to "draw" a virtual border over the map to detect - user inside or outside of it.
Related
I would like to make a iPhone mapping application. I know that the iPhone can give detailed longitude and latitude coordinates of the user's specific location. How do Google Maps and other mapping applications translate the user's location into the location on the map? There seems to be lots of things to consider. For example, what if the map is rotated, and it seems to me that it there is a lot of scaling and stuff to consider. How does Google Maps translate the user's current location into a specific point on the map and have it be so accurate (within 2 to 3 meters). I would really appreciate an answer or any help. Thanks!
The Google Maps application knows:
the way the Google Maps service has divided the map into tiles
the size and location (lat/lon) of every map tile
the user's selected zoom level
the size of the device screen
the position latitude and longitude reported by the device
With this information, the maps application can do some simple linear arithmetic to find out which tile(s) need to be displayed on the screen so that the user's location is shown in the middle of the screen (or wherever desired).
Your heading/rotation is irrelevant when determining your location. Your location is based on data received from the GPS satellites. There's multiple satellites, and based on how far you are from each, your location is narrowed down to one point. This point has a very detailed pair of coordinates (think 10 digits past decimal point). Every point on Google's provided map is associated with a pair of coordinates. So when your phone figures out your coordinates, it then checks to see where on the map it corresponds to, and places you there on the map. All other locations are also based on coordinates.
Now, the map also has a setting where the map rotates based on your heading. That feature uses the built-in compass that the phone has. The iPhone has had a built-in compass since the 3GS, I believe.
In short, think of the maps provided by Google as a giant, extremely high-resolution image provided by Google, where every pixel (or less) on this image corresponds to a pair of coordinates. After your coordinates are determined, your placed on the corresponding point on that image, regardless of zoom level.
Google maps uses a few different methods to get the location of the user including the location of the mobile network tower the user is connected to (sometimes Google uses triangulation of 2 or more towers to make this more accurate http://techcrunch.com/2007/11/28/google-mobile-maps-pinpoints-your-location-without-gps/), the location of the ISP if the user is connected to WiFi and GPS.
The most accurate is GPS which provides Google with Latitude and Longitude coordinates accurate to within (If I remember correctly) 10 meters. All the images in the Google maps system have GPS coordinates stored against them so all Google has to do is retrieve the right map image and plot the user's position on the image.
I think this is what you're after but if you need more detail about something or if I've misunderstood please leave a comment and I'll modify this answer.
Edit
Please see this page which gives a good introduction to using Google Maps on the iPhone https://developers.google.com/maps/articles/tutorial-iphone
You don't need to code the algorithm for placing a marker on the map to show the users location, it's a simple matter of calling a function/method in the Google Maps API and it does all the work for you. I would suggest having a thorough look through the Google Maps API documentation to find what you need (also found at the previous link).
I think this might be the precise snippet of code you're after:
https://developers.google.com/maps/documentation/javascript/overlays#Markers
I have an issue that i am having trouble to solve. We are about to develop an iphone locative application that would take you around the city with audio that would be played based on the location. I was wondering, do you know how accurate the iphone GPS will be? In terms of actual distance. I am reading 250 m on line but it looks a lot. Plus the gps in the iphone finds my location more precisley than 250 m. I know it is a generic question, but mabe you guys can give me a feedback about it, i am quite desperate and exausted. what we would live to do is, every 70-80 m, put a pin on a map with an audio file, when the user crossed the pin it would trigger an event that is the audio file. I just would love to know how accurate the gps could be so that i can start designing the experience.
Thanks a lot
I've seen iPhone's GPS as accurate as 3m (at least that's what it said on my device when testing).
There is also a new API since iOS 4.0 that you might be interested in that will enable you to set a region for the device to monitor and it will automatically generate a callback when the user crosses the virtual fenceline depending on how accurate you need that to be. This is particularly useful when the app is sent to the background since you can simply monitor the user's location using CLLocation when the app is in the foreground:
- (void)startMonitoringForRegion:(CLRegion *)region desiredAccuracy:(CLLocationAccuracy)accuracy
You can get up to 5 meters accuracy. Within the core location framework there is a property - horizontalAccurracy - that you can read at runtime to get the accuracy for a given moment
The accuracy is anywhere from 5-25m.
I needed to implement the positioning functionality in my next app. I got a few questions regarding the development.
1) I found the tutorial and implemented the positioning thing.. but is it possible to simulate my code with iphone simulator or is it necessary to use the device for this purpose. while googling i read on some forum that 4.2 SIM supports GPS apps simulation though it will give Apple's headquarter's location every time but in my case the CLLocationManager's didFailWithError delegate gets called. any help with that!!
2) After determining the position, longitude and latitude, how to determine the exact area name and other information from it?
Thanks in advance for your invaluable time and feedbacks.
CLLocationManager will in fact return the location of the network the simulator is using. It's MapKit that will think the current location is in Cupertino at Apple's headquarters. That you get two different locations from the calls often causes confusion.
You can get information about a given latitude and longitude by using the MKReverseGeocoder. It will attempt to give you a full address, but you can use whatever portion of it you'd like (just the country, or city and state/province, whatever).
Will the GPS cordinates be accurate enough to build an app which helps the user to navigate inside a building? Ex: to give path to the EXIT, to give path to navigate to a wash room, different section etc?
Not in all buildings GPS even work, and, when outside, it is not precise enough without additional stations.
Typical GPS precision is 10-12 meters.
I have been programming an app using the mapkit and the SDK 3.0. Everything works allright except for one detail. I have noticed that when displaying the userlocation I get different user positions on the map dependent of the current network. I have read about this problem and understand that it is common? In my WLAN is the user position correctly displayed. When using the 3G net (T-mobile) the position is some 100 meters away from my actual position. I understand this has to do with the celluar phone net using triangulation and in WLAN is the GPS or WiFi hotspot used. So, to my question. Is there a way to go around this? My app shows positions in a town and also the distance to those positions. It is very obvious and also missleading if the position is false because of the short distances. Is there a way (in code) to set which method to be used for getting the user postion? I have tested all other apps on my iPhone using maps and the problem seem to be the same by all of them. (If someone wants to test my app it is in the app store for free under car2go also other comments are of course interesting)
Thanks in advance!
-loop-
Core Location provides information about the vertical and horizontal accuracy of the location that it is reporting. One should use that accuracy to report to the user if the location is suspect. Google maps does this by increasing the size of the blue circle around the location marker. There are other ways to indicate to the user that the location is suspect, alert boxes, not showing the location if it falls outside of some predetermined accuracy, etc.
See: http://developer.apple.com/iphone/library/documentation/CoreLocation/Reference/CLLocation_Class/CLLocation/CLLocation.html#//apple_ref/occ/instp/CLLocation/horizontalAccuracy
Use an alternate source for your location? Portable GPS units would do the trick.
The real question is how can you correct the data being specified by the 3G triangulation. I wonder if you can do a differential to correct for the 3G's location errors.
1) In a given city, calibrate the 3G location errors by plotting the city. This could be corrected by the 3G networks at any time, so you'd have to have a way to verify and re-calibrate.
2) Calibrate the 3G network's location using a known location - a 3G location along with a GPS location. Take that as a differential that can be applied to other 3G locations. This assumes a consistent offset in the triangulation calculation which probably isn't the reality.
3) Wait for the 3G networks to fix it and do nothing in the meantime.
4) Provide the 3G network provider with error information in their triangulation and see if it is a priority for them.
I can't think of any other viable options...
Perhaps you can use CoreLocation directly. CLLocationManager gives you CLLocation objects than include their accuracy. If you get an accuracy below 50 meters, it the location probably came from GPS.