Skip to content

Creating map images

Ondřej Žára edited this page Jan 30, 2014 · 5 revisions

My Mind allows exporting to an image. This is a complicated process which requires a server-side backend to work properly. This page explains how saving to an image works.

Main workflow

From the client's point of view, the image is created in the following steps:

  1. The map data is serialized and POSTed to a remote URL
  • This URL is configurable via MM.Backend.Image.url
  • The request needs to be a HTTP POST, it is not sufficient to send a permalink. The map might not be accessible via permalink (authorization) or might not be saved at all.
  1. The remote backend processes the request. It can be handled in many ways; My Mind currently ships with a PHP implementation (more possibly to come).
  2. The remote backend creates an image. While there is no single way to do this, My Mind contains a PhantomJS script that does this.
  3. The resulting image is sent back to the browser with a Content-disposition: attachment header.
  • AJAX requests do not prompt for download, even with the mentioned header. This is why the request is made using an invisible <form> element.
Clone this wiki locally