Google Summer of Code/2010/AcceptedProjects/EasyPrintableMaps

From OpenStreetMap Wiki
Jump to: navigation, search

Project Overview

Title

Easy Printable Maps:OpenPaperMaps

People

  • Student: Waldemar Quevedo
  • Mentor: Andrew Ayre

Objectives

Many of the ideas for this project were inspired by Nicholas Marichal's OpenPaperMaps idea:http://wiki.openstreetmap.org/wiki/User_talk:Nicolasmarichal

The project will consist of a Django web application, since Mapnik has bindings from Python. This application will integrate some features from other projects related to this idea. This project's main objective will be towards creating a flexible enough platform for printing customizable maps.

The project will have two major aspects. The first one will be to create a Django application that will integrate some of the features that have been experimented with Townguide learning from the design decisions that the MapOSMatic team have already taken (wrapper around Mapnik features, rendering daemon etc...).

The second aspect is to use the new Mapnik resolution features that will increase the quality of the paper output. Some of this might involve actual work on Mapnik, so some guidance from the Mapnik project will be needed. Fortunately, Mapnik was accepted as participant for GSoC this year, and one of the ideas tackles specially the issue of resolution for the maps. I would consider this to be part of the Extended Goals. See: http://trac.mapnik.org/wiki/GSOC2010/Ideas#BetterPrintSupport

Some of ideas for the Base Project are:

  • POI display selection as in Nicholas Marichal idea.
  • Work on overlapping icons: One current problem of Townguide is that when there are several POIs on the same area, it becomes difficult to discern what is there. This have to be addressed in order to make the map easy to use.(e.g. if there are 3 restaurants on the same place, show a number 3, or an index that indicates which places exists there)
  • Basic Theme Colour selection: Define several styles like Cloudmade does which could be selected in order to localize the map.
  • Module for uploading styles: I think that it would be fun to provide an interface for uploading user contributed styles to generate the maps. This styles could be regular styles or use Cascadenik styles. See: http://trac.mapnik.org/wiki/StyleShare
  • Provide different output formats: PDF of various sizes and resolution. Townguide also has some code regarding this, so I will be basing on that piece of work.

Extended Goals:

  • Exposing this new functionality from Mapnik through the same web interface. This would involve: Tweaking

the code to make it mapnik2 compliant in order to use the new features from this codebase. Work on adding resolution options to improve the quality of the maps.

  • Collaborate with the Mapnik project expose other Mapnik rendering options, that would make post processing more convenient. This is also featured on Nicholas Marichal main idea for OpenPaperMaps
  • Turning certain Layers on/off: Mapnik has support for turning layers off/on, and this is currently not being done by the main Export function from OpenStreetMap. An option like this would be good for post processing, which needs vector output.

Wiki Page

The main wiki page for the project is OpenPaperMaps. This will contain documentation for the completed project.

Outline Programme

  • Community Bonding Period

Work on the functional and design specifications for the project.

  • Week #1: May 23th - 29th (May 24th Start)

Should finish a major version of both the functional and design specification this week.

First work will be directed towards improving the townguide.py renderer from Graham Jones and to create a distributable package with tests for its features.

  • Week #2: May 30th - June 5th

This will I will work on integrating the MapOSMatic frontend and add create a version of it that has the townguide renderer installed in order to render the jobs. Using the MapOSMatic frontend means that I will not have to rethink the logic around rendering daemon and also can take advantage of using the reusable templates.

  • Week #3: June 6th - 12th

I will continue working on the web interface of townguide to display the needed features. This week there will be some javascript coding to do with jQuery UI with OpenLayers for the user interface.

By this week there should be a working prototype of the Django web application for townguide.

  • Week #4: June 13th - 19th

I expect to begin working on the styles features for the project around this time by making available different styles available from the user interface.

I'll work on the module for uploading the Mapnik XML styles as well. (mapnik styleshare)

  • Week #5: June 20th - 26th

Work on different more kinds of layouts playing around with reportlab and Cairo adding them as a plugin to the townguide renderer.

I will be modifiying the townguide.py renderer to make it appear better markers instead of the little circles, and research into solving the problem of having them overlap when there are several in place.Also work out a way to make it easier to understand on the printed map which kind of POIs were there.

  • Week #6: June 27th - July 3rd

This week I plan to use it to keep on working on the style sharing features of the project. This will act as an independent module from the townguide web interface.

  • Week #7: July 4th - 10th

It has been more than a month of coding nonstop this week I'll be revising my code and work on any features that need more polish before the mid-term evaluation. (~40 hours)

  • Weeks #8: July 11th - 17th (Mid-term evaluation), Week #9: July 18th - 24th
    • Mid term evaluation deliverables
  - Distributable Townguide.py renderer 
  - Django port of the features from the original townguide application
    based on MapOSMatic and with jQuery controls
  - Styleshare application that works with regular osm.xml files and integrates
    with the townguide Django application to style the maps.

Since the base project should be very advanced by now, I'll ask for guidance from the Mapnik project to work on the issues regarding Better Print Support from Mapnik. In case the project has already been taken care of by another fellow GSoC member, this week I'll revise the code to integrate these features. These features will most likely be taken care of in the new Mapnik2 codebase, so this will involve updating the code so that it will is Mapnik2 compliant, (although I may decide to use Mapnik2 from the beginning). If everything has been going ok, I will begin work on the Extended Goals for the project.

One of this goals would be to add the option for turning layers off/on through transformations to the compiled osm.xml style.


  • Week #10: July 25th - 31th, Week #11: August 1st - 7th

I planned to use these weeks as buffer time to revise the code and work on the Extended Goals from the project. I will work on the documentation, deploy the application on a server, write missing tests, etc...

Current Outstanding Issues

Weekly Reports

Week 1

Progress Update for Week Ending: 2010-05-02

Achievements this week:

  - Wiki page on OSM wiki for Easy Printable Maps Gsoc idea 
  - Created draft of the wiki page of the project under OpenPaperPaps 
  - Got access to the server that Graham Jones provided 
  - Worked a bit on Mapnik tutorials on a repository that I have on github 
  http://github.com/invertedplate/mapnik-osm-stuff 
  - Started blog for the project under http://blog.openpapermaps.com 
  - Started work on the functional specifications 

Project svn repository: http://code.google.com/p/townguide/source/browse/#svn/branches/GSoC10

Problems Encountered: -

Help Required: -

Progress Against Plan: -

Week 2

Name of Student: Waldemar Quevedo

Project Title: Easy Printable Maps

Progress Update for Week Ending: 2010-05-09

Achievements this week:

  - Finished the first draft of the functional specs. I got feedback from my mentor, and I will be working on revising it this week.

Problems Encountered: - Help Required: - Progress Against Plan: -

Week 3

Achievements this week:

  - Got more familiar with Cascadenik stylesheets from Mapnik-utils and reportlabs, libraries that I will be using for this project.
  - Researched more the MapOSMatic codebase to learn from the approach of that project. There is also some interest from the MapOSMatic team to integrate some of the features of this GSoC project. 

Problems Encountered:

Help Required:

Progress Against Plan: I had planned to work more on the specs during this week but it got busier than I thought with final exams and final projects. Good news is that I'm officially done with university since Friday :)


Week 4

Name of Student: Waldemar Quevedo

Project Title: Easy Printable Maps

Progress Update for Week Ending: 2010-05-23


Achievements this week:

- Completed the next revision of the functional specs for the project: http://github.com/invertedplate/mapnik-osm-stuff/raw/master/specs/functional_specs.pdf
- Researched more on the problem of turning layers on and off from the Mapnik XML styles.

Week 01 (GSoC Starts)

Name of Student: Waldemar Quevedo

Project Title: Easy Printable Maps

Progress Update for Week Ending: 2010-05-23

  • Achievements this week:
    • Finished writing the design specification for the project.
    • Got again feedback from the specs
    • Started work on creating a townguide.py module which can be installed
    • Added tasks to be done for the project on Redmine
  http://redmine.openpapermaps.com


  • Problems Encountered:
  • Help Required:
  • Progress Against Plan:
    • I spent more time on the design specification than I intended, though the time spent should pay off at later point

Week 02

Name of Student: Waldemar Quevedo

Name of Project: Easy Printable Maps

Progress Update for Week Ending 2010-06-06

  • Achievements this week:
    • Townguide.py is an installable module
    • Started using unit tests for the townguide.py module.
    • Learned more about the Django approach to create pluggable applications
    • Started working on the 'djtownguide' django pluggable application, which will use the townguide.py renderer.
    • Research about how to increase the quality of the output of the townguide.py module.
  • Problems Encountered:
    • Mapnik output has much better quality when the Cairo renderer is used to create a PDF or SVG, though the current townguide.py relies on a png image to draw upon the surface the adornments to the map,which gives less quality for the output.

One quick solution is to render the job first to a PDF with Cairo and then convert it into png with the help of another library. The main cons from this is that it adds another dependency to the project plus it would make it run slower.

  • Help Required:
    • I might have to research for other solutions for adorning the map
    • Carlos from the mapnik 'Better Print Support' GSoC project has been testing some ideas regarding the use of a scale factor which might alleviate some of these problems. I'll team up with him again this week to discuss what would be an API that townguide could use.
  • Progress Against Plan

Week 03

Name of student: Waldemar Quevedo

Project: Easy Printable Maps

  • Achievements this week:
    • Worked on the Django application that wraps the townguide renderer
    • Figured out the approach for getting the rendering daemon working
    • Worked on the UI design of the application.

Week 04

Name of student: Waldemar Quevedo

Project: Easy Printable Maps

  • Achievements this week:
    • Integrated a daemon to the application. for rendering the jobs on the queue
    • Finished the django port of the original townguide (djtownguide)
    • Worked on the prototype version of the app for sharing mapnik styles. Modified OSM.xml files can be uploaded by users to be shared. Thumbnail images are rendered using recycled maps from djtownguide for now.
  • Problems encountered:
  • Progress against plan:
    • Back on schedule
  • Help Required:
    • I'll be looking into deploying the Django project this week on the server


Week #5

Achievements this week:

  • Improved the user interface from OpenLayers
  • Started work on creating new layouts for the rendered maps with Reportlabs

Progress Against Plan:

I had some delays deploying the app on a server, I'll try to get it done as soon as possible.

Week #6

Progress update for week ending 2010-07-04

Achievements this week:

  • Configured the development server with the latest mapnik2 in order to make use of scale factors (experimental new feature in trunk)
  • Created a new layout in landscape mode with reportlabs
  • Fixed the problem of reportlab not displaying non-western characters [1]
  • Downloads from the XAPI (to add small extracts to the database) occur in a different thread

Help Required:

  • Non-western characters were not being rendered because reportlab does not include a unicode font

to handle this. I currently solved this by adding the unifont font that is bundled with mapnik, though I also tried osaka-unicode, and couldn't get the Droid fonts to work with reportlab. Any suggestion on a nice unicode font that look good in print and can handle CJK characters is very welcome.

[1] http://code.google.com/p/townguide/issues/detail?id=2

Week #7

Progress Update for Week Ending: 2010-07-11

Achievements this week:

  • Added a new layout for rendering the information with the POIs.
  • Added search feature to the user interface. Now you can type for your city instead of having to manually search through the map.
  • Improved unicode fonts support for the layouts
  • The application now uses the new scale factor feature from mapnik2 to render the maps.

Week #8

Progress Update for Week Ending: 18/07/2010

Achievements this week:

  • Used agg drawing library to improve the style of the markers
  • Worked on a script for upgrading Mapnik1 styles to Mapnik2 http://dpaste.de/HV1q/
  • Fixed some features that were broken
  • Looking into Cascadenik for styles now.

Problems encountered:

  • Just could not find a way to get the doctype of an xml document, with all of its internal/external entities using the lxml library. It gets lost once the the xml is parsed.

Week #9

Achievements this week:

  • Put together the feature for uploading .mss and .mml to create Cascadenik styles
  • Modified the source of Cascadenik to stop it from resolving certain xml entities that

could make the style not being easy among other things.

  • Since Cascadenik outputs styles that are only Mapnik1 compliant I am using the script I did to upgrade the style to Mapnik2 on the fly.

Problems encountered:

  • I tried creating a my own Cascadenik mss template based on the original OSM.xml style though I was too strict on the filters used for the style rules and the Cascadenik style file ended up getting too complex with the CSS rules. Furthermore, as I increasingly added more rules, compiling the style to XML started taking too long. After studying the styles from Michal Migurski for styling the OSM map[0], I noticed this approach was not correct.

[0]: http://teczno.com/cascadenik-openstreetmap-II/

Week #10

Progress Update for Week Ending: 2010/08/01 Achievements this week:

  • Improved the UI for selecting styles
  • Got a version of the Cascadenik-XMLbad branch to style map objects with Mapnik2. This is very cool because now there is no need to be producing xml in order to render the map since this branch adds rules and styles programmatically from the CSS rules (hence the name of the branch).

Help Required:

  • The fixes I did to the branch currently work in my machine though I will ask the Mapnik community whether the approach I took was correct or not.

Week #11

Progress update for week ending: 2010-08-08

Achievements this week:

  • Improved the Generate map form's javascript to select the style
  • Added capability to re-customize an already generated map, but without changing the original bounding box.
  • Created an style editor[0] for mapnik stylesheets (a la wordpress, e.g. when you need to style the css of a site) that uses cascadenik-xmlbad to render previews, and the original cascadenik[1] to compile into xml.

Problems encountered:

  • Cascadenik-xmlbad needs further improvements for some style rules.