unlimited reverse Geocoding request - ios

I have implemented an application which can import a GPX file and it contains many lat/long coordinates (several hundred).
My application performs a reverse geocoding for each lat/long. I want to display in a tableview all lat/long with their address (which will be ordered by country and town).
I'm performing only one geocoding request at a time (like it's described in Apple's documentation of reverseGeocodeLocation() in Core Location.
When I get the answer of a geocoding request then I request the next one and then until I have resolved all my Lat/Long.
Unfortunately when I have resolved around 40 Lat/Long, the reverseGeocodeLocation() raises an error (CLError.network) and then I need to wait 60 seconds before the resolve the next ones etc...
I have several questions:
- Is there a way to go faster? because if I have 800 lat/long it will takes around 20 minutes (800/40) * 60 = 1200 seconds (it's very long for an App running on a iPhone)
- Even if I don't perform improvements on the rate, is there a risk that if I have many users then Apple will forbid my App because the number of Geocoding request will be too high?
Thanks for your feedback
Regards,
Sebastien

Is the GPX file static or will it be changing for every user/download? If static, then maybe just reverse geocode all the coords beforehand?
Alternately, look for a different service to do reverse geocoding.

Related

Core Location skips user movements with CLVisit monitoring turned on

The app I'm working on records information about places where user spends most of his/her time. Core Location's Visits monitoring fulfil all it's requirements in location information absolutely.
While testing this app our QA-engineers revealed evidence that Core Location misses Visits for unknown reason. And this is not a result of low location accuracy. Core Location starts skipping locations registered before without any problems.
To make things clear we've run the test. I installed on his phone our app and example app: https://github.com/steveschauer/TestCLVisit
After 3 days of testing we compared locations from our app, sample app and information from Settings->Privacy->Location Services->System Services->Frequent Locations.
Information from all sources was equal. So we can say that it's not an issue of our app.
But while all locations registered at first day was correct, many locations of second and third day were missed. Only few of them were registered.
Is it normal behaviour for Visits Monitoring?
What could be a reason of such skips?
Does anybody have negative or positive experience of Visits monitoring?
Yes, I faced some similar issues while using CLVisit API. There is also an article from NSHipster, which describe some issues with CLVists and these are still present in iOS 10. It essentially goes on to say that if you want infrastructure that extremely precise don't use CLVisit.
From our experience, CLVisit is not all that precise. While start and end times are generally accurate within a minute or two, lines get blurred at the edges of what is and what is not a visit. Ducking into a corner coffee shop for a minute might not trigger a visit, but waiting at a particularly long traffic light might.

iOS NearBy devices

Hi I am creating two apps where each app needs to know the location of the other app. I am using corelocation for that. However I am not sure whats the best/efficient way of getting the nearby devices. I can create a database with co-ordinates using parsi api. However I think that would be a lot of work to calculate the shortest distance every few minutes. Any ideas? I have a map for each app and i want to display the shortest distance between the two users on the map.I am using google maps api for ios
The API to calculate distance is pretty lightweight. Internally you use the Haversine formula to calculate distance including the curvature of the Earth. From the iOS perspective though you simply do this:
CLLocation* previousPoint = [self.allLocations objectAtIndex:i-1];
CLLocation* currentPoint = [self.allLocations objectAtIndex:i];
CLLocationDistance distanceFromPrevPoint = [previousPoint distanceFromLocation:currentPoint];
You can easily iterate over the other devices in the zone. If you want to reduce the number of calculations, you could only calculate distances to devices in the same base latitude longitude (ignore minutes and seconds).
Since you're using Parse, you should be able to do a PFQuery for all place objects within a given range. See the documentation here: https://www.parse.com/docs/ios_guide#geo/iOS (Geo Queries)
If they're close enough (~30 meters) you can use iBeacons.
What would work the best depends on your particular app's needs.
Edit: Since you said your distance is too far, iBeacons won't work.
The brute-force way to do this is to run through all connected devices and calculate the (Pythagorean) distance to each one, and select the ones that are within your distance threshold. That's very time-consuming however.
Instead you might want to have each device report some sort of region code for each location (State? County? Zip code?) as the location changes. You'd use geocoding to generate the region information. You could have the reporting devices do the geocoding themselves, so they are only responsible for updating location information for a single device and you don't bog down doing geocoding. You'd report lat/long and region information to the server as it changes, with a "choke" to only report changes on significant changes, or once per minute, whichever is LESS frequent. (I remember reading in the docs that you are only supposed to submit a small number of geocoding calls or you get locked out and/or your app gets rejected.)
You'd collect the data in a central server.
Then you could start by requesting other users that match your current region (and possibly nearby regions) and then do distance calculations only on that small subset of your data that matches the region code.

Rails + geocodes: Finding latitude and longitudes for 20k addresses

I am using the geocoder gem for working with geolocation data.
Now, I have a list of 20k addresses and I to find for them their latitude and longitude coordinations. I am using for this Bing Maps, which allows to send 125k requests per day. So that's good.
But there's a problem - because when I send quickly a few requests through geocoder to decode some addresses, instead of returning the addresses it returns an empty array (nothing).
I think it's because of sending too many requests within a very short period of time. So I was thinking about putting there a delay between making those calls to geocoder, like:
sleep 3 # pause for 3 seconds
This is just a thought - how big should be the pause between the calls of geocoder? Or is there any better way to process 20k of data with using geocoder?
Thank you
Unless this is for a Windows app the limit is 125,000 a year. Windows apps can do 50,000 a day. Note that non-enterprise accounts are rate limited. When you make too many requests in a short period of time an empty response will be returned and a flag in the header will indicate that the request was rate limited. This is documented here: http://msdn.microsoft.com/en-us/library/ff701703.aspx

Finding current region with lat long in offline mode

I am currently working on an app which requires the current region in which the user is in.The worst part is app is completely off line.
My logic :
1.Take a screen shot of the city draw squares on that.
Store square 4 points (lat long values taken with respect to map) in DB.
With the lat long values got from gps i can easily find out lat lont belongs to what reason.
I am just wondering if anybody can suggest me better idea to work my app offline.
Thank you in advance ..
You will probably find you have problems getting a location if you have no network access. iOS uses assisted-GPS, which allows the device to both lock onto GPS satellites much faster than it might otherwise take, and also pull in other data from the network to quickly determine location.
Without network access you may not get a location reported back at all, especially if the app was being used indoors (vanilla GPS reception is typically very bad without line of sight). If you do get a location it may take several minutes for an accurate enough reading to be provided.
you can use the RouteMe library which is based on OpenStreetMap. this allows to download map data in advance.
If you want to work with screenshots (from a legal source) then you use the Helmert transformation to transform between gps and picture-pixel coordinazes.
you need at least 3 points in the picture-map for which you now the lat,lon coordinates.

getting the location and speed via mobile platforms

Is there any possibility of getting the location of a user, moving direction, and the speed via mobile platforms(client side programming like j2me) ? if there is availability in any platform please let me know the platform and please give me some study links to study about it?
regards,
Rangana
I'm not sure if there is an API for this, mainly because I don't think that this information (velocity) is available.
You can still figure it out though, and this would work on all cell phones that allow you to access their "current location".
Ping the phone for it's current location every n seconds (10,20,30 seconds, etc...)
Log the location of the phone at every ping (lat,long)
Determine the distance traveled from ping-to-ping. You may need to use vector resolution (http://www.physicsclassroom.com/class/vectors/u3l1e.cfm)
For example, if a phone moves 1000 meters over the course of a 30 second ping, that means:
1000 meters / 30 seconds = 33.333 m/s
Doing this, you can also determine acceleration, etc... This would not give you instantaneous velocity or acceleration, but instead average velocity and average acceleration.
Without GPS it is impossible to get the speed and exact location. You can however retrieve the base station location from several web services and determine your approximate location.

Resources