Wednesday, June 25, 2008

Yandex plugin for Maemo mapper

After patching maemo-mapper application to support Yandex maps Max Lapan, their employee suggested his script that worked as CGI script and converted mmapper's links to yandex's ones. That was really awesome idea as there is no need to update application and contacting its developer all the time, we can just run script on 127.0.0.1 and pass parameters like city ID and x/y/z to it. Note, that Yandex is not that simple as other map vendors - there is no world map with all cities on it. Each city has its own ID and its own set of dimensions - Xs,Ys of upper left and bottom right corners of each rectangle. So I think we(interested people from Russia and Ukraine) will have to create list of supported cities with verified set of dimensions and IDs. So each city will have it's own repository in maemo mapper(see screenshot below).

I'm open to discussions about this implementation as GPS and other features are unlikely to work seamlessly and road traffic service is currenly unsupported. It's not possible to add it without patching maemo-mapper itself. But for me and probably for other people map is the most important feature.

How to setup a new repository:
URL for the map is "http://127.0.0.1:8000/?map=NUMBER&layer=1&x=%d&y=%d&z=%d"
where NUMBER is a special code for each city(Kiev=1600, Moscow=2000, St.Petersburg=500, and so on)
Download Zoom Steps: 1
View Zoom steps: 1
Downloadable zooms: min: 6, max: 14

So then we may download map for offline use as usual. I use 11,9,7 zoom levels + 6 for city center. It's about 50mb on a flash. It's better to move data file from "/home/user/MyDocs/.documents/Maps" to somewhere at /media/mmc* and create a symlink instead.

Python script can be downloaded following this link. To run simply put it somewhere in home dir and:

$ python yandexmap.py

Roadmap for the script:

  1. Configuration file with a set of cities, dimensions, etc...
  2. deb package in extras repository
  3. install file on http://maemo.org/downloads unless I receive too many complaints about how stupid my script is.
  4. Easy way of running script - probably it will be launched by maemo-mapper's .desktop shortcut and killed when mmapper exits.
Screenshots(clickable):






8 comments:

  1. Does this require installing and running a web server on your tablet?

    ReplyDelete
  2. Nope, the scrip itself runs as a daemon and serves as a proxy server that converts coordinates

    ReplyDelete
  3. Another use for this may be to get some hiking trail maps or USGS data into Maemo Mapper. (I'll certainly have to play with it before my trip to Russia this summer, as well.)

    ReplyDelete
  4. A suggestion:
    Instead of making user create separate repository entries for different cities, you can keep a table of city IDs with lat/lon for each city center. When your script is given a lat/lon, you can find the closest city lat/lon in that table and use corresponding city ID.

    ReplyDelete
  5. 2nygren: I think we just need data files and similar script can reconvert you data into maemo-mapper links. I have old military maps for all the Ukraine :)

    2fms: This is really great idea actually! Need to check Max Lapan's code again for coordinates. I still don't understand how maemo-mapper works with its coordinates inside.

    ReplyDelete
  6. hi. i live in Moscow . but my Yandex maps are failed to download no matter what im doing - whats can be the problem - do I have to run the script or I cam just add the lines myself in maemo -mapper ?

    ReplyDelete
  7. Yes, the script now is at beta stage. There are some constant
    variables bound to Kiev:

    KIEV_MIN_X=1254600000
    KIEV_MIN_Y=725000000

    maemo-mapper settings - map=1600 - for Moscow it's 2000

    You should play with x/y and zoom out at maximum. This should be done
    for every city for now as I cannot decrypt yandex's algo yet :(

    ReplyDelete