OpenMAINT and GIS on Localhost. Part 1

I decided to look at the GIS ( Geographic Information System) component of OpenMAINT. I decided to test this initially on my PC.

To date, I have not been able to activate the GIS component.

I am stuck with the following error:

Call: services/json/schema/setup/saveconfiguration
—————————————————
Error: org.cmdbuild.exception.ORMException: ORM_POSTGIS_NOT_FOUND
        at org.cmdbuild.exception.ORMException

But the steps below may speed up others attempting to get it going.

Information on the process

First, getting the right packages. I have postGIS 2.2 installed, see first blog on setting up. It recommends this package.

Next it suggests Geoserver 2.8.3 in the same list of requirements. Ensure you have the WAR file and not the .exe file (my fist iterative mistake).

Here for Geoserver 2.8.3 page and WAR download here.

The references for this exercise are from CMDBuild Manuals, you can find them here:

  • CMDBuild User Manual p50 to 53
  • CMDBuild Technical Manual page 8 & 48. Note- Page 8 important.
  • CMDBuild Administration Manual 102 to 106

On the CMDBuild forum I found the following:

The Problem

Hi There – I have downloaded and installed Geoserver as per Technical Manual page 48, have deleted all preinstalled workspaces and created a new one. How ever when I try and enable GIS i get the following error: PostGIS not installed.

From Tecnoteca

the problem concerns the PostGIS spatial database. Have you followed the correct procedure to restore them (http://www.cmdbuild.org/file/manuali/technical-manual-in-english page 8) ? CMDBuild Team

From <http://www.cmdbuild.org/forum/forum-for-advanced-cmdbuild-users/78829857?b_start=0#863640488>

Also

Hi Andrea, when you restore of a databse containing a gis schema (as the openmaint-empty-gis.backup) you must follow the procedure explained at page 8 of CMDBuild Technical Manual (http://www.cmdbuild.org/file/manuali/technical-manual-in-english). Basically you need to create a new database, create the gis schema, create the gis functions and then perform the restore of the backup. Hope this helps! Kind regards CMDBuild Team

From <http://www.cmdbuild.org/forum/forum-in-english/902594555?b_start=0#6284086>

From the User Manual:

  • So the inference is that you only need the postGIS installation to have the map functioning.
  • The Geoserver is there to pull in the raster/vector files.
  • The setup also needs at least one geographical attribute (in the database)

From Page 8 of Technical Manual:

 

If you have to restore an existing database (using for example the “psql” tool):

$ psql … cmdbuild

  1. cmdbuild=# CREATE SCHEMA gis;  
  2.  cmdbuild=# SET SEARCH_PATH TO gis, public;
  3. cmdbuild=# \i ${POSTGIS_DIR}/postgis.sql
  4. cmdbuild=# \i ${POSTGIS_DIR}/legacy.sql (if you use PostGIS 2.0)
  5. cmdbuild=# ALTER DATABASE ${DB_NAME} SET search_path=”$user”, public, gis; cmdbuild=# DROP TABLE gis.geometry_columns;
  6. cmdbuild=# DROP TABLE gis.spatial_ref_sys;

Web site of reference: http://www.postgresql.org/

Make a Backup of your Database before you start

Before you start messing with this part of the process, make a backup of your database. Its not a bad idea to make a backup of your whole setup actually.

To make a backup of your database, right click on the database (item 1 in image 2 below) and click on backup. Find a nice safe place to put this.

As I have 4 instances of openMAINT running (2 localhost/2 vps) I get a bit casual about this, but you shouldn’t. OpenMAINT is like a leach and sucks hours of your time away, so try and minimise this.

Setting up the GIS Schema

From the above I have to go back to my original setup and 1/ drop any GIS schemas in my Postgres Database

check to see that the original GIS Schema is set correctly , items 1 to 6 above, then upload the empty gis database which came with the openmaint file.

So the first thing you need to do is fire up your Postgrs database, if there is a gis schema already there, delete it.

I found, if there were functions  (and I think preliminary ones has (3) then they are associated with the schema and it will not let you just DROP the schema, you need to use drop/cascade and this deletes the functions , tables and schema. (see numbers 5 & 6)

When testing, if there was a gis schema already there, I just renamed it by right clicking on the schema and editing name  in the properties.

So, after going through items 1 to 6 above you create a blank schema called gis.

Next you restore the openmaint-1.1-empty-gis.backup file by right clicking on the database you are using , in the diagram above it is item 1. “om”.

This seemed to have left my openmaint & shark databases intact and only updated the gis schema.

As  you can see above, if you query the new table created (note also there are 53 functions now associated with this schema), there is a single spacial reference, which is what is required from the user manual.

Setting up Geoserver

I also just installed the   Geoserver 2.8.3.war file in the C:\alfresco\tomcat\webapps directory and then ran the bat start file to start tomcat.

Login : admin

Pasword: geoserver

As soon as its started and gone through the whole process, you need to stop Tomcat and remove the Geoserver 2.8.3.war file .

You should now have a newly created geoserver directory in the webapps directory.

So, start tomcat again and go to your browser localhost:8080 and when tomcat starts, go to Manager App and you will see the geoserver running.

Click on the geoserver name on the left and it will take you to the geoserver page

Go to the workspaces and create a new workspace, I called mine omgis.

OpenMaint setup

Now we have these items up and running, we should be able to get the openMAINT setup, so fire up openMAINT as your superadmin person and go into the Data Manager Module.

And that is as far as I have got so far.

I have looked on the CMDBuild forum page and used Google Translate for the italian comments, but no success so far.

A couple of things I haven’t tried yet.

1/ Restore my original Database, blow away any GIS schemas in  it.

Create a new database and restore the openmaint-1.1-empty-gis.backup file to that.

Then try and Backup the GIS schema and restore that in my original Database.

2/ Looking on my Demo VPS on Amazon, it looks like the openmaint-1.1-demo.backup file also has the gis schema in it too.  So maybe some testing on that one to see if I can get the postGIS working there. (Update, this instance has exactly the same error as above)

3/ As usual, rather than just loading up parts in openMAINT and using, you have to delve into all the components to figure out what is happening.

See part 2 for the next episode

  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Add a Comment

Your email address will not be published. Required fields are marked *