You Are Here » Home » Installation

PostGeoMedia Installation

1. Prepare Work


1.1 PostgreSQL 11
1.2 Java and JDK 1.8
1.3 Maven 3.3
1.4 Checking
      1. g++ --version success
      2. javac -version success
      3. pg_config success
      4. mvn -version success

2. Installation of PL/Java


2.1 Installation
      $ yum install java-1.8.0-openjdk-devel.x86_64
      $ yum install
      $ yum install pljava-11.x86_64
      1. Setting in PostgreSQL for PL/Java
           $cd /var/lib/pgsql/11/data
           $vi postgresql.conf
      2. Add the following lines for the pljava setting
           pljava.classpath='/usr/pgsql-11/share/pljava/pljava-1.5.1.jar'
           pljava.libjvm_location='/usr/lib/jvm/java-1.8.0-openjdk/jre/lib/amd64/server/libjvm.so'
      3. Restart of PostgreSQL
           $systemctl restart postgresql-11.service
      4. In psql or pgAdmin4
           CREATE EXTENSION pljava;
2.2 Build PL/java Source by Maven
      1. $yum install postgresql-devel
      2. $visit https://github.com/tada/pljava/releases/tag/V1_5_2 and download the source (.zip), unzip files in root: /tmp/
      3. Change the pljava folder name (pljava_1.5.2 to pljava) and move to pljava folder(cd /tmp/pljava)
           $mvn clean install
            [INFO] PostgreSQL PL/Java ................................ SUCCESS
            [INFO] PL/Java API ....................................... SUCCESS
            [INFO] PL/Java backend Java code ......................... SUCCESS
            [INFO] PL/Java backend native code ....................... SUCCESS
            [INFO] PL/Java Deploy .................................... SUCCESS
            [INFO] PL/Java Ant tasks ................................. SUCCESS
            [INFO] PL/Java examples .................................. SUCCESS
            [INFO] PL/Java packaging ................................. SUCCESS

      4. Make java source root (eg. /tmp/proj), download all files from (https://github.com/awarematics/mgeometry/tree/master/PostgreSQL/04.proj)
      5. Copy the folder 04_proj/ files into a path, such as: /tmp/proj, move to the path and run:
           $mvn clean package
            [INFO] Building jar: /tmp/proj/target/proj-0.0.1-SNAPSHOT.jar
            [INFO] ------------------------------------------------------------------------
            [INFO] BUILD SUCCESS
            [INFO] ------------------------------------------------------------------------
            [INFO] Total time: 3.600 s
            [INFO] Finished at: 2019-06-05T12:54:16-04:00
            [INFO] Final Memory: 17M/201M
            [INFO] ------------------------------------------------------------------------

      6. Add JTS library (jts-core-1.15.0-SNAPSHOT.jar)for SQL query and move the jar to a folder (eg. /tmp/), the jar file can be download from this website (jts-release-1.15.0-bin.zip):
           https://github.com/locationtech/jts/releases/tag/jts-1.15.0
      7. In psql or pgAdmin4, install java library
           select sqlj.install_jar('file:/tmp/proj/target/proj-0.0.1-SNAPSHOT.jar', 'jar1', true);
           select sqlj.install_jar('file:/tmp/jts-core-1.15.0-SNAPSHOT.jar', 'jar2', true);
           select sqlj.set_classpath('public', 'jar1:jar2');
           select sqlj.get_classpath('public');
      8. Finished.


3. Install Function in PostgreSQL


In your postgresql or pgAdmin4 query tool, download and execute follow sql files;
3.1 Create table
     Download from github: https://github.com/awarematics/mgeometry/blob/master/PostgreSQL/01.install/1_table.sql
----------------------------------------------------------      Execute 1_table.sql
3.2 Create type
     Download from github: https://github.com/awarematics/mgeometry/blob/master/PostgreSQL/01.install/2_type.sql
     Execute 2_type.sql
3.3 Create trigger
     Download from github: https://github.com/awarematics/mgeometry/blob/master/PostgreSQL/01.install/3_trigger.sql
     Execute 3_trigger.sql
3.4 Function based
     Download from github: https://github.com/awarematics/mgeometry/blob/master/PostgreSQL/01.install/4_addMGeometryColumns.sql
     Execute 4_addMGeometryColumns.sql
     Download from github: https://github.com/awarematics/mgeometry/blob/master/PostgreSQL/01.install/5_appendMGeoemtryData.sql
     Execute 5_appendMGeoemtryData.sql
3.5 Function mgeometry
     Download from github: https://github.com/awarematics/mgeometry/blob/master/PostgreSQL/01.install/6_functionMGeometry.sql
     Execute 6_functionMGeometry.sql
3.6 Test
     Download from github: https://github.com/awarematics/mgeometry/blob/master/PostgreSQL/03.example/1_createTable.sql
     Execute 1_createTable.sql
     Download files from github: https://github.com/awarematics/mgeometry/tree/master/PostgreSQL/03.example/2_insertTableData
     Execute
          insert_carsensors.sql
          insert_cartrajs.sql
          insert_userstphotos.sql
          insert_uservideos.sql
     Download files from github: https://github.com/awarematics/mgeometry/tree/master/PostgreSQL/03.example/3_insertMGeometryData
     Execute
          append_mdouble_accx.sql
          append_mdouble_accy.sql
          append_mdouble_accz.sql
          append_mpoint.sql
          append_mvideo.sql
          append_stphoto.sql
     Download from github: https://github.com/awarematics/mgeometry/blob/master/PostgreSQL/03.example/4-8
     Execute
          4_testQuery_Join.sql
          5_testQuery_Temporal_mpoint.sql
          6_testQuery_Temporal_mvideo.sql
          7_testQuery_SpatioTemporal_mpoint.sql
          8_testQuery_SpatioTemporal_mvideo.sql
3.7 Insert All BDD-100k NewYork City Data
      http://gofile.me/4lVxW/UuCjL3xit