Problem with recalculating route too often - ios

We are using Here SDK for native iOS App. We are testing application in US, and while driving on the highway, application attempts to recalculate when near every highway exit or access road even though we stayed on the highway. Probably this is connected with GPS inaccuracy. Probably position manager thinks that we are not on highway but on highway access road. We found in documentation that setting "mapMatchingEnabled" to true should help but it didn't. We checked Here Maps application and looks that it works better.
This is how we use Here SDK:
let dataSource = NMADevicePositionSource()
dataSource.setPositioningMethod(.GPS)
let manager = NMAPositioningManager.sharedInstance()
manager.dataSource = devicePositionSource
manager.mapMatchMode = .car
manager.mapMatchingEnabled = true
Does anyone have any idea how to resolve this problem? Any help will be appreciated.

The map matching is automatically enabled during navigation and there are different causes for map matching errors.
One of them is insufficient map data because of a sketchy GPS position. You can pre-fetch the map data along the route using NMAMapDataPrefetcher.fetchMapDataForRoute before navigation is started.
Antother possibility is that you can enable the enhanced map matcher - NMAApplicationContext.enableEnhancedMapMatcher

Related

How to instanciate a NMARoute object from GPX file

We are working with the iOS Premium HereMaps SDK. Our basic question is how to instantiate a NMARoute object from a quite detailed GPX file. This object should be used for a custom turn-by-turn navigation. At the moment we take the following steps:
Create an array of NMAGeoCoordinates objects from the GPX file
Create an array of NMAWaypoints
Call [NMACoreRouter calculateRouteWithStops:]
Unfortunately we are facing multiple limitations:
The [NMACoreRouter calculateRouteWithStops:] method limits the number of waypoints. Although we have a GPX file that is detailed enough to create the whole route we have to cherry pick waypoints and let the here service calculate the route again. This process does not ensure we will get exactly the route we had in the GPX file.
NMAWaypoints cause a "You reached your stopover" voice call out during the turn by turn navigation every time a waypoint is reached. We know that it is possible to use NMAViaWaypoint as type but this is unsuitable for us because NMAViaWaypoints will be dismissed during a reroute process which could happen during the navigation. Moreover stopovers will cause a break in the navigation e.g. in the distances displayed.
For some GPS points that are located at the middle of a crossing the HereMaps routing calculation sometimes chooses a different route than intended. This is again due to the problem that HereMaps want to calculate the route by its own, despite the fact that we have a detailed GPX file containing the route.
What we are actually looking for is a better way to get a NMARoute object from a GPX file. To our surprise there is a REST endpoint provided by the HereMaps SDK to convert a GPX file to json data but unfortunately no way to feed this data into the iOS SDK.
This will sadly not work with the current HERE iOS SDK. There is a tight coupling of TbT Navigation and routing, so Navigation can only work with the internal route engine at the moment.
Some background:
Imagine you derive from your pre-calculated route while navigating (it might even happen when you don't derive, e.g. due to GPS jumps, wrong mapmatching in complex situations, temporary loss of signal, if you start in unmapped or private roadnetworks, and so on) navigation will ask routing to re-calculate. And what if your GPX trace is not matching the road network and mapdata in the iOS MobileSDK based application ? So your trace tells guidance to drive somewhere, where no road is available anymore ? Guidance would refuse and force recalculation. And in your case you most probably don't want traffic optimized navigation, but what to do with blocked roads (so not just slow free flow speed, but fully blocked)? I'd suggest to enable optimization here - but that would also not work with static GPX traces.
So as you already said, the better solution is to recalculate locally a route that's very close to your traces, but takes the local mapdata and constrains into account.
The limitations you mention are correct, but:
The Waypoint limit has been completely remove in SDK 3.6 now. But please still keep care with the number of waypoints, especially with a number > 500 and complex segments in between these waypoints.
Did you try to use NMAAudioManager delegate to intercept the audio output ? https://developer.here.com/documentation/ios-premium/topics_api_nlp_hybrid_plus/protocolnmaaudiomanagerdelegate-p.html#topic-apiref
As described above, there are many reasons why the route derives. Sometimes it's due to mapdata, sometimes due to the calculation constains. 100% reconstruction might be tricky (sometimes probably you are right with the GPX trace, but in some situations the HERE SDK might be right), so try to play around with the number of waypoints and routing options to get as close as possible.

Indoor Atlas: Get checkpoint list created

I just analysed on IndoorAtlas and tried the sample application using ios SDK. I got my location to be updating in the floor plan I have created when I move around.
I was wondering how should I get message when I reached a point where I have created a checkpoint within the floor. How should i notify user when I reach a place that I have created in floor plan.
I have checked if any function available in IndoorAtlas ios SDK so that I can get list of checkpoints available in that Floor.
Please let me know if there is any function or property available to get those done.
Thanks in advance.
the waypoints you use for mapping are at the moment just for the mapping purpose with MapCreator2, there's no API for fetching those and using for e.g. the use you describe. For that use case you could do for example geofencing.
BR,
Elina, IndoorAtlas

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.

Firefox OS device gps

I'm currently searching a way for device using firefox OS to communicate with device's gps, so it can get the exact location positioning, rather than the w3c geolocation api which is not as accurate as gps realtime.. Thanks!
Simple answer: it isn't possible to access the "device's GPS" directly. You only have the Geolocation API that you already know.
Long answer: My experience with it is not bad at all. So, I think only of two possibilities for not getting "exact location positioning", as you name it:
maybe you're not using the right options to get a precise position. In this case, you could tweak your options a bit to get better results;
maybe you're not waiting until the underlying software can use your GPS instead of some less accurate instrument/estimation (like Wi-Fi positioning estimation).
It can be a combination of both =P
In the first case, you can verify if you're using enableHighAccuracy, like this:
navigator.geolocation.watchPosition(
successCallback,
errorCallback,
{ enableHighAccuracy: true }
);
This will ask the browser for better results, as the standard indicates. Watch out that this may use more battery, and this may not be available anyway. This may take more time too, which is related to my other observation.
In the second case, you may be using a value for timeout that is too small, and maybe it's combined with a maximumAge that may be too high.
If maximumAge is high and timeout is small, you get an out dated position, as there won't be enough time to get a new position and you accept an old one.
If both are small, you'll start to get lots of TIMEOUT errors (the value is 3), as there'll be no positions for you.
You need to find the right balance between all 3 options to get the best positions. And you have to be patient sometimes.
Play with all 3 options and take a look at the errors you get. They'll tell you a lot about your issue getting precise and accurate coordinates.
The position object has some attributes that may come in handy to analyze what's happaning:
the position.timestamp attribute will tell you how old that position object is. If this is old, you know you should tweak the options
the position.coords.accuracy attribute will tell you the accuracy level of the lat/long coordinates. If this is too big (it's in meters), you know you should tweak the options
If you wait forever, on a place where the GPS should work well (say, outdoors, on a clean field), and you keep getting inaccurate results, maybe you can't do much better anyway. I'd say it's not possible anyway, with your software+hardware =(
As of now, Firefox OS only has support for GPS positioning (with the latest addition of A-GPS in the mix). That results in the fact, that most of the time you will have to wait from 1 to several minutes at least for the GPS module to acquire lock on your location, and you will need clear look at the sky for the lock to be acquired.
That said, after a lock is acquired, by using the right settings in the call itself (like setting the enableHighAccuracy flag to true) the GPS should provide as accurate position as any other device would.
Right now cell-based and wifi-based geolocation is not available in the current version of the OS (1.0.1 or 1.1.0, either) but is in the pipeline.
You can use the Geolocation API Firefox OS or Google Maps (I do not remember where I got it)

Location significant change feature in iOS 6 is not called as often as iOS 5

My app is using the "Location significant change" feature. I noticed that after compiling my app to run on iOS 6, the location update method is not getting invoked as often as on iOS 5.
I did some search on Stackoverflow and I noticed some advice to set the value of CFBundleDisplayName in plist file. However, the issue here is that the location update method does get called, only not as often as it used to. Hence, app accuracy has gone down.
Has anyone had any experience with similar issues? Any advice?
There could be different reasons for this
Significant change service uses device’s cellular radio to determine the user’s location and report changes in that location.
If you do not have proper coverage then it would not be called
It gets called based on significant change in distance. So If you have not moved enough it may not be called as you might have moved more in previous testing
In case of significant change service do not expect to get very accurate data. If you want accuracy go for standard service. But there you need to compromise on battery usage.

Resources