9.2. MopyMaps! Mobile Yahoo! Maps
MopyMaps! is a mobile map explorer. It uses the Yahoo! Maps Web API to receive map images given a desired location. MopyMaps! supports vertical and horizontal panning of received map images, so you can explore your surroundings smoothly on the small screen of a mobile phone. MopyMaps! squeezes a full world atlas into a pocket – all in fewer than 100 lines of Python!
The Map Image API provided by Yahoo! Maps is extremely simple to use. You can give a partial address of a desired location in free-form text and the system infers the most suitable map image for you. You can specify the desired map size, zoom level and radius for the image. Full documentation for the Map Image API is available at http://developer.yahoo.com/maps.
Instead of the address, you can specify the longitude and latitude of the desired location. If you have a GPS receiver, you can combine MopyMaps! with the GPS reader program that was presented earlier to receive a map of your current surroundings automatically.
You need to get an Application ID from Yahoo! to use the service. Go to http://developer.yahoo.com and choose the link 'Get an Application ID'. Once you have filled in the developer registration form, you are given a long data string that is your Application ID. Save this string for future use.
The MopyMaps! source code is divided into three parts that should be combined into one file to form the full application. The parts cover the following functionalities:
constants ...
Get Mobile Python: Rapid Prototyping of Applications on the Mobile Platform now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.