| | 1 | [[TOC]] |
| | 2 | = Installation of GIS Tools on Linux = |
| | 3 | |
| | 4 | Suggest these CLI tools for data manipulation: |
| | 5 | * GDAL's ogr2ogr, etc |
| | 6 | * [http://mpa.itc.it/rs/srtm/srtm_generate_hdr.sh Convert SRTM to GeoTIFF] |
| | 7 | |
| | 8 | == PostGIS == |
| | 9 | * [http://postgis.refractions.net PostGIS] adds Spatial storage to [http://www.postgresql.org PostgreSQL] |
| | 10 | {{{ |
| | 11 | apt-get install postgresql-8.3-postgis |
| | 12 | su postgres |
| | 13 | createdb gis |
| | 14 | createlang plpgsql gis |
| | 15 | psql -d gis -f /usr/share/postgresql-8.3-postgis/lwpostgis.sql |
| | 16 | psql -d gis -f /usr/share/postgresql-8.3-postgis/spatial_ref_sys.sql |
| | 17 | }}} |
| | 18 | * Add Spherical Mercator projection (900913. See http://www.cadmaps.com/gisblog/?p=81 for 54004): |
| | 19 | {{{ |
| | 20 | psql gis |
| | 21 | INSERT into spatial_ref_sys (srid, auth_name, auth_srid, srtext, proj4text) values (900913 ,'EPSG',900913,'GEOGCS["WGS 84", DATUM["World Geodetic System 1984", SPHEROID["WGS 84", 6378137.0, 298.257223563,AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], NIT["degree",0.017453292519943295], AXIS["Longitude", EAST], AXIS["Latitude", NORTH],AUTHORITY["EPSG","4326"]], PROJECTION["Mercator_1SP"],PARAMETER["semi_minor", 6378137.0], PARAMETER["latitude_of_origin",0.0], PARAMETER["central_meridian", 0.0], PARAMETER["scale_factor",1.0], PARAMETER["false_easting", 0.0], PARAMETER["false_northing", 0.0],UNIT["m", 1.0], AXIS["x", EAST], AXIS["y", NORTH],AUTHORITY["EPSG","900913"]] |','+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs'); |
| | 22 | }}} |
| | 23 | * Allow remote access: |
| | 24 | {{{ |
| | 25 | vim /etc/postgresql/8.3/main/postgresql.conf |
| | 26 | listen_addresses = '*' |
| | 27 | |
| | 28 | /etc/init.d/postgresql-8.3 restart |
| | 29 | |
| | 30 | vim /etc/iptables.rules |
| | 31 | -A INPUT -p tcp --dport 5432 -j ACCEPT |
| | 32 | |
| | 33 | reboot |
| | 34 | }}} |
| | 35 | ---- |
| | 36 | Alternatively these can be installed as part of [http://opengeo.org/community/suite/download/ OpenGeoSuite] |
| | 37 | |
| | 38 | == Java == |
| | 39 | {{{ |
| | 40 | vim /etc/apt/sources.list |
| | 41 | # for sun-java packages in unstable |
| | 42 | deb http://ftp.debian.org/debian/ unstable non-free |
| | 43 | deb-src http://ftp.debian.org/debian/ unstable non-free |
| | 44 | |
| | 45 | apt-get update |
| | 46 | apt-get install sun-java6-jdk |
| | 47 | vim /etc/profile |
| | 48 | JAVA_HOME=/usr/lib/jvm/java-6-sun |
| | 49 | export JAVA_HOME |
| | 50 | }}} |
| | 51 | or: |
| | 52 | * [http://java.sun.com/javase/downloads/widget/jdk6.jsp Download the JDK] & install it: |
| | 53 | {{{ |
| | 54 | cd /usr/local |
| | 55 | sh ~/jdk-6u21-linux-i586.bin |
| | 56 | ln -sf /usr/local/jdk1.6.0_21 /usr/local/java |
| | 57 | vim /etc/profile |
| | 58 | JAVA_HOME=/usr/local/java |
| | 59 | export JAVA_HOME |
| | 60 | }}} |
| | 61 | |
| | 62 | == Apache Tomcat == |
| | 63 | [http://tomcat.apache.org Tomcat] is the recommended way to deploy Java applications |
| | 64 | * [http://www.debianadmin.com/how-to-setup-apache-tomcat-55-on-debian-etch.html Debian]: |
| | 65 | {{{ |
| | 66 | apt-get install sun-java6-jdk tomcat5.5 libapache2-mod-jk |
| | 67 | a2enmod jk |
| | 68 | vim /etc/libapache2-mod-jk/workers.properties |
| | 69 | workers.java_home=/usr/lib/jvm/java-6-sun |
| | 70 | |
| | 71 | vim /etc/init.d/tomcat5.5 |
| | 72 | TOMCAT5_SECURITY=no |
| | 73 | /etc/init.d/tomcat5.5 restart |
| | 74 | }}} |
| | 75 | |
| | 76 | == WMS/WFS == |
| | 77 | === [http://geoserver.org GeoServer] === |
| | 78 | (recommended) |
| | 79 | |
| | 80 | {{{ |
| | 81 | apt-get install unzip |
| | 82 | wget http://downloads.sourceforge.net/project/geoserver/GeoServer/2.0.2/geoserver-2.0.2-war.zip |
| | 83 | |
| | 84 | cd /var/lib/tomcat5.5/webapps |
| | 85 | unzip ~/geoserver-2.0.2-war.zip |
| | 86 | |
| | 87 | /etc/init.d/tomcat5.5 restart |
| | 88 | |
| | 89 | vim /etc/iptables.rules |
| | 90 | -A INPUT -p tcp --dport 8180 -j ACCEPT |
| | 91 | |
| | 92 | reboot |
| | 93 | }}} |
| | 94 | |
| | 95 | http://geo.host.domain:8180/geoserver |
| | 96 | * l: admin |
| | 97 | * p: geoserver |
| | 98 | Change the password |
| | 99 | |
| | 100 | or |
| | 101 | {{{ |
| | 102 | wget http://downloads.sourceforge.net/project/geoserver/GeoServer/2.0.2/geoserver-2.0.2-bin.zip |
| | 103 | cd /usr/local |
| | 104 | unzip ~/geoserver-2.0.2-bin.zip |
| | 105 | ln -sf /usr/local/geoserver-2.0.2 /usr/local/geoserver |
| | 106 | |
| | 107 | vim /etc/profile |
| | 108 | GEOSERVER_HOME=/usr/local/geoserver |
| | 109 | export GEOSERVER_HOME |
| | 110 | |
| | 111 | vim /etc/rc.local |
| | 112 | /usr/local/geoserver/bin/startup.sh & |
| | 113 | |
| | 114 | vim /etc/iptables.rules |
| | 115 | -A INPUT -p tcp --dport 8080 -j ACCEPT |
| | 116 | |
| | 117 | reboot |
| | 118 | }}} |
| | 119 | http://geo.host.domain:8080/geoserver |
| | 120 | |
| | 121 | Configure: |
| | 122 | * http://docs.geoserver.org/stable/en/user/production/index.html |
| | 123 | |
| | 124 | === [http://mapserver.org MapServer] === |
| | 125 | * [http://www.tinyows.org TinyOWS] can complement this for WFS-T |
| | 126 | |
| | 127 | == Printing == |
| | 128 | For Printing TMS layers, need to compile the Trunk version of the [http://www.mapfish.org/doc/print/ MapFish Print Module] & then serve the resultant .war with [http://tomcat.apache.org Tomcat]: |
| | 129 | 1. Ensure that {{{JAVA_HOME}}} points to a JDK. |
| | 130 | 2. Download & build source: |
| | 131 | {{{ |
| | 132 | svn checkout http://www.mapfish.org/svn/mapfish/print/trunk/ |
| | 133 | cd trunk |
| | 134 | ./gradlew build |
| | 135 | }}} |
| | 136 | 3. Configure Tomcat |
| | 137 | {{{ |
| | 138 | vim /etc/tomcat5.5/policy.d/04webapps.policy |
| | 139 | permission java.io.FilePermission "/var/lib/tomcat5.5/webapps/print-servlet-1.2-SNAPSHOT/WEB-INF/classes/logging.properties", "read"; |
| | 140 | |
| | 141 | /etc/init.d/tomcat5.5 restart |
| | 142 | |
| | 143 | vim /etc/apache2/sites-available/print |
| | 144 | |
| | 145 | |
| | 146 | ln -s /etc/apache2/sites-available/print /etc/apache2/sites-enabled/print |
| | 147 | /etc/init.d/apache2 restart |
| | 148 | }}} |
| | 149 | 4. Copy the WAR file to your %WEBAPPS% directory: |
| | 150 | {{{ |
| | 151 | cp trunk/build/libs/print-servlet-1.2-SNAPSHOT.war /var/lib/tomcat5.5/webapps |
| | 152 | }}} |
| | 153 | 5. (re)Start Tomcat |
| | 154 | 6. Configure the Map URL for Eden to: |
| | 155 | * http://host.domain:8180/print-servlet-1.2-SNAPSHOT/pdf/ |
| | 156 | 7. Configure %WEBAPPS%\print-servlet-1.2-SNAPSHOT\config.yaml: http://www.mapfish.org/doc/print/configuration.html |
| | 157 | |
| | 158 | Printing can also be done within !GeoServer: |
| | 159 | * http://geoserver.org/display/GEOS/Printing+2.0+HOWTO |
| | 160 | However this version doesn't yet support TMS layers, like !OpenStreetMap. |
| | 161 | {{{ |
| | 162 | wget http://geoserver.org/download/attachments/20938936/printing-2.0.x.zip |
| | 163 | wget http://geoserver.org/download/attachments/20938936/printing-data-2.0.x.zip |
| | 164 | cd /usr/local/geoserver-2.0.2/webapps/geoserver/WEB-INF/lib |
| | 165 | unzip ~/printing-2.0.x.zip |
| | 166 | cd /usr/local/geoserver-2.0.2/data_dir |
| | 167 | unzip ~/printing-data-2.0.x.zip |
| | 168 | /usr/local/geoserver/bin/shutdown.sh |
| | 169 | /usr/local/geoserver/bin/startup.sh & |
| | 170 | }}} |
| | 171 | * Configure by editing {{{/usr/local/geoserver-2.0.2/data_dir/printing/config.yaml}}} according to [http://trac.mapfish.org/trac/mapfish/wiki/PrintModuleServer Documentation] |
| | 172 | |
| | 173 | === Print to Image === |
| | 174 | * http://trac.mapfish.org/trac/mapfish/ticket/161 |
| | 175 | |
| | 176 | == Cache == |
| | 177 | * http://mapproxy.org |
| | 178 | * http://mapproxy.org/docs/latest/install.html |
| | 179 | {{{ |
| | 180 | wget http://effbot.org/downloads/Imaging-1.1.7.tar.gz |
| | 181 | tar zxvf Imaging-1.1.7.tar.gz |
| | 182 | cd Imaging-1.1.7 |
| | 183 | python setup.py install |
| | 184 | cd .. |
| | 185 | |
| | 186 | wget http://pyproj.googlecode.com/files/pyproj-1.8.6.tar.gz |
| | 187 | tar zxvf pyproj-1.8.6.tar.gz |
| | 188 | cd pyproj-1.8.6 |
| | 189 | python setup.py install |
| | 190 | cd .. |
| | 191 | |
| | 192 | wget http://pyyaml.org/download/pyyaml/PyYAML-3.09.tar.gz |
| | 193 | tar zxvf PyYAML-3.09.tar.gz |
| | 194 | cd PyYAML-3.09 |
| | 195 | python setup.py install |
| | 196 | cd .. |
| | 197 | |
| | 198 | wget http://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.1.1.tar.gz |
| | 199 | tar zxvf Jinja2-2.1.1.tar.gz |
| | 200 | cd Jinja2-2.1.1 |
| | 201 | python setup.py install |
| | 202 | cd .. |
| | 203 | |
| | 204 | wget http://pypi.python.org/packages/source/f/flup/flup-1.0.3.dev-20100525.tar.gz |
| | 205 | tar zxvf flup-1.0.3.dev-20100525.tar.gz |
| | 206 | cd flup-1.0.3.dev-20100525 |
| | 207 | python setup.py install |
| | 208 | cd .. |
| | 209 | |
| | 210 | wget http://pypi.python.org/packages/source/P/Paste/Paste-1.7.4.tar.gz |
| | 211 | tar zxvf Paste-1.7.4.tar.gz |
| | 212 | cd Paste-1.7.4 |
| | 213 | python setup.py install |
| | 214 | cd .. |
| | 215 | |
| | 216 | wget http://pypi.python.org/packages/source/P/PasteDeploy/PasteDeploy-1.3.3.tar.gz |
| | 217 | tar zxvf PasteDeploy-1.3.3.tar.gz |
| | 218 | cd PasteDeploy-1.3.3 |
| | 219 | python setup.py install |
| | 220 | cd .. |
| | 221 | |
| | 222 | wget http://pypi.python.org/packages/source/P/PasteScript/PasteScript-1.7.3.tar.gz |
| | 223 | tar zxvf PasteScript-1.7.3.tar.gz |
| | 224 | cd PasteScript-1.7.3 |
| | 225 | python setup.py install |
| | 226 | cd .. |
| | 227 | |
| | 228 | wget http://pypi.python.org/packages/source/M/MapProxy/MapProxy-0.8.4.tar.gz |
| | 229 | tar zxvf MapProxy-0.8.4.tar.gz |
| | 230 | cd MapProxy-0.8.4 |
| | 231 | python setup.py install |
| | 232 | cd .. |
| | 233 | |
| | 234 | cd /home |
| | 235 | paster create -t mapproxy_conf mapproxy |
| | 236 | }}} |
| | 237 | * http://code.google.com/p/modwsgi/wiki/IntegrationWithPylons |
| | 238 | {{{ |
| | 239 | wget http://pypi.python.org/packages/source/C/ConcurrentLogHandler/ConcurrentLogHandler-0.8.4.tar.gz |
| | 240 | tar zxvf ConcurrentLogHandler-0.8.4.tar.gz |
| | 241 | cd ConcurrentLogHandler-0.8.4 |
| | 242 | python setup.py install |
| | 243 | cd .. |
| | 244 | |
| | 245 | mkdir /var/www/.python-eggs |
| | 246 | chown www-data /var/www/.python-eggs |
| | 247 | |
| | 248 | vim /home/mapproxy/mapproxy.py |
| | 249 | import os, sys |
| | 250 | from paste.script.util.logging_config import fileConfig |
| | 251 | BASEDIR = os.path.dirname(__file__) |
| | 252 | INIFILE = os.path.join(BASEDIR, 'etc', 'config.ini') |
| | 253 | LOGFILE = os.path.join(BASEDIR, 'etc', 'log_deploy.ini') |
| | 254 | sys.path.append(BASEDIR) |
| | 255 | os.environ['PYTHON_EGG_CACHE'] = '/var/www/.python-eggs' |
| | 256 | fileConfig( LOGFILE ) |
| | 257 | from paste.deploy import loadapp |
| | 258 | application = loadapp('config:%s' % INIFILE) |
| | 259 | |
| | 260 | vim /etc/apache2/sites-available/proxy |
| | 261 | <VirtualHost *:80> |
| | 262 | ServerName proxy.sahanafoundation.org |
| | 263 | ServerAdmin webmaster@sahanafoundation.org |
| | 264 | |
| | 265 | WSGIScriptAlias / /home/mapproxy/mapproxy.py |
| | 266 | WSGIDaemonProcess mapproxy user=www-data group=www-data home=/home/mapproxy processes=2 maximum-requests=100 |
| | 267 | |
| | 268 | <Location "/"> |
| | 269 | Order deny,allow |
| | 270 | Allow from all |
| | 271 | WSGIProcessGroup mapproxy |
| | 272 | </Location> |
| | 273 | |
| | 274 | ErrorLog /var/log/apache2/proxy_error.log |
| | 275 | LogLevel warn |
| | 276 | CustomLog /var/log/apache2/proxy_access.log combined |
| | 277 | </VirtualHost> |
| | 278 | |
| | 279 | cd /etc/apache2/sites-enabled |
| | 280 | ln -s ../sites-available/proxy |
| | 281 | /etc/init.d/apache2 force-reload |
| | 282 | }}} |
| | 283 | * http://mapproxy.org/docs/latest/configuration.html |
| | 284 | {{{ |
| | 285 | |
| | 286 | }}} |
| | 287 | |
| | 288 | * http://tilecache.org |
| | 289 | * http://github.com/migurski/GridTile |
| | 290 | |
| | 291 | * http://geowebcache.org |
| | 292 | * e.g. included as part of [http://opengeo.org/community/suite/download/ OpenGeoSuite] |
| | 293 | |