Having caught fire after a recent
article, I decided to realize my dream, having done the same for my most ordinary phone.
You can download it here.Immediately throw a
link to GitHub with a description of the project and features , and some details under the cat
In fact, all the details are described on the page on the link above. So I will share the fact that there is not specified. The article does not describe the process of creating an application step-by-step, rather just notes.
First of all, many thanks to
passerby ,
kwikpik ,
shuler habrausers for very important information in the comments to the
articleIn brief, I will tell you the essence:
- request a static picture from Google maps
- request a picture from the site of public transport
- impose one on another
- ???
- PROFIT !!!
')
What problems arose:
The biggest challenge is the definition of BBOX.
First of all, you need to get the coordinates of the visible rectangle. I honestly was too lazy to look for the exact method of calculation, so I went to the forehead and derived the coefficient of "degrees of latitude / longitude by 100 pixels."
The next snag was the transformation of coordinates from WGS84 Datum to Spherical Mercator EPSG: 900913.
The desired code was found
here . But to
these comrades, thanks for the wonderful implementation of Math in j2me.
Geocoding
Manually entering coordinates is terrible, you need a Google geocoder.
To tame him, I needed
URLEncoder
from hereand JSON parser
from hereNext, we turn to the
geocoder (specifying SPb as the area) and enjoy life.
What problems are not solved yet
- Incomplete support for the Russian language. Namely, in the issue of Google may appear kryakozyabry, for the same reason, the menu in English. I know that the problem is solved, but for some reason I am too lazy to do it.
- It would be nice to support phones with GPS. I have never worked with this, there is no corresponding device at hand, so only if there can ever be ...
- I would also like to add a list of routes arriving at the nearest stop, but here I am faced with the same problems as the authors of similar applications.
- There is no adequate error handling and there are definitely a lot of bugs inside.
I am happy to share the project, the code, may all be happy. Especially today such sunny weather :)
UPD: user story
After writing the article, I arranged the test by fight. After walking with my beloved I looked at the situation on the map, did not see anything in passing, went to the house on foot. On the move, I updated the map, noticed the bus (traveling from the other side, but to the house), added step and successfully saved myself 10 minutes.
And already on the bus I wanted to check it again, I saw a trolley bus and decided to transfer and put money on the phone not at the nearest stall along the way, but in the center of cellular communication without a fee. So I saved 10 more rubles.
Observations:
the delay is surprising - offhand the difference was 10-20 seconds
the update must still be done using the fixed button “5”, and not by any one - the screen goes blank and when you pull the joystick to activate the backlight, an unwanted update is made.
ps How I love java for the fact that such a thing can be done in less than a day.UPD:
Google+ page with current development status and updates