hai
Can we know current location without using gps? Is it possible?
The iPhone SDK has a framework that automatically utilizes the proper mechanism for determining location based on how accurate the result needs to be. Apple has a good article discussing these different methods of locating a device.
Also, here is a good starting point for learning about programming with Location Services.
Furthermore, you can dive right into the CoreLocation framework documentation and learn about everything you can do using Location Services on iOS.
Yes, CoreLocation can triangulate your position via nearby cell phone towers, but the position won't be as accurate as with GPS. Also, it can get your location via nearby WLANs, but this is even less reliable.
Core Location does what you want (by using Wi-Fi triangulation). Check out the documentation of CLLocationManager
Try this
map.showsUserLocation = YES;
map is my MKMapView Object.
Well thats kind of a very broad and very general question. If you are talking cell phones you can use three tower triangulation which is good when you are hitting three towers all at once, but if you are only hitting one the error can be up to a few kilometers.
Now if you are talking internet accessing devices (ie something with an IP address) again things get dicey. If you are using a stationary access point you will get a close approximation using nearest known Hubs with the IP range the device is in. Mobile devices with IPs are really hard to pinpoint.
More links
http://mithin.in/2009/06/22/using-iphone-sdk-mapkit-framework-a-tutorial
http://www.icodeblog.com/2009/12/22/introduction-to-mapkit-in-iphone-os-3-0-part-2/
and step by step guide.
http://gigaom.com/apple/iphone-dev-sessions-finding-your-way-with-mapkit/
To add to #Jenifer's answer
showsUserLocation
Discussion
This property does not indicate
whether the user’s position is
actually visible on the map, only
whether the map view is allowed to
display it. To determine whether the
user’s position is visible, use the
userLocationVisible property. The
default value of this property is NO.
Setting this property to YES causes
the map view to use the Core Location
framework to find the current
location. As long as this property is
YES, the map view continues to track
the user’s location and update it
periodically.
Core Location Framework
The Core Location framework lets you
determine the current location or
heading associated with a device. The
framework uses the available hardware
to determine the user’s position and
heading. You use the classes and
protocols in this framework to
configure and schedule the delivery of
location and heading events. You can
also use it to define geographic
regions and monitor when the user
crosses the boundaries of those
regions.
If you want to know How does the Core Location do this
It actually uses several mechanisms.
GPS
Cell Tower Triangulation
Wifi Hotspot cataloging
Randomly assuming you are in Cupertino
There are tradeoffs based on speed, precision, and available hardware. A first Gen iPad will only have the 3 option available while the iPhone simulator makes use of the last mechanism.
You can observe the difference in these systems in the map application where it initially guesses based on the cell tower, then refines the guess via GPS.
Only options #3 requires a data connection.
And for the humor impaired including #4 was not totally serious although it is functionally correct. (I think they simulate the GPS reporting that location rather than just hard coding it, but I haven't checked.)
From How does CoreLocation locate the device?
The iPod Touch does something like this. It doesn't have a GPS chip, but instead uses the available WiFi networks in the area to get a rough idea of where you're located.
Related
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 was just wondering if it was possible to make an iOS app that would track your location via GPS while it was in the background.
I tried this with the built-in app "Maps", but to no avail.
If this is possible, it would be great if you could refer me to some sample code, documentations, or tutorials!
(if this is a duplicate, please let me know and I will remove it)
This is possible — see this document for multitasking in general and this section of the Location Awareness Programming Guide for "Getting Location Events in the Background". Of course, all these talk about all of the various ways an iOS device can get your location (cell tower triangulation, Skyhook-style wifi network observation and GPS), not exclusive GPS.
In short, from reading those docs: add the UIBackgroundModes key into your info.plist, which is an array, and put the value 'location' into it. You'll then receive CLLocationManager updates even when in the background.
However, if you want to be nice to the battery then you're better off using the startMonitoringSignificantLocationChanges method on a CLLocationManager. Then you get suitably significant location updates even when in the background without being a full on background app. Other parts of the documentation state that a significant change is any change from one cell tower to another.
I am trying to find the location of user using corelocation framework in my app ,
but
it doesn't showing good results , can anyone please tell me how can i get location accurately in indoors ?
thanks in advance
regards
I am not sure, about the exact physical environment but if wifi access points are available then you can use sdk available from skyhook wireless or navision to locate your current position in case the accuracy of the gps position is not good.
This is not a failsafe approach, but may work better in areas where data is available about wireless ap.
In the general case, you can't get an accurate location indoors using Core Location. (What's wrong with your question is in assuming that you can, before asking how to do the impossible.)
You might get lucky if you are under to a tent roof that is paper thin or near a large window below lots of wide open sky, or happen to be between 3 or more nearby wifi access points whose locations are all accurately and precisely registered with whichever wifi database(s) Apple is using.
I played for a while with the maps framework from the iphone os sdk and the routemap api from cloudmade and it was fairly easy to display the current location and other information on a map by using the data provided by the GPS.
I have the map of a building(airport, mall etc) transformed in tiles of some sort, my question is what would be the best approach to obtain the current position of a phone inside a building? I know that GPS is not accurate inside buildings or might not work at all.
Unless you have a strange sort of building (i.e. radio transparent roof), you will not get a GPS signal inside the building, unless you are close to a window, which there are usually very few of (in a mall anyway).
You will not get useful positional information from cell triangulation (not at mall/airport terminal scale anyway).
I'm afraid I can't see any way to do what you are trying.
EDIT: come to think of it, some malls do have a glass roof, so it might be possible to get a GPS fix in some places. And some small airport terminals have big glass walls, although you'd be unlikely to want a map if they were very small.
If you are able to install a few WiFi nodes inside a building, you can get your location inside this building with Navizon's Indoor Positioning System.
They have a demonstration video of their indoor navigation solution on an iPhone.
Since you can't use GPS or Cell towers, you'll need some other sort of RF sources, that have known positions (as GPS and Cell Towers do) Perhaps that's what you're targeting anyway, something like a mall or airport with a number of WiFi routers in known locations, that you could "ping" off. It's not that simple of course --- an interesting research paper on such a service is at Microsoft Research: In fact they write about possible applications such as malls or airports.
Indoor Atlas maps magnetic fields in buildings and then uses smartphone magnetometer data to geolocate indoor locations to within 2 meters. It's based on the fact that buildings have predictable magnetic fields due to the materials they are constructed with. It's the best solution I've seen for this. You can try it for free as see if they've mapped the particular buildings you're trying to geolocate inside of. Another solution I've seen requires bluetooth devices within the building to assist with the geolocation, not as good because of the infrastructure requirements.
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.