Wednesday, 29 August 2012

Installing PostGIS 2.0 & GeoServer on Centos 6 64bit


Installing PostGIS 2.0 and GeoServer on Centos 6 64bit

as root;
su
exclude=postgres* in base and update sections of /etc/yum.repos.d/CentOS-Base.repo
curl -O http://yum.postgresql.org/9.1/redhat/rhel-6-x86_64/pgdg-centos91-9.1-4.noarch.rpm
rpm -ivh pgdg-centos91-9.1-4.noarch.rpm
curl -O http://mirror.bytemark.co.uk/fedora/epel/6/x86_64/epel-release-6-7.noarch.rpm
rpm -ivh epel-release-6-7.noarch.rpm
yum install postgresql91-server postgis2_91
yum install postgresql91-contrib.x86_64

service postgresql-9.1 initdb

# edit postgres' conf
vi /var/lib/pgsql/9.1/data/postgresql.conf
add listen_addresses = '*'

# allow some connection, make sure the last one matches your local network if you're doing local network stuff...
vi /var/lib/pgsql/9.1/data/pg_hba.conf
local all all trust
host all all 127.0.0.1/32 trust
host all all 192.168.1.0/24 md5

# kick postgres
service postgresql-9.1 start

# run on startup
chkconfig postgresql-9.1 on

# change the password for the postgres account
passwd postgres

su postgres
psql
ALTER USER postgres WITH ENCRYPTED PASSWORD 'postgres';

# extensions time..
CREATE EXTENSION adminpack;

# spatialise your db
CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;

\q
exit

# allow incoming connections on 5432 (postgresql standard port)
back to root;
add the following to /etc/sysconfig/iptables above any REJECT rule
-A INPUT -p tcp -m state --state NEW -m tcp --dport 5432 -j ACCEPT

service iptables restart

# back to postgres' bash
sudo -i -u postgres
createdb template_postgis
createlang plpgsql template_postgis
psql -d template_postgis -f /usr/pgsql-9.1/share/contrib/postgis-2.0/postgis.sql
psql -d template_postgis -f /usr/pgsql-9.1/share/contrib/postgis-2.0/spatial_ref_sys.sql
psql -d template_postgis -f /usr/pgsql-9.1/share/contrib/postgis-2.0/postgis_comments.sql
psql
CREATE DATABASE my_spatial_db TEMPLATE template_postgis;
\q
exit

# back to root
# Installing Geoserver
# we need java, java -version says no java
yum install yum-priorities
rpm -Uvh http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
rpm -Uvh http://mirrors.dotsrc.org/jpackage/6.0/generic/free/RPMS/jpackage-utils-5.0.0-7.jpp6.noarch.rpm
Next we will install Java and Tomcat 6:
yum -y install java
yum -y install tomcat6 tomcat6-webapps tomcat6-admin-webapps
vi /etc/tomcat6/tomcat-users.xml
add a user with roles of admin,manager
chkconfig tomcat6 on
# now to geoserver
cd /home/<user>
wget http://downloads.sourceforge.net/geoserver/geoserver-2.1.4-war.zip
unzip geoserver-2.1.4-war.zip
mv geoserver.war /usr/share/tomcat6/webapps
# start up tomcat6
service tomcat6 startexit
# test geoserver at
http://localhost:8080/geoserver/web/

# and you'll probably want access across your network
iptables -A INPUT -p tcp --dport 8080 -j ACCEPT
/sbin/service iptables save
iptables -F

Wednesday, 14 March 2012

Changing an icon in a treepanel extjs 3

It took me a while to find a solution - probably a slow head day but here's how;
In this case a node represents a web mapping service. If the WMS is alive it should return a list of layers which are used to create a series of child nodes. So if no children change the icon to something relevant.

the css file;
.failedwms-icon {
background: url('resources/deadwms.gif') no-repeat;
height: 16px;
width: 16px;
}

in your js code;
'load': function(node){
// if a node receives a response and no layer child nodes are created we want to change the icon
if (node.childNodes) {
if (node.childNodes)
{
if (node.childNodes.length == 0)
{
node.attributes.iconCls = 'failedwms-icon';
node.getUI().iconNode.className = node.attributes.iconCls;
}
}
}
}

Wednesday, 7 March 2012

compiling OpenLayers

Grab it from their github: https://github.com/openlayers/openlayers/zipball/master

Drop closure-compiler.jar & compiler.jar into openlayers\tools
Go to \build and ...

build.py -c closure full OpenLayers.js for regular compressed OpenLayers (700kb odd)
buildUncompressed.py full OpenLayers-uncompressed.js for phat Openlayers (2.5Mb odd)

Monday, 9 January 2012

Popularity of WMS InfoFormats

I'm doing some development work on a web map that brings wms layers from a host of UK public wms providers. Part of the work is to provide an info tool and we're using OpenLayers getFeatureInfo control to do this.

The problem with working with so many external wms providers is the lack of consistency in info formats supported. A quick summary (below) shows that html and plain text are the most supported with ogc xml a reasonable third. So we'll be concentrating our support for these formats and hopefully, if time and money permits, to extend support to others. Not good findings for ogc gml as it comes last with only 11% support.

100% support: html & plain
89% support: ogc xml
67% support: xml
19% support: esri raw xml & esri feature info xml
11% support: ogc gml

Tuesday, 6 September 2011

RSS feed of Google Calendar Events

Use the following;

https://www.google.com/calendar/feeds/[your account]/public/basic?orderby=starttime&sortorder=ascending&max-results=5&futureevents=true

Now to put it on XBMC. The GF will be impressed.

Friday, 1 July 2011

GIS Technologies - DotSpatial

I'm going to hopefully run through the majority of the technologies on show at FOSS4G this year. I probably won't be going myself but at least by September I'll have first-hand experience with the big names.

Okay, the first one I chose was DotSpatial. I think i'll bunch up the OSM stuff into one long session - that's why I've gone and skipped over it.

So DotSpatial. I've only had a half a day but there's plenty of clear tutorials over at DotSpatial Docs to work through. I tried out a few and it's normally stuff for a dot Net Spatial library - map controls and ease of loading/editing vector and raster files.

Loading WMS into a map contol - no simply single layer class yet but a workaround was posted by Ted - here

Coming from working with ArcObjects it's looks a godsend of common sense. I'm not sure if I'll yet see a job post looking for DotSpatial as a requirement but you never know.

Friday, 17 June 2011

GIS Technologies this year at FOSS4G

This is a boiled down list of the technologies to be discussed at FOSS4G this year. I've been using most of the OSGeo GeoStack a fair while but I knew there was a lot out there I wasn't getting exposure to. Simmering down the tech list from the FOSS4G schedule has given me an insight into what I should be looking at. And really, I wasn't expecting it to be so darn large.

Sorry there's no links. Some entries are missing from the schedule due to their particular focus but I've tried to keep it complete as best possible from a developer's point of view.

OSM - OpenStreetMap
JOSM - an editor for OpenStreetMap in Java
OSM + PostGIS + QGIS - Data analysis
DotSpatial - Mono/.Net Framework C# GIS library
PostGIS
MapFish - web framework, companion to OpenLayers, GeoExt, GeoAlchemy, Shapely
FormAlchemy / GeoFormAlchemy
Geomajas - a client/server framework, uses GWT
Spatial Data Infrastructure/GeoNetwork/GeoCat Bridge creates metadata
GeoMoose - client framework for MapServer, good on data organisation, data maintenance
pgRouting - routing extension to PostGIS
Geoserver
OpenLayers
Common JavaScript libraries - jQuery UI, ExtJS, Sencha Touch
GeoKettle - ETL tool, GeoMonrian (Spatial OLAP server) and GeoBIExt - all @ spatialytics.org
OGC WFS-T, TinyOWS
GeoExt
MapServer
QGIS
Mapnik, Node.js
i2maps - geocomputational platform, spatial/temporal data (built around OpenLayers and GeoDjango)
GeoNode
NodeJS framework, Polymaps framework - both for back-end
Inkscape - SLD production
Zoo-Project and WPSs (Web Processing Services)
Amazon Web Services - autoscaling, load balancing cluster
Spatial Wiki - Ubuntu, MediaWiki, Apache, Geoserver, OpenLayers, PostGIS
NSDI, GIS in urban planning
Flot plotting library, spatio-temporal modelling - surfaces
HydroDesktop, free GIS for hydrological modeling
Tilecaching, secured WMS, MapProxy
Imposm - imports OSM data into PostGIS
gvSIG Mini - production of PoI data from OSM, map viewer for Android
Flex, OpenScales, NetCDF, AXIIS, Degrafa, SOS, AIS - for Oceanic applications
Mod-geocache - caching server
MapMint - SDI manager
MapQuery, gRaphael (SVG chart library)
TileMill with Mapnik and Carto (map styling language)
Glob3 - 3D framework, suitable for iOD and Android devices
Google Fusion tables > kml for google maps
GDAL
GeoTools - Java GIS library
MapWindow - MS Windows GIS with .Net API
GXP - Javascript library connects to OpenLayers, Ext JS, GeoExt using a JSON configuration.
Tinyows, GeoPrisma, Zoo WPS - part of the MapServer project stack
GeoScript - extends python, javascript, scala, groovy
CartoSet - web map framework, built upon Ruby on Rails framework ‘CartoDB’.
GeoShield - security access-control to OGC services
MapGuide OpenSource Server & Web Extensions
OGC Web Processing Service (WPS), 52 North, Geoserver
OpenAerialMap
Mobile mapping: BeeGIS (uDig ext) and Geopaparazzi
Partitioning Around Medoids clustering algorithm with Grass & R
GeoWebCache
Cartagen Knitter - rectifying aerial imagery
Opticks - open source image processing software
OpenLayers Mobile
Esri Geoportal Server
Web of Things demonstration - SenseBox
WebGL Earth
WCS 2.0
MassMov2D - landslide modelling
libPC & libLAS - point cloud processing
PyWPS
mapnik2geotools
FalconView
Cellular Automata QGIS plugin
GeoCouch, CouchDB
HydroLiDAR
jai-tools
Geomondrian
GeoServer Plugin for the NoSQL Mongo Database
PostGIS Raster support/extension
JTS Topology Suite
HTML5/WebGL
OGC SOS
GeoCommons
GeoExt vs MapQuery vs Legato
Postal Address Geo-Coder (or PAGC)
AcidMaps
JGrass/uDig
Stado
HSLayers - a Openlayers/ExtJS based mapping framework
Neo4j Spatial
MapBender 3
GeoAPI 3.0
GeoCat Bridge - publishing data from ArcGIS to GeoNetwork/Geoserver/MapServer

and Oracle, FME and ArcGIS Server!