Geomajas is an open source library for building thin client GIS applications.
The documentation for geomajas is Windows oriented. Here is how I translated this for installation on Ubuntu (Jaunty Jackalope, 09.04).
We need to install the java runtime, tomcat, postgresql and postgis (we also need unzip in this install). This can be done using the following (as root) :
apt-get install sun-java6-jdk tomcat6 postgresql-8.3-postgis unzip
You still need to dowload a couple of geomajas files :
For the rest of the demo, make sure the current directory is the one containing the downloaded files.
Now switch off the use of the tomcat security manager, by editing /etc/init.d/tomcat6 and changing the line
(for production, it may be better to configure the security manager instead, see here).
Restart your tomcat instance (as root)
Install the geomajas tutorial in tomcat.
cp majas-tutorial-1.4.0.war /var/lib/tomcat6/webapps/majas-tutorial.war
You can now access the tutorial application at http://localhost:8080/majas-tutorial/applications/db/html/db.html.
We now have the tutorial running, but it does not use the database just yet. Lets create a new editable application which uses the database to store the GIS information.
We have to create a suitable postgis enabled database for this, which we will fill with the sample (parcel) data which we downloaded (fortunately, you only have to do this once).
sudo su postgres createdb postgis createlang plpgsql postgis psql -d postgis -f /usr/share/postgresql-8.3-postgis/lwpostgis.sql psql -d postgis -f /usr/share/postgresql-8.3-postgis/spatial_ref_sys.sql exit mkdir parcels unzip ../parcels.zip unzip parcels.zip shp2pgsql -I -s 31300 parcels parcels > parcels.sql sudo su postgres psql -d postgis -f parcels.sql echo "alter user postgres with password 'postgres';" | psql -d postgis exit cd ..
This first initialises the database to include all the postgis stuff, then converts the parcels shape file to sql commands and imports these. The password for the “postgres” user is also modified to match the settings in the application. All postgresql commands are run as the “postgres” user to assure you have the rights to access the database.
Now create the second application. Geomajas allows you to configure the applications in /var/lib/tomcat6/webapps/majas-tutorial/applications. This already contains the “tutorial” application, and we are now going to add “db”. We have downloaded the configuration, so we just need to unzip it in place (as root). We then need to restart tomcat as we are changing something in the application (which autodeploy cannot detect).
unzip -d /var/lib/tomcat6/webapps/majas-tutorial/applications/ db.zip chown -R tomcat6:tomcat6 /var/lib/tomcat6/webapps/majas-tutorial/applications/db /etc/init.d/tomcat6 restart
The tutorial assumes
You should now be able to browse to your new application using the url http://localhost:8080/majas-tutorial/applications/db/html/db.html.
You can now start editing the parcels which have been defined or add new ones. For this you need to some in until you see parcels (top left icon), select the layer to edit (“Parcels” in the tree at the right), select the “edit” icon (third icon from the right), then right click in the map and select “Create new feature”. The click and move the mouse to create the parcel. Clicking again outside the defined area will increase is, clicking inside will stop the editing. Use the right-click menu to save or cancel and start again. Have fun.