MXD2map logo

Table Of Contents

Previous topic

Installation from Source

Next topic

Functionality

Installation from Source

This Documentation describes how you can install MXD2Map from source on GNU/Linux Systems.

Download the Source tarball of mxd2map and extract it into a directory. The Path used in this example is ~/mxd2map.

Requirements

To run the converter you need at least the following components:

  • Sun Java6 SDK / JRE and ant
  • ArcEngine10.x with a valid licence enabled
  • Some additional Java Tools and libraries as documented below

Install ArcGIS SDK

# As root: # !!! Deactivate SELINUX !!! # ArcGIS fails in many mysterious ways otherwise. # write SELINUX=permissive into: /etc/sysconfig/selinux

setenforce Permissive

yum-install compat-libstdc++-33 compat-libstdc++-296 compat-libf2c compat-libgcc-296
compat-openldap-2.3 cairo compat-libf2c-34 mesa-libGLU compat-gcc-34 freeglut-2.4 gmp glibc gtk2 gtk2-devel libidn mesa-libGL mesa-libGLU openldap openmotif-devel openmotif openssl convmv

yum-groupinstall “Legacy Software Support” yum-groupinstall “X Window System” yum-groupinstall “Legacy Software Development” yum-groupinstall “X Software Development” yum-groupinstall “Development Tools” useradd mxd2map groupadd arcgis-users usermod -a -G arcgis-users mxd2map mkdir -p /usr/local/share/macrovision/storage chmod g+w /usr/local/share/macrovision/storage chgrp arcgis-users /usr/local/share/macrovision/storage

# Set passwd for user mxd2map and log in as that user

/mnt/ArcGIS-SDK/linux/EngineRT/Setup # Click through the dialog leave everything as default /mnt/ArcGIS-SDK/linux/ArcObjectsSDKJava/Setup # Click through the dialog leave everything as default # Register “ArcGIS Engine Runtime and ArcGIS Engine Developer Kit (Single Use)” export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0 . ~/arcgis/developerkit10.0/init_devkit.sh . ~/arcgis/developerkit10.0/java/tools/setenv_ant.sh

Install additional libraries

cd ~/mxd2map mkdir lib ## Jargs wget http://sourceforge.net/projects/jargs/files/jargs/1.0/jargs-1.0.tar.bz2/download -O - | tar -xj jargs.jar -O > jargs.jar

## log4j wget http://archive.apache.org/dist/logging/log4j/1.2.9/logging-log4j-1.2.9.tar.gz -O - | tar -xz log4j-1.2.9.jar -O > log4j.jar

## Commons codec wget http://apache.openmirror.de/commons/codec/binaries/commons-codec-1.7-bin.tar.gz -O - | tar -xz commons-codec-1.7.jar -O > commons-codec.jar

Install Mapserver from Source

This documentation is a log of the steps neccessary to build mapserver 6.2.0-rc1 on CentOS 5. You might just want to install a binary package for your distribution For a real documentation please refer to: http://mapserver.org/installation/unix.html

# Everything is installed into ~/dev # As root: yum groupinstall “Development Tools” yum install freetype-devel libpng-devel zlib-devel curl-devel libtiff-devel libjpeg-devel fontconfig-devel libXpm-devel libxml2-devel expat-devel sqlite-devel agg-devel giflib-devel libxslt-devel libexslt-devel httpd-devel

# As user: # set up some convienance export DEVELDIR=~/devel export SRCDIR=$DEVELDIR/src alias configure=”./configure –prefix=$DEVELDIR” function cs {

mkdir -p “$SRCDIR” if test -n “$1”; then

cd “$SRCDIR/$1”
else
cd “$SRCDIR”

fi

}

cs wget http://download.osgeo.org/proj/proj-4.8.0.tar.gz tar -xf proj-4.8.0.tar.gz cs proj-4.8.0 configure && make && make install

cs wget https://bitbucket.org/pierrejoye/gd-libgd/get/GD_2_0_33.tar.bz2 tar -xf GD_2_0_33.tar.bz2 cs pierrejoye-gd-libgd-5551f61978e3/src configure && make && make install

cs wget http://download.osgeo.org/geotiff/libgeotiff/libgeotiff-1.4.0.tar.gz tar -xf libgeotiff-1.4.0.tar.gz cd libgeotiff-1.4.0 configure –with-proj=$DEVELDIR && make && make install

cs wget http://downloads.esri.com/Support/downloads/ao_/FileGDB_API_1_2-32.tar.gz tar -xf FileGDB_API_1_2-32.tar.gz cs -ri FileGDB_API/include FileGDB_API/lib $DEVELDIR export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0 . ~/arcgis/engine10.0/init_engine.sh . ~/arcgis/engine10.0/java/tools/init_java.sh . ~/arcgis/developerkit10.0/java/tools/setenv_ant.sh . ~/arcgis/developerkit10.0/init_devkit.sh

cs wget http://download.osgeo.org/gdal/gdal-1.9.2.tar.gz tar -xf gdal-1.9.2.tar.gz cs gdal-1.9.2 configure –enable-shared=no –enable-static=yes –with-fgdb=$DEVELDIR && make && make install

cs wget http://download.osgeo.org/mapserver/mapserver-6.2.0-rc1.tar.gz tar -xf mapserver-6.2.0-rc1.tar.gz cs mapserver-6.2.0-rc1 configure -with-proj=$DEVELDIR –with-gd=$DEVELDIR

–with-ogr=$DEVELDIR/bin/gdal-config –with-gdal=$DEVELDIR/bin/gdal-config –with-wfs –with-wcs –with-wmsclient –with-wfsclient –with-sos –with-xml2-config=/usr/bin/xml2-config –with-apache-module –with-apxs=/usr/sbin/apxs –with-exslt=yes –with-xslt=yes

# in this specific version you also need to apply https://github.com/unicolet/mapserver/commit/8ac6841c4c4857acddd87bdb4dfafb729aea91c3 # when building on x86 systems make && make install cd mapscript/java make && make install cp mapscript.jar ~/mxd2map/lib

Build MXD2map

cd ~/mxd2map ant jar-norevision

Run MXD2map

ArcGIS needs some weird environment settings. Additionally it provides it’s own versions of basic libraries like libstdc++. Here is what you have to do (or at least what worked for me):

export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0 . ~/arcgis/engine10.0/init_engine.sh . ~/arcgis/engine10.0/java/tools/init_java.sh . ~/arcgis/developerkit10.0/java/tools/setenv_ant.sh . ~/arcgis/developerkit10.0/init_devkit.sh export LD_LIBRARY_PATH=$DEVELDIR/lib:$LD_LIBRARY_PATH export LD_PRELOAD=$LD_PRELOAD:/usr/lib/libstdc++.so.6 export AWT_TOOLKIT=XToolkit

# Set the locale to some utf-8 value like export LC_ALL=en_US.UTF-8

# Run it with: LD_PRELOAD=$LD_PRELOAD:/usr/lib/libstdc++.so.6 java -Xss2m -jar mxd2map.jar

# Now edit the converter.properties sample so that it points to a valid mxd file # together with a valid mapfile template.

# If your files contain special characters in windows encoding # convert them with convmv: convmv –notest -r -fcp1252 -t utf8 Bereisungen/

Setup Mapserver with Apache

vim /etc/httpd/conf/httpd.con # Change setting Directory “/var/www/cgi-bin”

<Directory “/var/www/cgi-bin”>
AllowOverride None Options ExecCGI Order allow,deny Allow from all

</Directory>

/etc/sysconfig/httpd

# Notes: # Generate parameters to include all layers export MAPNAME=ausbaustrecken_west && grep wms_title ${MAPNAME}.map | grep -v “Layer” | awk ‘{printf “&layers=” $2}’ | sed s/”//g | xargs -Ifoo echo “http://giid.polyhedra.intevation.de/cgi-bin/$MAPNAME.cgi?mode=browse&template=openlayers&foo

# Modify the fonts.txt with fonts according to your installation. sed -i ‘s/C:/Windows/Fonts//home/aheinecke/arcgis/engine10.0/fonts/’ ttf-fonts/fonts.txt