Route planning
Route planning
10/10/2014
The idea 
Every summer I try to go to some autotravel Europe. I like to ride on small towns, overnight camping and not spend money on hotels. Naturally, the anticipation and planning of each trip begins in a few months - climbing on the map and wikipedia note of interest, and then plan how to prosper through it all to pass. I make a table broken down by day, the main distances and timing. Until recently, you had to use the service myplaces.google.com, but the old version disappoint its glitches (disappearing chunks routes), and the new - a shame reduced. And even in the pro-version of my journey in the 20 + volume crossings does not fit. At the same time, there is a great google maps api with inexact search by name, auto-completion, and routing. So I took the available components, added layers, editing, export, and got his service for travel planning - http://ukroutemap.com/
 
what we have 
To develop spent about 20 hours, and obtained a prototype that is fine with me. There is no 100 kinds of icons, like Google's, cycle routes and polygons. But there are export created maps in ordinary json-object and an unlimited number of layers and objects. Code - clean frontend (optional php + small to save routes on the server) to start work, simply copy the files and open index.html locally. Your domain / server hosting is not needed, only access to the api Google. Kasheftin.github.io/RoutePlanner/ - are working on hosting a demo github pages (everything works except the save / load routes to the server). 
 
technical issues 
Development using any api means that you need to write a layer between them and the rest of the code. Was used by knockout, respectively, most of my code - the connection observable-knockout mechanism to objects and events google maps. 
 
The biggest problems delivered window google.maps.InfoWindow, which does not work with dynamic content. There are two options for dealing with infoWindow - by specifying the dom node as a content and through the html-string. In the first case - once associate model with html, and then set the desired node as content infoWindow (see. Example). Second - as a content set html-string, and each time after opening the window to update the Binding model (see. Example). The first option is mercilessly handles node, and easily remove it when you open several different windows. Second incorrectly calculates the height of the content, as the data in the markup inserted after. Both versions are buggy when changing the size of the content, because it can not resize infoWindow. 
 
With infoWindow connected with another, successfully solved the problem. On the map google maps is the so-called point of POI (points of interest) - various businesses and other places of interest, when you click on that a window pops up with available information (description, phone numbers, photos, street view, etc.). In this case, there is no api methods for working with POI - ie You can either enable or disable, but can neither manage their discovery, or to change the design or pull data. But it's javascript!
Plans for the future 
In this design there is a standard way of development - add users, comments, ratings, and get the kind of social service in which people discuss their routes. However, I strongly do not know how from the project to make a profit. Do the paid version and limit the ability - to get the same google maps engine. Cut a piece of online ad space - very inefficient. If the service will use - immediately end limit free requests to google api. Therefore, instead of a single system, I decided to make a portable code that anyone could write off and run locally even though on its server. Routes between servers can transfer json-arrays. 
 
As for the further development of the system - this is my first attempt to donate. If there is at least one any donation, I promise to spend another 10 hours: 
completely rewrite the code to insert normal infoWindow instead built; 
insert draggable directions and hiking trails; 
add Risovalka polylines and polygons; 
add different icons markers; 
allow to add pictures to describe markers to pull photos from poi and street view; 
do export to excel with distances and travel time.