Skip to main content

Basic map setup for lizard web sites

Project description

lizard-map

Lizard-map provides basic map interaction for Django applications that use a lizard-ui user interface. We designed it at Nelen & Schuurmans for our geographical information websites (with water management information).

It provides:

  • Openlayers (map javascript libary) map display and server-side map generation (mapnik’s WMS functionality).

  • A “workspace” interaction model: drag mappable items into a workspace and they’ll get displayed. The workspace is stored in the Django database.

  • A “collage” attached to every workspace for storing selected info on map items (like graphs).

  • An extention mechanism to plug more or less arbitrary map sources into the workspace so that they can be displayed, searched, etc.

Core concept: workspaces

A workspace item is something that can be displayed on a map. A workspace is a collection of workspace items that is actually displayed.

Every session gets its own workspace. (There is a possiblity of adding extra workspaces, but that isn’t used yet in one of our sites, so it isn’t fully thought-out yet).

A workspace item needs to know how to display itself, how to search for items when you click on the map and more. To get that to work for arbitrary map sources, you need to configure an adapter. The adapter has a layer() method for returning a mapnik layer, a search() method for searching and so on.

  • You register an adapter as a so-called “setuptools entrypoint” under a specfic name.

  • When you add a workspace item, you pass in the adapter name and an optional snippet of json to configure the adapter.

The workspace item keeps track of this adapter and its configuragion and uses it to generate maps, for searching, etc.

Collages

A workspace item often results in multiple areas or points. If you click on such a point, you normally get a popup with extra information. If you want to compare a couple of those information “snippets”, you can place them in your workspace’s collage.

Clicking the collage gives a popup with all the collected information popups in that single popup.

Interaction

Included is quite some javascript for workspace interaction. Potential workspace items can be drag/dropped into a workspace to add them. Workspace items can be reordered. You can drag them to the trash.

Development installation

The first time, you’ll have to run the “bootstrap” script to set up setuptools and buildout:

$> python bootstrap.py

And then run buildout to set everything up:

$> bin/buildout

(On windows it is called bin\buildout.exe).

You’ll have to re-run buildout when you or someone else made a change in setup.py or buildout.cfg.

The current package is installed as a “development package”, so changes in .py files are automatically available (just like with python setup.py develop).

If you want to use trunk checkouts of other packages (instead of released versions), add them as an “svn external” in the local_checkouts/ directory and add them to the develop = list in buildout.cfg.

Tests can always be run with bin/test or bin\test.exe.

External dependencies

The dependencies for a full website that uses lizard-map are best expressed as ubuntu/debian package dependencies: build-essential, python2.6-dev, apache2, libjpeg-dev, python-imaging, python-matplotlib, python-mapnik, python-scipy, libapache2-mod-wsgi, python-gdal, spatialite-bin, python-pysqlite2, python-pyproj.

TODO

  • Add tests. We’re sorely lacking in that regard.

  • Add example app for stand-alone in-browser testing and trying-out.

  • Add possibility for multiple base layers.

  • Remove hardcoded Dutch-centric initial map extends.

  • More i18n/l10n.

  • Fix reloading when dragging an item to the trash.

Credits

Changelog of lizard-map

0.13 (2010-06-28)

  • Popup graph size fixes.

  • Updated documentation.

  • We’re now released on pypi!

0.12 (2010-06-23)

  • Fancier “nothing found” popup.

0.11 (2010-06-23)

  • UI interaction fixes.

  • Temp workspace popups don’t show add-to-collage.

  • Added empty-the-workspace button.

  • Fixed graph display: no more overlap.

  • Added global graph settings.

0.10 (2010-06-22)

  • Popup (upon map click) shows popup when nothing’s found.

  • More feedback (hourglass pointer and so).

0.9 (2010-06-18)

  • Fixed wms.html’s javascript code: long live jslint!

  • Not emptying the temp workspace anymore: it was happening too often. Now it isn’t happening often enough, though. Will be fixed later.

0.8 (2010-06-18)

  • Using lizard-ui’s new css/javascript blocks.

  • Copied charts from krw here.

0.7 (2010-06-16)

  • “Add to collage” is now hardcoded NL.

  • Collage popup is bigger and doesn’t contain “add to collage” links anymore.

0.6 (2010-06-15)

  • Added the date range popup widget from krw-waternet here. (Still session-based. It also doesn’t work with multiple workspaces yet.

  • Changed layer_method and other setuptools registered functions to an adapter class.

  • Added fully functioning collages/snippets support.

0.5 (2010-06-08)

  • Added early support for collages/snippets.

  • Switched the custom attributes over to “data-xxxxx” attributes (those are valid html5).

  • Added generic draggability of .workspace-acceptable items.

0.4 (2010-05-18)

  • Collected the rijksdriehoek and google mercator proj4 strings in one location (coordinates.py). Including handy conversion methods.

  • Added views for showing and managing workspaces.

  • Added workspaces and workspaceitems for showing map layers and de-coupling them with behind-the-scenes data.

  • Added generic WMS view.

  • Added shapefile layer rendering function.

  • Added generic layer rendering and layer searching hook-ups through so-called setuptools entrypoints.

  • Added template tags for rendering workspaces.

0.3 (2010-04-14)

  • Reordered templates a bit between lizard-ui and us.

0.2 (2010-03-29)

  • Really added analysis.html

0.1 (2010-03-29)

  • Moved analysis.html from krw-waternet to lizard-map

  • Initial library skeleton created by nensskel. Jack Ha

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lizard-map-0.13.tar.gz (1.2 MB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page