leidenwarper / mapwarper

Map Warper for Leiden Archives
MIT License
2 stars 2 forks source link

Leiden Warper

This is a customised version of the mapwarper application for Leiden Archives. It has Dutch language support and a customised import system.

Map Warper

Mapwarper is an open source map geo-rectification, warping and georeferencing application. It enables a user to upload an image, a scanned map or aerial photo for example, and by placing control points on a reference map and the image, to warp it, to stretch it to fit.

Map Warper screenshot of main interface

The application can be seen in use at http://mapwarper.net for public use and in library setting at http://maps.nypl.org

The application is a web based crowdsourced geospatial project that enables people and organisations to collaboratively publish images of maps online and digitize and extract vector information from them.

Users rectify, warp or stretch images of historical maps with a reference basemap, assigning locations on image and map that line up with each other. Often these historical maps were in big paper books, and so for the first time they can be stitched together and shown as a whole, in digital format.

Users can crop around the maps, and join them together into mosaics (previously called layers).

By georeferencing the images, they can be warped or georectified to match the locations in space, and used in GIS software and other services. One such use of these warped maps is an application that that helps people digitize, that is, trace over the maps to extract information from them. For example, buildings in 18th Century Manhattan, details changing land use, building type etc. This application is called the Digitizer.

The application runs as a Ruby on Rails application using a number of open source geospatial libraries and technologies, including PostGIS, Mapserver, Geoserver, and GDAL tools.

The resulting maps can be exported as a PNG, GeoTIFF, WMS, Tiles, and KML for use in many different applications.

Groups of maps can be made into "mosaics" that will stictch together the composite map images.

Features

Ruby & Rails

Database

Installation Dependencies

Check out the Vagrant section lower down in the readme if you want to get started quickly.

on Ubuntu 14.04 LTS

apt-get install -y ruby ruby-dev postgresql-9.3-postgis-2.1 postgresql-server-dev-all postgresql-contrib build-essential git-core libxml2-dev libxslt1-dev imagemagick libmapserver1 gdal-bin libgdal-dev ruby-mapscript nodejs

Due to a bug with the gdal gem, you may need to disable a few flags from your ruby rbconfig.rb see https://github.com/zhm/gdal-ruby/issues/4 for more information

Then install the gem files using bundler

bundle install

Configuration

Create and configure the following files

In addition have a look in config/initializers/application_config.rbfor some other paths and variables, and config/initializers/devise.rbfor devise and omniauth

Database creation

Create a postgis database

psql mapwarper_development -c "create extension postgis;"

Database initialization

Creating a new user

user = User.new
user.login = "super"
user.email = "super@example.com"
user.password = "your_password"
user.password_confirmation = "your_password"
user.save
user.confirmed_at = Time.now
user.save

role = Role.find_by_name('super user')
user = User.find_by_login('super')

permission  = Permission.new
permission.role = role
permission.user = user
permission.save

role = Role.find_by_name('administrator')
permission = Permission.new
permission.role = role
permission.user = user
permission.save

WMS/Tile Caching

To enable caching, install Redis and enable caching in the environment file. You may want to configure the redis.conf as appropriate to your server. For example turning off saving to disk and setting a memory value for LRU "maxmemory 2000mb" "maxmemory-policy allkeys-lru" keeps the redis server having 2gig and expires keys based on a least used algorithm.

Benchmarks

TODO - add production / apache / subdomain benchmarks

Upgrading

Note that the activerecord postgis adapter is upgraded - as such you may need to change or remove the SRID of any existing maps and layers bbox_geom . It should now be 0 where before it may be 4326 This is due to the columns being geometry type as opposed to geographic. SRIDs only really work well for geographic types.

Development

Via Vagrant - There is a vagrantfile you can use this uses a provision script in lib/vagrant. Type

vagrant up

to get and install the virtual machine - this will also install the libraries and depencies and ruby gems for mapwarper into the virtual machine. See the file in lib/vagrant/provision.sh for more details about this process

After that runs, type vagrant ssh to login and then you can

cd /srv/mapwarper
rails c

Create a user in the console, as shown above and then exit

rails s -b 0.0.0.0 -p 3000

to start the server, running on port 3000

I18n Locales / Translations

Currently we are using LocaleApp to assist with translations, which is open to all.

Edit the translations directly on the mapwarper project.

Deployment instructions

The system can use capistrano for deployment

API

See README_API.md for API details