I am working to add rich annotation functionality to MapKnitter as part of Google Summer of Code (read about my project here: http://publiclab.org/notes/justinmanley/03-18-2014/mapknitter-annotations-using-fabric-js-gsoc-2014-proposal). This is my ninth week of coding.
The goal of this research note is to provide an update to the community on my progress with refactoring the MapKnitter interface.
If you're interested in reading about
Leaflet.Illustrate, the Leaflet plugin that I wrote over the past few weeks to power MapKnitter's annotations, you can check out my last research note.
You can check out our previous discussion of this interface refactorinng in my previous research note:
Screenshot with Vidun's upload modal!
So far, I have:
- Added commenting and tagging to MapKnitter maps
- Begun integrating @vidun's work on the upload interface
Under the hood, I've done a lot of work to make it easier for future developers to improve MapKnitter. I've:
- Set up Bundler to handle MapKnitter's' dependencies
- Set up Sprockets and bower for handling all of MapKnitter's static assets.
- Given MapKnitter a RESTful API using Rails' resourceful routes.
Commenting and Tagging
I borrowed a lot of the commenting and tagging functionality from the Public Lab website. That means that commenting and tagging works pretty much the same in MapKnitter as it does on Public Lab. Among other things, users can write comments and the descriptions of their maps in Markdown.
Sprockets & bower
MapKnitter's static assets were a mess before this.
Using Sprockets enables MapKnitter to handle static assets in a much more elegant and maintanable way. Because this method of asset pipelining is the default in Rails 3.1+, this will also make it much easier should Public Lab ever upgrade MapKnitter to a more modern version of Ruby or Rails.
I found these articles helpful for integrating MapKnitter with Sprockets:
- Giving Rails 2 the Asset Pipeline
- Sprockets 2 With Rails 2.3 (most of the code hooking Sprockets in MapKnitter is copied directly from here).
MapKnitter was previously not RESTful. Most significantly, resources were created, modified, and deleted using HTTP POST requests (as opposed to POST, PUT, and DELETE requests, respectively). Providing a RESTful API for MapKnitter will enable folks to use MapKnitter from the command line with
curl. More importantly, it makes the code clearer, more logical, and more maintainable. For example, the routes can now be declared as:
app.resources :maps do |maps|
Integrate Vidun's work on the MapKnitter upload interface. I've already merged Vidun's work into my MapKnitter branch, so now it's a matter of making sure everything works with the new routes, etc.
Merge Anish's LeafletImageDistort plugin.
Push MapKnitter site to beta server that @dogi set up for beta testing by MapKnitter community. (It will be ready for
beta-testing as soon as I merge Vidun and Anish's work).
Integrate the annotation features that I have developed in
Leaflet.Illustrate. This will mean adding methods to
Leaflet.Illustrateto serialize annotations to GeoJSON, adding routes, models, and controllers for annotations, and designing an annotation toolbar that will allow folks to change the colors and styles of polyline, polygon, and text annotations.
I am also interested in enable users to add Riffle data to the map as annotations, so I'd like to talk to @mathew and others to figure out how to best implement this.
Create a workflow for generating Public Lab research notes from MapKnitter maps. This means generating an HTML POST query from MapKnitter map data that will be submitted to the Public Lab website to create a research note.