blog.notmyidea.org/thoughts-about-a-form-generation-service-gis-enabled.html

214 lines
No EOL
12 KiB
HTML

<!DOCTYPE html>
<html lang="fr">
<head>
<title>
Thoughts about a form generation service, <span class="caps">GIS</span>&nbsp;enabled - Alexis Métaireau </title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet"
href="https://blog.notmyidea.org/theme/css/main.css?v2"
type="text/css" />
<link href="https://blog.notmyidea.org/feeds/all.atom.xml"
type="application/atom+xml"
rel="alternate"
title="Alexis Métaireau ATOM Feed" />
</head>
<body>
<div id="content">
<section id="links">
<ul>
<li>
<a class="main" href="/">Alexis Métaireau</a>
</li>
<li>
<a class=""
href="https://blog.notmyidea.org/journal/index.html">Journal</a>
</li>
<li>
<a class="selected"
href="https://blog.notmyidea.org/code/">Code, etc.</a>
</li>
<li>
<a class=""
href="https://blog.notmyidea.org/weeknotes/">Notes hebdo</a>
</li>
<li>
<a class=""
href="https://blog.notmyidea.org/lectures/">Lectures</a>
</li>
<li>
<a class=""
href="https://blog.notmyidea.org/projets.html">Projets</a>
</li>
</ul>
</section>
<header>
<h1 class="post-title">Thoughts about a form generation service, <span class="caps">GIS</span>&nbsp;enabled</h1>
<time datetime="2012-04-02T00:00:00+02:00">02 avril 2012</time>
</header>
<article>
<p><em>Written by Alexis Métaireau <span class="amp">&amp;</span> Mathieu&nbsp;Leplatre</em></p>
<p>We have a plan. A &#8220;fucking good&#8221;&nbsp;one.</p>
<p>A bunch of friends asked me twice for quite the same thing: a webpage
with a form, tied to a map generation with some information filtering.
They didn&#8217;t explicitly ask that but that&#8217;s the gist of&nbsp;it.</p>
<p>This idea has been stuck in my head since then and I even think that we
can come out with something a little bit more flexible and useful. I&#8217;ve
named it <em>carto-forms</em> for now, but that&#8217;s only the&nbsp;&#8220;codename&#8221;.</p>
<p>To put it shortly: what if we had a way to build forms, ala Google
forms, but with geographic information in&nbsp;them?</p>
<p>If you don&#8217;t know Google forms, it means having an user-friendly way to
build forms and to use them to gather information from different&nbsp;users.</p>
<p>In my opinion, Google forms is missing two important things: first, it&#8217;s
not open-source, so it&#8217;s not possible to hack it or even to run it on
your own server. Second, it doesn&#8217;t really know how to deal with
geographic data, and there is no way to filter the information more than
in a&nbsp;spreadsheet.</p>
<p>I knew that <a href="http://blog.mathieu-leplatre.info/">Mathieu</a> and some folks
at <a href="http://makina-corpus.com">Makina Corpus</a> would be interested in
this, so I started a discussion with him on <span class="caps">IRC</span> and we refined the
details of the project and its&nbsp;objectives.</p>
<p>Imagine the&nbsp;following:</p>
<ol>
<li>For a mapping party, we choose a specific topic to map and design
the form (list of fields (i.e. tags) to be filled + description +
type of the information)&nbsp;;</li>
<li>In situ, users fill the form fields with what they see. Geo fields
can be pre-populated using device geolocation&nbsp;;</li>
<li>At the end of the day, we can see a map with all user contributions
seized through this particular form&nbsp;;</li>
<li>If relevant, a script could eventually import the resulting dataset
and publish/merge with&nbsp;OpenStreetMap.</li>
</ol>
<h2 id="some-use-cases">Some use&nbsp;cases</h2>
<p>I can see some use cases for this. The first one is a collaborative map,
with facet filtering. Let&#8217;s draw a potential user&nbsp;flow:</p>
<ul>
<li>
<p>An &#8220;administrator&#8221; goes to the website and creates a form to list
all the alternative-related events. He creates the following&nbsp;fields:</p>
<ul>
<li>Name: a plain text field containing the name of the&nbsp;event.</li>
<li>Category: the category of the event. Can be a finite&nbsp;list.</li>
<li>Location: The location of the event. It could be provided by
selecting a point on a map or by typing an&nbsp;address.</li>
<li>Date: the date of the event (a datepicker could do the&nbsp;trick)</li>
</ul>
<p>Each field in the form has semantic information associated with it
(yes/no, multiple selection, date-time, geocoding carto, carto
selection&nbsp;etc)</p>
</li>
<li>
<p>Once finished, the form is generated and the user gets an url (say
<a href="http://forms.notmyidea.org/alternatives">http://forms.notmyidea.org/alternatives</a>) for&nbsp;it.</p>
</li>
<li>
<p><span class="caps">REST</span> APIs allow third parties to get the form description and to
push/edit/get information from&nbsp;there.</p>
</li>
<li>
<p>He can communicate the address in any way he wants to his community
so they can go to the page and add information to&nbsp;it.</p>
</li>
<li>
<p>Then, it is possible to filter the results per location / date or
category. This can be done via <span class="caps">API</span> calls (useful for third parties)
or via a nice interface in the&nbsp;browser.</p>
</li>
</ul>
<p>So, as you may have noticed, this would allow us to create interactive
maps really easily. It&#8217;s almost just a matter of some clicks to the
users. If we also come up with a nice Web <span class="caps">API</span> for this, we could do
server-side validation and build even phone applications&nbsp;easily.</p>
<p>To push the cursor a bit further, if we can come with a cool description
format for the forms, we could even build the forms dynamically on
different platforms, with generic&nbsp;clients.</p>
<p>As mentioned before, the idea of a simple tool to support collaborative
mapping fullfils a recurring necessity&nbsp;!</p>
<p>We envision a lot of example uses for this : recycling spots, accessible
spots (wheelchairs, etc.), trees identification, mushrooms picking
areas, tracking of endangered species (e.g. Bonelli&#8217;s Eagle is currently
tracked by sharing a spreadsheet), spotting of dangerous species (e.g.
asian predatory wasps), map advertisement boards (most cities do not
track them!), citizen reporting (e.g. graffiti, potholes, garbage,
lightning like <a href="http://fixmystreet.ca">http://fixmystreet.ca</a>), geocaching, trajectories (e.g
hiking, runners,&nbsp;cyclists)&#8230;</p>
<p>Here are some other examples of where <em>carto-forms</em> could be&nbsp;useful:</p>
<h3 id="simple-gis-storage-backend">Simple <span class="caps">GIS</span> storage&nbsp;backend</h3>
<p>Let&#8217;s say you are a mobile developer, you don&#8217;t want to bother with
PostGIS nor write a custom and insecure code to insert and retrieve your
<span class="caps">GIS</span> data! You need carto-forms! A simple <span class="caps">API</span> helps you design your
models/forms and the same <span class="caps">API</span> allows you to <span class="caps">CRUD</span> and query your data.
Thus, you only need to focus on your application, not on how <span class="caps">GIS</span> data
will be&nbsp;handled.</p>
<p>We make a distinction between storage and&nbsp;widgets.</p>
<p>Besides, if you are a django / drupal / plomino&#8230; maintainer : you can
develop a module to &#8220;plug&#8221; your models (content types) and <span class="caps">UI</span> to
carto-forms! Carto forms are then exposed to your backoffice users (ex:
drupal admin <span class="caps">UI</span>, django adminsite), and likewise you can write your own
<span class="caps">HTML</span> widgets that consume datasets in frontend views (facets in
<span class="caps">JSON</span>/<span class="caps">XML</span>, and map data in&nbsp;GeoJSON).</p>
<h3 id="visualization-tool">Visualization&nbsp;tool</h3>
<p>Since data submission can be done programmatically using the <span class="caps">API</span>, you
could use Carto-forms results page as a visualization&nbsp;tool.</p>
<p>You can explore your dataset content using filters related to each form
field. Facets filtering is a great advantage, and a map shows the
resulting features set. You feel like you&#8217;re in front of a decision
support&nbsp;system!</p>
<p>Of course, filtered raw data can be downloaded (GeoJSON, <span class="caps">XML</span>) and a
permalink allows to share the page with the state of the filters and the
zoom/location of the&nbsp;map.</p>
<h3 id="generic-forms-service">Generic forms&nbsp;service</h3>
<p>If you want to generate a configuration file (or whatever, email
messages, &#8230;), you will need a form and a template to inlay user
submitted values and get the&nbsp;result.</p>
<p>A form service would be really useful to create forms programmatically
and retrieve cleaned and validated input&nbsp;values.</p>
<p>You could run a dedicated template service based on <em>carto-forms</em>!
Parsing a template content, this external service could create a form
dynamically and bind them together. The output of the form service
(fields =&gt; values) would be bound to the input of a template engine
(variables =&gt; final&nbsp;result).</p>
<p>Note that for this use-case, there is no specific need of <span class="caps">GIS</span> data nor
storage of records for further&nbsp;retrieval.</p>
<h2 id="whats-out-in-the-wild-already">What&#8217;s out in the wild&nbsp;already?</h2>
<p>Of course, there is Google forms, which allows you to do these kind of
things, but it&#8217;s closed and not exactly what we are describing&nbsp;here.</p>
<p>We&#8217;ve discovered the interesting <a href="https://webform.com/">https://webform.com/</a> which allows one
to create forms with a nice drag-n-drop flow. I would love to reproduce
something similar for the user experience. However, the project doesn&#8217;t
handle APIs and geolocation&nbsp;information.</p>
<p>The idea of <a href="http://thoth.io">http://thoth.io</a> is very attractive : an extremely simple
web <span class="caps">API</span> to store and retrieve data. In addition, <em>carto-forms</em> would do
datatype validation and have basic <span class="caps">GIS</span> fields (point, line,&nbsp;polygon).</p>
<p><a href="http://mapbox.com">http://mapbox.com</a> also did an awesome work on cartography, but didn&#8217;t
take into account the form aspect we&#8217;re leveraging&nbsp;here.</p>
<h2 id="so-lets-get-it-real">So… Let&#8217;s get it&nbsp;real!</h2>
<p>As you may have understood, this isn&#8217;t a really complicated problem. We
have been sometimes chatting about that with Mathieu about what we would
need and how we could achieve&nbsp;this.</p>
<p>We can probably come with an elegant solution without too much pain.
Mathieu is used to work with <span class="caps">GIS</span> systems (which is really cool because
I&#8217;m not at all) and knows his subject, so that&#8217;s an opportunity to learn&nbsp;;-)</p>
<p>We will be at <a href="http://rencontres.django-fr.org">Djangocong</a> on April 14
and 15 and will probably have a brainstorming session and a sprint on
this, so if you are around and want to help us, or just to discuss, feel
free to&nbsp;join!</p>
<p>We don&#8217;t know yet if we will be using django for this or something else.
We have been thinking about couchdb, couchapps and geocouch but nothing
is written in stone yet. Comments and proposals are&nbsp;welcome!</p>
<p>Here is the etherpad document we worked on so far:
<a href="http://framapad.org/carto-forms">http://framapad.org/carto-forms</a>. Don&#8217;t hesitate to add your thoughts
and edit it, that&#8217;s what it&#8217;s made&nbsp;for!</p>
<p>Thanks to <a href="http://sneakernet.fr/">Arnaud</a> and
<a href="http://qwerty.fuzz.me.uk/">Fuzzmz</a> for proof-reading and typo&nbsp;fixing.</p>
</article>
<footer>
<a id="feed" href="/feeds/all.atom.xml">
<img alt="RSS Logo" src="/theme/rss.svg" />
</a>
</footer>
</div>
</body>
</html>