📜 ⬆️ ⬇️

Spb Transport J2ME

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 article

In brief, I will tell you the essence:

  1. request a static picture from Google maps
  2. request a picture from the site of public transport
  3. impose one on another
  4. ???
  5. 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 here
and JSON parser from here
Next, we turn to the geocoder (specifying SPb as the area) and enjoy life.

What problems are not solved yet



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

Source: https://habr.com/ru/post/143367/


All Articles