Optimal path between more than 23 points - android

I know that google api provide a way to provide 23 way points where it optimize the route for you.
If I have more than 23 points, how can I achieve that? I can divide them into 2 groups but how do I know which 2 ones should be connected between the groups
The other way I thought about it is to find which point is the closest to me. Then determine the next closest point and so on.
I basically want to build an optimal path that connects all the points (optimal being shortest distance)
Thanks

It's Travelling salesman problem problem. The time complexity of this problem is really huge, that's why, I think, Google limited number of waypoints to 23. You can check this article to get know how to solve this problem. There are several examples written in most popular languages.
Also, I had solved this problem before, I used Ant colony optimization for that. This algorithm gives you the ability to build path through ~100 waypoints for an acceptable time, but it can fail sometimes, e.g. you didn't build path at all

Related

How to do routing "walking path" inside specific premises?

I'm trying to achieve routing "walking path" inside specific premises (Hospital). I'm using osmdroid and osmdroid bonus pack. I have spend losts of time. Still not success. Does anyone achieved like this.
By now i tried
roadManager.addRequestOption("routeType=pedestrian");
and all other available rooting types available here
and it gives result only where roads available.
Can someone suggest the right way to do this?
Thanks in advance.
I'm trying something as below.
This is a tough one for a few reasons.
Osmdroid has issues as zoom levels > 20. In fact, 20 should be your max. Finding a map source for zoom 20 is also difficult, however the mapsforge adapter should help with that. You'll need a high zoom level in order for this to be useful to the user.
OSM data is generally a series of nodes and paths that connect the nodes called ways. The vast majority of these nodes and ways are for roadways. These nodes and ways are the only thing we have for calculating walking or driving directions. You should be able to get directions to the closest address.
If you have osm data for inside the building, that's great, but now you have a GPS/location issue. GPS generally doesn't penetrate indoors.
So no real answers here, but hopefully this will help you identify some of the challenges ahead.

Camera/Compass/GPS

I was wondering if anyone could explain or clear me out -- I am currently doing some project to identify trees using android. I suppose the main components I must use at this project is GPS, Camera API and Compass (Please let me know if anyone can think anything) -- I am still in a middle of researching about the project and the possible problems that might arise during implement the project for example if there are two trees are in the same line of sight or same line (overlapping), what information is going to be displayed? How I can tell my software that I am actually want to display the front tree not the back of the tree? What sort of information or API will determine this? I mean does the camera or compass or GPS or even the database of the location of tree will determine it?
Can anyone please give me some idea, how I can tackle this kind of problem? Or perhaps if anyone know any tutorials that I can learn etc?
Much appreciated.
theBorneo
There is no existing api that would let you determine this specifically. I can image that you could estimate object identifications based on gps location. If you had waypoints in front, you could use the compass to get a direction and then approximate the gps region in front of you. Then try to see if you know of any prior waypoints that are in that area. Obviously, the one you see in direct line sight is the closest, and this would probably be the heuristic.
The camera will have almost no use in this case other than a view finder. If you are looking to segment images in order to differentiate between different objects, consider this impossible with google api, or any mobile application. This is difficult enough to do for professional researchers who can isolate variables..
The gps approximations are pretty trivial, however I am not confident as to how accurate or often a compass returns direction.

How do I find the point on a google map that's closest to me?

I am writing an Android-application that is supposed to download a bunch of addresses from my SQL-server, reverse geocode them, compare them all to my current location and return the one that is closest to me, not geometrically, but the one that I am the shortest driving distance from.
I have managed to get the reversed geocoding to work, but when I run my program a few times, I hit the OVER_QUERY_LIMIT on google. Needless to say, there are quite a few addresses in my database.
I understand that I could do this the quick and dirty way and just see which address is nearest to me by comparing the latitude and longitude of my current position and that of my addresses as opposed to comparing it to the actual driving distance. The problem with this is that this application will be used in a region where there are quite a lot of lakes to drive around and using that method will likely return quite a few stupid results.
How can I keep this from happening over and over? Can I present google with a view of all my addresses and just do a comparison once? I really need help with this one.
Actually, you will have to query a routing service (not necessarily Google Maps, to my knowledge also Cloudmade provides you with routing; there definitely are more) to get driving directions to each of the Points Of Interest around you and then select the closest one. This is a very bad practice, as you are very limited with the request amount.
According to the Google Maps API TOS (paragraph 10.1.3) you are not always allowed to do that.
What I did in a similar case was to store the coordinates for all POI, and look up the closest ones just by range of lat/lng.

KML scalability? Use KML to show and filter 1600+ points in Android?

Will you guys tell me whether or not this solution will work before I spend a lot of time learning/researching KML? (It looks like I need to learn it at some point, but I have a deadline to meet, first.)
Background - I need to plot 1662 points on a map that fall into 7 categories. I would like to show all, as well as filter/show only categories that the user chooses.
My first attempt at this used the Google Maps API. I created GeoPoints, added them to an ItemizedOverlay, and then added the ItemizedOverlay to the map. That works great for a few points. 100 points only took 3 seconds. By the time I got up to 400 points, things really started to slow down (like 30 seconds or so). I loaded all 1662, and it took 15 minutes!
1) Why does this take so long? Does the API make a call to Google Maps for each point?
2) I found KML as a possible alternative. How well does KML scale? Will it be able to plot and load 1600+ points? If not, can you recommend another solution?
3) How do you recommend I go about filtering my categories? Currently, I plan on loading each category to a layer. I found references to hiding/showing layers, so I'm going to try to do that. Is this a good approach?
4) How can I add buttons? Can/should I add them to an overlay? If not, is it possible to have the map open in a MapView and then control the filter/show with Android Buttons?
I'm sorry if my questions sound basic. I will continue researching and learning on my own. However, I want to know whether or not my solution will work at all before I waste another week going down another dead end.
Thanks in advance! :)
I don't know anything about Android, but I am working on a project where I generate KML output from a Java application. I'm not sure what kind of constraints you have when working with Android Java, but if you can you should try the following open source library:
JAK - Java API for KML
It will make the KML creation fairly easy. I can't answer your question about scalability on Android since I have no experience with it.

Google Map Get Direction Search Algorithm

I learned that Google Map has a Get Direction feature that let users find the shortest path from one point to another. What search algorithm did Google used for this search? Is this algorithm can be implemented in the Android platform, knowing that it has low memory and it's running in Java(tend to be slow)? Thanks in advance!
It is very likely that they use either A* (A-star) or dijkstra's algorithm.
Comparing the two, A* uses less memory and thus is more likely that they use a hybrid of that.

Categories

Resources