tag:blogger.com,1999:blog-63603874170130596402024-03-13T21:30:18.119-07:00Coastal's BlogOn here you'll find tips and notes on stuff i'm interested in. That's normally xbmc, movie libraries, psp homebrew and gadgets. I'll also post some code examples which are more for my reference than anything else.Anonymoushttp://www.blogger.com/profile/05147604902119329862noreply@blogger.comBlogger85125tag:blogger.com,1999:blog-6360387417013059640.post-56719698338905574662013-12-17T08:52:00.003-08:002013-12-18T01:24:03.996-08:00Exporting from Oracle in UTF8<span style="font-family: inherit;">Use <span style="background-color: white;">NLS_LANG=ENGLISH_UNITED KINGDOM.UTF8</span></span>Anonymoushttp://www.blogger.com/profile/05147604902119329862noreply@blogger.com0tag:blogger.com,1999:blog-6360387417013059640.post-5636310529156262022013-12-17T02:07:00.001-08:002013-12-18T01:24:34.072-08:00Identifying failed characters in a postgresql migration from Oracle.<span style="font-family: inherit;">Due to a failure somewhere along the line of a migration from another database to postgresql some of the characters have failed. Since there's a large number of tables and we don't know which columns have characters that have failed here's how we did it;</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">A pg_dump of the database: pg_dump --data-only --column-inserts -U <user> <db> > dump.txt. Failed characters would show up as '?' so I planned to remove any lines from the text file with a bit of reg exp in notepad++: ^((?!\?).)*$ but the dump file being almost 5Gb was too big for notepad++ to handle. So in steps Powershell and we can do a grep style command: select-string .\dump.txt -pattern "\?" > failed_characters.txt</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">Bear in mind that this will include valid ? characters but it's start.</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">And then split the resultant file because it's too big to load into Notepad. [Taken from <a href="http://stackoverflow.com/questions/1001776/how-can-i-split-a-text-file-using-powershell/14928800#14928800">here</a>]</span><br />
<span style="font-family: inherit;"><br /></span>
<pre style="background-color: #eeeeee; border: 0px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"><span style="font-family: inherit;">$linecount=0;$i=0;Get-Content .\BIG_LOG_FILE.txt | %{ Add-Content OUT$i.log "$_";$linecount++; if($linecount -eq 3000){$I++;$linecount=0}}</span></code></pre>
Anonymoushttp://www.blogger.com/profile/05147604902119329862noreply@blogger.com0tag:blogger.com,1999:blog-6360387417013059640.post-85036483737775463682013-07-13T14:58:00.000-07:002013-07-13T14:58:04.298-07:00create new points table with intersecting line idCREATE TABLE points2 AS<br />
(SELECT point.*, line.lineid as line<br />
FROM point INNER JOIN line<br />
ON ST_Intersects(point.wkb_geometry, line.wkb_geometry));Anonymoushttp://www.blogger.com/profile/05147604902119329862noreply@blogger.com0tag:blogger.com,1999:blog-6360387417013059640.post-54458308148884663442013-01-16T06:01:00.002-08:002013-01-16T06:02:49.318-08:00Allowing json/geojson in IIS7<span style="font-family: YanoneKaffeesatzLight;"><span style="font-size: 20px; line-height: 24px;">Taken from </span></span><strong style="border: 0px; font-family: YanoneKaffeesatzLight; font-size: 20px; font-weight: 300; font: inherit; line-height: 24px; margin: 0px; padding: 0px; vertical-align: baseline;">Muhammad Bilal Awan's post below but pasted here for my own benefit;</strong><br />
<span style="border: 0px; font: inherit; line-height: 24px; margin: 0px; padding: 0px; vertical-align: baseline;"></span><br />
<br />
Open IIS Manager<br />
Display properties for the IIS Server<br />
Click MIME Types and then add the JSON extension:<br />
File name extension: .json<br />
MIME type: application/json<br />
Go back to the properties for IIS Server<br />
Click on Handler Mappings<br />
Add a script map<br />
Request path: *.json<br />
Executable: C:\WINDOWS\system32\inetsrv\asp.dll<br />
Name: JSON<br />
<br />
<br />
And the same applies for geojson of course.<br />
<br />
<a href="http://www.uipress.com/add-json-handler-support-in-iis-7/#.UPax0mKalYh">http://www.uipress.com/add-json-handler-support-in-iis-7/#.UPax0mKalYh</a>Anonymoushttp://www.blogger.com/profile/05147604902119329862noreply@blogger.com0tag:blogger.com,1999:blog-6360387417013059640.post-58374683648145109952012-09-20T03:33:00.002-07:002012-09-20T05:45:09.935-07:00postgresql replication, load balancing and SPOFs<br />
<span style="font-family: Trebuchet MS, sans-serif;">here's article for setting up two pgpools - so no single point of failure (thanks to Nozomi Anazai)</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><a href="http://www.pgpool.net/pgpool-web/contrib_docs/watchdog/en.html">http://www.pgpool.net/pgpool-web/contrib_docs/watchdog/en.html</a></span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="font-family: Trebuchet MS, sans-serif;">here's an article how to set up pgpool to handle replication and load balancing of a postgresql cluster (thanks to Tatsuo Ishii)</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><a href="http://pgpool.projects.postgresql.org/contrib_docs/simple_sr_setting/index.html">http://pgpool.projects.postgresql.org/contrib_docs/simple_sr_setting/index.html</a></span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="font-family: Trebuchet MS, sans-serif;">And here's a great presentation from Tom Fry @ OrdnanceSurvey on their setup (spatial databases this time) using pgPool. No replication duties in this case I think as it's only handling select duties. <a href="http://www.eurosdr.net/workshops/PostGIS/1_Fry_Ordnance_Survey_UK.pdf">Here.</a></span><br />
<br />Anonymoushttp://www.blogger.com/profile/05147604902119329862noreply@blogger.com0tag:blogger.com,1999:blog-6360387417013059640.post-55307953475294878072012-09-19T08:33:00.002-07:002012-09-19T08:33:31.347-07:00Show databases and tables in postgresql<br />
show databases:<br />select datname from pg_database;<br />show tables:<br />\dtAnonymoushttp://www.blogger.com/profile/05147604902119329862noreply@blogger.com0tag:blogger.com,1999:blog-6360387417013059640.post-40192136924647145542012-09-19T07:50:00.000-07:002012-09-19T07:52:24.448-07:00postgres ssh-copy-id: ERROR: No identities found<span style="font-family: Trebuchet MS, sans-serif;">I'm working on hot_standby with postgresql on centos. One thing I got stuck on being a noob at linux was how to create ssh keys for the postgres account.
I was following the <a href="http://blog.3dtin.com/2012/07/26/postgresql-replication-and-hot-standby-in-practic/#comment-606">3dtin blog</a> on postgresql hot_standby and got stuck at the following point; </span><br />
<span style="font-family: Trebuchet MS, sans-serif;">su - postgres </span><br />
<span style="font-family: Trebuchet MS, sans-serif;">ssh-copy-id </span><br />
<ip_of_standby_server><span style="font-family: Trebuchet MS, sans-serif;">
ssh-copy-id: ERROR: No identities found </span></ip_of_standby_server><br />
<ip_of_standby_server><span style="font-family: Trebuchet MS, sans-serif;"><br /></span></ip_of_standby_server>
<ip_of_standby_server><span style="font-family: Trebuchet MS, sans-serif;">Ok, remove that pesky selinux. I believe that's at fault. Set SELINUX in /etc/sysconfig/selinux to disabled. </span></ip_of_standby_server><br />
<ip_of_standby_server><span style="font-family: Trebuchet MS, sans-serif;">su - postgres; pwd should be /var/lib/pgsql </span></ip_of_standby_server><br />
<ip_of_standby_server><span style="font-family: Trebuchet MS, sans-serif;">mkdir .ssh </span></ip_of_standby_server><br />
<ip_of_standby_server><span style="font-family: Trebuchet MS, sans-serif;">ssh-keygen
(hit defaults) </span></ip_of_standby_server><br />
<ip_of_standby_server><span style="font-family: Trebuchet MS, sans-serif;">ssh-copy-id -i ~./ssh/id_rsa.pub </span></ip_of_standby_server><br />
<ip_of_standby_server><ip_of_the_other_server><span style="font-family: Trebuchet MS, sans-serif;">
check with ssh <ip>
So if you do that on the pg_master and drop the key on the pg_slave, you should then repeat the other way (as the 3dtin blog says).</ip></span></ip_of_the_other_server></ip_of_standby_server>Anonymoushttp://www.blogger.com/profile/05147604902119329862noreply@blogger.com0tag:blogger.com,1999:blog-6360387417013059640.post-59040802831771329542012-09-14T02:31:00.000-07:002012-09-20T01:28:18.473-07:00Cluster your PostGIS<span style="font-family: Trebuchet MS, sans-serif;">I've been asked to look at clustering work's PostGIS needs. We've got some OSM which is only used for Mapnik to read and render from so I'm going to ignore that for now. I'm more interested in setting up a PostGIS cluster for user-created content.</span><br />
<div>
<span style="font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Trebuchet MS, sans-serif;">I've found a great PDF presentation from <a href="http://www.eurosdr.net/workshops/PostGIS/8_Bennett_Ordnance_Survey_UK.pdf">Steve Bennett</a> at the Ordnance Survery. Also a great, simple note on clustering Postgresql from <a href="http://pgsnaga.blogspot.co.uk/2010/05/5-steps-to-implement-postgresql.html">Satoshi Nagayasu</a>. I'm in the process of knocking up a simple test cluster so I'll report back.</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br />
<a href="http://eggie5.com/15-setting-up-pg9-streaming-replication">Eggie5's run through of streaming replication looks a brief but solid guide to replication.</a></span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="font-family: Trebuchet MS, sans-serif;">Jyro's tutorial here on 3DTin is wonderful. It pushed this fat-arsed noob all the way through so I've got a master/standby setup running. Something to play with and attempt to break - that's the point right? Tutorial <a href="http://blog.3dtin.com/2012/07/26/postgresql-replication-and-hot-standby-in-practic/">here</a>.</span></div>
Anonymoushttp://www.blogger.com/profile/05147604902119329862noreply@blogger.com0tag:blogger.com,1999:blog-6360387417013059640.post-77267102611157929082012-09-10T08:45:00.002-07:002012-09-10T08:45:28.677-07:00Loading PostGIS with ESRI ShapefilesNote to self:<br />
Use shp2pgsql to create CREATE/INSERT sql;<br />
shp2pgsql -c -D -s 4326 -I <shp file> <table name> > <file output name>.sql<br />
and then follow it up with the lovely;<br />
psql -d <database name> -U <user name> -f <file output name>.sql<br />
This way I've got all that lovely SQL to store somewhere if I need it.Anonymoushttp://www.blogger.com/profile/05147604902119329862noreply@blogger.com0tag:blogger.com,1999:blog-6360387417013059640.post-81479452086412455112012-09-06T08:58:00.002-07:002012-09-18T06:55:58.442-07:00How to get an up-to-date OSM in PostGIS<h2>
<span style="font-family: Trebuchet MS, sans-serif;">How to build an OSM database that is up to date. </span></h2>
<span style="font-family: 'Trebuchet MS', sans-serif;">Rather than doing a quarterly manual job of downloading a 14Gb+ file, decompressing it (250Gb+) and inserting it into a database it will be a lot easier to download daily (50Mb) OSM change files (.osc) and apply the changes to the existing database. </span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span>
<span style="font-family: 'Trebuchet MS', sans-serif;">The instructions below is a modified version of Martin van Exel's tutorial here - https://docs.google.com/document/pub?id=1paaYsOakgJEYP380R70s4SGYq8ME3ASl-mweVi1DlQ4 </span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span>
<span style="font-family: 'Trebuchet MS', sans-serif;"># get osmosis</span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;">su
cd /opt
</span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;">wget http://dev.openstreetmap.org/~bretth/osmosis-build/osmosis-latest.tgz </span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;">tar zxvf osmosis-latest.tgz</span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;">rm -rf osmosis-latest.tgz</span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;"># in my case osmosis-0.41 </span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span>
<span style="font-family: 'Trebuchet MS', sans-serif;"># now pop into PostgreSQL and build a suitable database & user (could be tidier)</span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;">adduser osm </span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;">passwd osm </span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;"># and some badly chosen password: osm, osm</span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;">su - postgres
psql </span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;">createdb osm</span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;">createlang plpgsql osm</span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;">CREATE USER osm WITH PASSWORD 'osm';</span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;"><strike>#CREATE DATABASE osm;</strike></span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;">GRANT ALL PRIVILEGES ON DATABASE osm to osm;</span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;">GRANT ALL PRIVILEGES ON DATABASE osm to postgres;</span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;">\q</span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;">psql -d osm -U osm -f /usr/pgsql-9.1/share/contrib/postgis-2.0/postgis.sql </span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;">psql -d osm -U osm f /usr/pgsql-9.1/share/contrib/postgis-2.0/spatial_ref_sys.sql</span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;">psql -U osm -d osm</span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;">CREATE EXTENSION hstore;</span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;">\q</span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;">psql -U osm -d osm -f /home/<user name>/osm/osmosis-0.41/script/pgsimple_schema_0.6.sql</span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span>
<span style="font-family: 'Trebuchet MS', sans-serif;"># make some directories and get some data</span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;">su
mkdir /tmp/osm </span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;">cd tmp/osm </span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;">mkdir planet</span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;">mkdir planet/replication</span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span>
<span style="font-family: 'Trebuchet MS', sans-serif;"># now get some OSM data - either get the whole planet.. or get a sample from http://download.geofabrik.de/osm/ </span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;">cd /tmp/osm/planet/</span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;">wget http://planet.openstreetmap.org/planet-latest.osm.bz2</span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span>
<span style="font-family: 'Trebuchet MS', sans-serif;"># and thump into the database (using the VERY IMPORTANT --slim option, -C is how much memory we're setting aside for this: 4Gb in this case)
/opt/osm2pgsql/osm2pgsql -S default.style --slim -d osm -C 4000 /tmp/osm/planet/planet-latest.osm.bz2 </span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span>
<span style="font-family: 'Trebuchet MS', sans-serif;"># create the configuration.txt and download.lock </span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;">osmosis --rrii workingDirectory=/tmp/osm/planet/replication </span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span>
<span style="font-family: 'Trebuchet MS', sans-serif;"># create your state.txt file, visit http://toolserver.org/~mazder/replicate-sequences/ and enter details. To check the datetime required examine the contents of the bz2 file. </span><br />
<br />
<pre class="source-code"><span style="font-family: Trebuchet MS, sans-serif;">bunzip2 -c planet-latest.osm.bz2 | head</span></pre>
<br />
<span style="font-family: 'Trebuchet MS', sans-serif;">Now at this point I've been running osmosis to grab the change file and osm2pgsql to throw it at the database but you can apparently run osmosis on it's own;</span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span>
<span style="font-family: 'Trebuchet MS', sans-serif;"># Osmosis on it's own version</span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;">/opt/osmosis-0.41/bin/osmosis --rri workingDirectory=/tmp/osm/planet/replication --sc --wpc user="osm" database="osm" password="osm"</span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span>
<span style="font-family: 'Trebuchet MS', sans-serif;"># Or the two command route - grab a change file from the queue of necessary changes to perform</span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;">/opt/osmosis-0.41/bin/osmosis --rri workingDirectory=/tmp/osm/planet/replication --simplify-change --write-xml-change /tmp/osm/planet/replication/changes.osc.gz</span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span>
<span style="font-family: 'Trebuchet MS', sans-serif;"># And append the changes to the database</span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;">/opt/osm2pgsql/osm2pgsql --append -S /opt/osm2pgsql/default.style -d osm -U postgres --slim /tmp/osm/planet/replication/changes.osc.gz </span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span>
<span style="font-family: 'Trebuchet MS', sans-serif;"># You can put either set of commands into a script and cron it up, here's the script for the osm2pgsql route</span><br />
<br />
<span style="font-family: Trebuchet MS, sans-serif;">#!/bin/sh</span><br />
<span style="font-family: Trebuchet MS, sans-serif;">n=`ps -ef | grep -v grep | grep /opt/osmosis-0.41/ | wc -l`</span><br />
<span style="font-family: Trebuchet MS, sans-serif;">m=`ps -ef | grep -v grep | grep /opt/osm2pgsql/ | wc -l`</span><br />
<span style="font-family: Trebuchet MS, sans-serif;">let i=n+m</span><br />
<span style="font-family: Trebuchet MS, sans-serif;">if [ $i -gt 0 ]; then</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>echo osmosis or osm2pgsql running</span><br />
<span style="font-family: Trebuchet MS, sans-serif;">else</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>echo not running</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>/opt/osmosis-0.41/bin/osmosis --rri workingDirectory=/tmp/osm/planet/replication --simplify-change --write-xml-change /tmp/osm/planet/replication/changes.osc.gz</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>/opt/osm2pgsql/osm2pgsql --append -S /opt/osm2pgsql/default.style -d osm -U postgres --slim /tmp/osm/planet/replication/changes.osc.gz </span><br />
<span style="font-family: Trebuchet MS, sans-serif;">fi</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="font-family: Trebuchet MS, sans-serif;"># Now you're probably running mod_tile and mapnik to render and serve up OSM tiles so we need a method to tell mod_tile to re-render all tiles that have updates. We can amend the osm2pgsql call with -e options to produce a list of tiles that need to be expired and thus re-rendered. [See <a href="http://wiki.openstreetmap.org/wiki/Tile_expire_methods">OSM Tile Expire Methods</a>].</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"># change the osm2pgsql command to read</span><br />
<span class="Apple-tab-span" style="font-family: 'Trebuchet MS', sans-serif; white-space: pre;"> </span><span style="font-family: 'Trebuchet MS', sans-serif;">/opt/osm2pgsql/osm2pgsql --append -S /opt/osm2pgsql/default.style -d osm -U postgres --slim /tmp/osm/planet/replication/changes.osc.gz -e15 -o expire.list</span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span>
<span style="font-family: 'Trebuchet MS', sans-serif;"># We now expire all tiles listed in the expire.list. I haven't included the install and setup of Mapnik or mod_tile so i'm going to use some dummy locations for them. I'm expiring tiles from zoom level 6 and downwards</span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;">cat expire.list | /opt/mapnik/mod_tile/render_expired --map=osm --min-zoom=6 --touch-from=7 >/dev/null</span><br />
<span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span>
<span style="font-family: 'Trebuchet MS', sans-serif;"># The OSM Tile Expire Methods guide also recommends a daily re-render of the lower zoom levels.</span>Anonymoushttp://www.blogger.com/profile/05147604902119329862noreply@blogger.com0tag:blogger.com,1999:blog-6360387417013059640.post-60727822009286530322012-08-29T02:36:00.003-07:002012-09-04T02:40:46.808-07:00Installing PostGIS 2.0 & GeoServer on Centos 6 64bit<br />
Installing PostGIS 2.0 and GeoServer on Centos 6 64bit<br />
<br />
as root;<br />
su<br />
exclude=postgres* in base and update sections of /etc/yum.repos.d/CentOS-Base.repo<br />
curl -O http://yum.postgresql.org/9.1/redhat/rhel-6-x86_64/pgdg-centos91-9.1-4.noarch.rpm<br />
rpm -ivh pgdg-centos91-9.1-4.noarch.rpm<br />
curl -O http://mirror.bytemark.co.uk/fedora/epel/6/x86_64/epel-release-6-7.noarch.rpm<br />
rpm -ivh epel-release-6-7.noarch.rpm<br />
yum install postgresql91-server postgis2_91<br />
yum install postgresql91-contrib.x86_64<br />
<br />
service postgresql-9.1 initdb<br />
<br />
# edit postgres' conf<br />
vi /var/lib/pgsql/9.1/data/postgresql.conf<br />
add listen_addresses = '*'<br />
<br />
# allow some connection, make sure the last one matches your local network if you're doing local network stuff...<br />
vi /var/lib/pgsql/9.1/data/pg_hba.conf<br />
local all all trust<br />
host all all 127.0.0.1/32 trust<br />
host all all 192.168.1.0/24 md5<br />
<br />
# kick postgres<br />
service postgresql-9.1 start<br />
<br />
# run on startup<br />
chkconfig postgresql-9.1 on<br />
<br />
# change the password for the postgres account<br />
passwd postgres<br />
<br />
su postgres<br />
psql<br />
ALTER USER postgres WITH ENCRYPTED PASSWORD 'postgres';<br />
<br />
# extensions time..<br />
CREATE EXTENSION adminpack;<br />
<br />
# spatialise your db<br />
CREATE EXTENSION postgis;<br />
CREATE EXTENSION postgis_topology;<br />
<br />
\q<br />
exit<br />
<br />
# allow incoming connections on 5432 (postgresql standard port)<br />
back to root;<br />
add the following to /etc/sysconfig/iptables above any REJECT rule<br />
-A INPUT -p tcp -m state --state NEW -m tcp --dport 5432 -j ACCEPT<br />
<br />
service iptables restart<br />
<br />
# back to postgres' bash<br />
sudo -i -u postgres<br />
createdb template_postgis<br />
createlang plpgsql template_postgis<br />
psql -d template_postgis -f /usr/pgsql-9.1/share/contrib/postgis-2.0/postgis.sql<br />
psql -d template_postgis -f /usr/pgsql-9.1/share/contrib/postgis-2.0/spatial_ref_sys.sql<br />
psql -d template_postgis -f /usr/pgsql-9.1/share/contrib/postgis-2.0/postgis_comments.sql<br />
psql<br />
CREATE DATABASE my_spatial_db TEMPLATE template_postgis;<br />
\q<br />
exit<br />
<br />
# back to root<br />
# Installing Geoserver<br />
# we need java, java -version says no java<br />
yum install yum-priorities<br />
rpm -Uvh http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm<br />
rpm -Uvh http://mirrors.dotsrc.org/jpackage/6.0/generic/free/RPMS/jpackage-utils-5.0.0-7.jpp6.noarch.rpm<br />
Next we will install Java and Tomcat 6:<br />
yum -y install java<br />
yum -y install tomcat6 tomcat6-webapps tomcat6-admin-webapps<br />
vi /etc/tomcat6/tomcat-users.xml<br />
add a user with roles of admin,manager<br />
chkconfig tomcat6 on<br />
# now to geoserver<br />
cd /home/<user><br />
wget http://downloads.sourceforge.net/geoserver/geoserver-2.1.4-war.zip<br />
unzip geoserver-2.1.4-war.zip<br />
mv geoserver.war /usr/share/tomcat6/webapps<br />
# start up tomcat6<br />
service tomcat6 startexit<br />
# test geoserver at<br />
http://localhost:8080/geoserver/web/<br />
<br />
# and you'll probably want access across your network<br />
iptables -A INPUT -p tcp --dport 8080 -j ACCEPT<br />
/sbin/service iptables save<br />
iptables -F<br />
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/05147604902119329862noreply@blogger.com0tag:blogger.com,1999:blog-6360387417013059640.post-29863353548373110492012-03-14T08:22:00.000-07:002012-03-14T08:22:19.524-07:00Changing an icon in a treepanel extjs 3It took me a while to find a solution - probably a slow head day but here's how;<br />
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.<br />
<br />
the css file;<br />
.failedwms-icon {<br />
background: url('resources/deadwms.gif') no-repeat;<br />
height: 16px;<br />
width: 16px;<br />
}<br />
<br />
in your js code;<br />
'load': function(node){<br />
// if a node receives a response and no layer child nodes are created we want to change the icon<br />
if (node.childNodes) { <br />
if (node.childNodes)<br />
{<br />
if (node.childNodes.length == 0)<br />
{<br />
node.attributes.iconCls = 'failedwms-icon';<br />
node.getUI().iconNode.className = node.attributes.iconCls;<br />
}<br />
}<br />
}<br />
}Anonymoushttp://www.blogger.com/profile/05147604902119329862noreply@blogger.com0tag:blogger.com,1999:blog-6360387417013059640.post-65985384748489824692012-03-07T00:45:00.000-08:002012-03-07T00:45:22.623-08:00compiling OpenLayersGrab it from their github: https://github.com/openlayers/openlayers/zipball/master<br />
<br />
Drop closure-compiler.jar & compiler.jar into openlayers\tools<br />
Go to \build and ... <br />
<br />
build.py -c closure full OpenLayers.js for regular compressed OpenLayers (700kb odd)<br />
buildUncompressed.py full OpenLayers-uncompressed.js for phat Openlayers (2.5Mb odd)Anonymoushttp://www.blogger.com/profile/05147604902119329862noreply@blogger.com0tag:blogger.com,1999:blog-6360387417013059640.post-89979898822021017612012-01-09T03:28:00.000-08:002012-01-09T03:28:02.453-08:00Popularity of WMS InfoFormatsI'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.<br />
<br />
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.<br />
<br />
100% support: html & plain<br />
89% support: ogc xml<br />
67% support: xml<br />
19% support: esri raw xml & esri feature info xml<br />
11% support: ogc gmlAnonymoushttp://www.blogger.com/profile/05147604902119329862noreply@blogger.com0tag:blogger.com,1999:blog-6360387417013059640.post-65047105535818000082011-09-06T12:57:00.000-07:002011-09-06T12:57:39.695-07:00RSS feed of Google Calendar EventsUse the following;<br />
<br />
https://www.google.com/calendar/feeds/[your account]/public/basic?orderby=starttime&sortorder=ascending&max-results=5&futureevents=true<br />
<br />
Now to put it on XBMC. The GF will be impressed.Anonymoushttp://www.blogger.com/profile/05147604902119329862noreply@blogger.com0tag:blogger.com,1999:blog-6360387417013059640.post-21265906461267184662011-07-01T12:50:00.000-07:002011-07-01T12:50:46.271-07:00GIS Technologies - DotSpatialI'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.<br />
<br />
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.<br />
<br />
So DotSpatial. I've only had a half a day but there's plenty of clear tutorials over at <a href="http://dotspatial.codeplex.com/wikipage?title=DotSpatial%20Tutorials&referringTitle=Documentation">DotSpatial Docs</a> 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. <br />
<br />
Loading WMS into a map contol - no simply single layer class yet but a workaround was posted by Ted - <a href="http://dotspatial.codeplex.com/discussions/236245">here</a><br />
<br />
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.Anonymoushttp://www.blogger.com/profile/05147604902119329862noreply@blogger.com0tag:blogger.com,1999:blog-6360387417013059640.post-58720159646584066292011-06-17T04:37:00.000-07:002011-06-17T04:37:11.183-07:00GIS Technologies this year at FOSS4GThis 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.<br />
<br />
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.<br />
<br />
OSM - OpenStreetMap<br />
JOSM - an editor for OpenStreetMap in Java<br />
OSM + PostGIS + QGIS - Data analysis<br />
DotSpatial - Mono/.Net Framework C# GIS library<br />
PostGIS<br />
MapFish - web framework, companion to OpenLayers, GeoExt, GeoAlchemy, Shapely<br />
FormAlchemy / GeoFormAlchemy<br />
Geomajas - a client/server framework, uses GWT<br />
Spatial Data Infrastructure/GeoNetwork/GeoCat Bridge creates metadata<br />
GeoMoose - client framework for MapServer, good on data organisation, data maintenance<br />
pgRouting - routing extension to PostGIS<br />
Geoserver<br />
OpenLayers<br />
Common JavaScript libraries - jQuery UI, ExtJS, Sencha Touch<br />
GeoKettle - ETL tool, GeoMonrian (Spatial OLAP server) and GeoBIExt - all @ spatialytics.org<br />
OGC WFS-T, TinyOWS<br />
GeoExt<br />
MapServer<br />
QGIS<br />
Mapnik, Node.js<br />
i2maps - geocomputational platform, spatial/temporal data (built around OpenLayers and GeoDjango)<br />
GeoNode<br />
NodeJS framework, Polymaps framework - both for back-end<br />
Inkscape - SLD production<br />
Zoo-Project and WPSs (Web Processing Services)<br />
Amazon Web Services - autoscaling, load balancing cluster<br />
Spatial Wiki - Ubuntu, MediaWiki, Apache, Geoserver, OpenLayers, PostGIS<br />
NSDI, GIS in urban planning<br />
Flot plotting library, spatio-temporal modelling - surfaces<br />
HydroDesktop, free GIS for hydrological modeling<br />
Tilecaching, secured WMS, MapProxy<br />
Imposm - imports OSM data into PostGIS<br />
gvSIG Mini - production of PoI data from OSM, map viewer for Android<br />
Flex, OpenScales, NetCDF, AXIIS, Degrafa, SOS, AIS - for Oceanic applications<br />
Mod-geocache - caching server<br />
MapMint - SDI manager<br />
MapQuery, gRaphael (SVG chart library)<br />
TileMill with Mapnik and Carto (map styling language)<br />
Glob3 - 3D framework, suitable for iOD and Android devices<br />
Google Fusion tables > kml for google maps<br />
GDAL<br />
GeoTools - Java GIS library<br />
MapWindow - MS Windows GIS with .Net API<br />
GXP - Javascript library connects to OpenLayers, Ext JS, GeoExt using a JSON configuration.<br />
Tinyows, GeoPrisma, Zoo WPS - part of the MapServer project stack<br />
GeoScript - extends python, javascript, scala, groovy<br />
CartoSet - web map framework, built upon Ruby on Rails framework ‘CartoDB’.<br />
GeoShield - security access-control to OGC services<br />
MapGuide OpenSource Server & Web Extensions<br />
OGC Web Processing Service (WPS), 52 North, Geoserver<br />
OpenAerialMap<br />
Mobile mapping: BeeGIS (uDig ext) and Geopaparazzi<br />
Partitioning Around Medoids clustering algorithm with Grass & R<br />
GeoWebCache<br />
Cartagen Knitter - rectifying aerial imagery<br />
Opticks - open source image processing software<br />
OpenLayers Mobile<br />
Esri Geoportal Server<br />
Web of Things demonstration - SenseBox<br />
WebGL Earth<br />
WCS 2.0<br />
MassMov2D - landslide modelling<br />
libPC & libLAS - point cloud processing<br />
PyWPS<br />
mapnik2geotools<br />
FalconView<br />
Cellular Automata QGIS plugin<br />
GeoCouch, CouchDB<br />
HydroLiDAR<br />
jai-tools<br />
Geomondrian<br />
GeoServer Plugin for the NoSQL Mongo Database<br />
PostGIS Raster support/extension<br />
JTS Topology Suite<br />
HTML5/WebGL<br />
OGC SOS<br />
GeoCommons<br />
GeoExt vs MapQuery vs Legato<br />
Postal Address Geo-Coder (or PAGC)<br />
AcidMaps<br />
JGrass/uDig<br />
Stado<br />
HSLayers - a Openlayers/ExtJS based mapping framework<br />
Neo4j Spatial<br />
MapBender 3<br />
GeoAPI 3.0<br />
GeoCat Bridge - publishing data from ArcGIS to GeoNetwork/Geoserver/MapServer<br />
<br />
and Oracle, FME and ArcGIS Server!Anonymoushttp://www.blogger.com/profile/05147604902119329862noreply@blogger.com0tag:blogger.com,1999:blog-6360387417013059640.post-36427750740528424112011-05-16T09:05:00.000-07:002011-05-19T08:07:29.410-07:00Reproject shapefile for google mapsThis is always a bind in whatever GIS package I seem to use - probably because I forget to concentrate over my projection details. However the easiest way to do it is to use fwtools. Download the pack from fwtools.maptools.org and move your data (in this case a shapefile) to the fwtools directory to make it easier.<br />
<br />
Load up the FWTools Shell and type the following to convert a shapefile from OS National Grid to Google Maps EPSG:900913<br />
<br />
ogr2ogr –f “ESRI Shapefile” –t_srs EPSG:900913 output.shp input.shp<br />
<br />
Load into geoserver and test in a google maps page and you're done.Anonymoushttp://www.blogger.com/profile/05147604902119329862noreply@blogger.com1tag:blogger.com,1999:blog-6360387417013059640.post-34266482676519392142011-02-04T15:08:00.001-08:002011-02-04T15:08:49.902-08:00How to remove apps from Facebookthis might change but the current method of removing apps, as of Feb. 2011, is..<br />
<br />
1- Account (top right hand corner)<br />
2- Privacy Settings<br />
3- Applications and Websites – edit your settings (bottom left corner<br />
4- Applications you use – edit settings<br />
5- click x to remove whatever application wanted to removeAnonymoushttp://www.blogger.com/profile/05147604902119329862noreply@blogger.com0tag:blogger.com,1999:blog-6360387417013059640.post-28080370297553181482011-01-21T16:29:00.000-08:002011-06-10T09:48:41.697-07:00Seeing XP machine from Windows 7 machineI renamed one of my XP machines on my home network and ever since the Windows 7 box has failed to see it.. An unidentified error occurs in windows explorer when trying to access the XP machine (as it is listed) but a different situation arises in command line;<br />
<br />
In command line<br />
net view<br />
returns the XP machine along with all other machines.. good.<br />
net view \\xpmachine<br />
fails with system error 53 message.<br />
<br />
I've tried checking netbios is enabled, firewalls off, ip6 turned off, and a heap load of other things that i've googled on.<br />
<br />
Weirdly NET USE M: \\xpmachine\myfolder /user:myUserName myPassword works and I get a mapped network drive. Once done new view \\xpmachine works.<br />
<br />
But I don't want mapped network drives. I want to access drives by \\xpmachine\myfolder. But I've found that if i enter \\xpmachine into the address bar of windows 7 explorer window it will prompt for user and password. And once done it seems to have stuck and net view \\xpmachine returns the available resources.<br />
<br />
-----------------------------------------<br />
<br />
Well it happened again. I can't believe that what I wrote last time actually worked. If it did then lucky me. This time it took me a while to work out that the clock on both machines must be in sync (to some degree I guess) for windows 7 to be happy. I was doing some work that required me to set the year back to 2010 (#cough) so correcting that back to normal fixed it.<br />
<br />
Honestly, you think network diagnostics were explain that's the reason why the shared folder access fails.Anonymoushttp://www.blogger.com/profile/05147604902119329862noreply@blogger.com0tag:blogger.com,1999:blog-6360387417013059640.post-6605715324086632052011-01-11T15:23:00.000-08:002011-01-11T15:23:26.962-08:00How to convert epub to mobi correctly- Convert epub to epub in Calibre, removing the spacing and margins in the "look and feel" section<br />
- Open the resulting file in Sigil<br />
- edit the stylesheet in Sigil to make sure that all references to "leftmargin" are set to "0"<br />
- save the file in Sigil then open it in Calibre again<br />
- use Calibre to convert to mobi<br />
<br />
Takes about 5 minutes per book. Not a major deal unless you're converting a lot of stuff<br />
<br />
- courtesy of <a href="http://www.eurogamer.net/forum_thread_posts.php?thread_id=63542&start=570">TeleFunken @ EG</a>Anonymoushttp://www.blogger.com/profile/05147604902119329862noreply@blogger.com0tag:blogger.com,1999:blog-6360387417013059640.post-11183794882767768282010-11-23T05:21:00.000-08:002010-11-23T05:21:00.137-08:00Gran Turismo 5 on PS3 - Stuck on logo?Bad huh? Never mind, log out of PSN and then play the game.Anonymoushttp://www.blogger.com/profile/05147604902119329862noreply@blogger.com0tag:blogger.com,1999:blog-6360387417013059640.post-59346300497125140382010-05-06T11:58:00.000-07:002010-05-06T11:58:31.603-07:00Disable Digital Driver Signing in Windows 7Purely a reference for myself, useful if you happen to be running peerguardian for windows 7 or something only slightly more legal - tileproxy for fsx<br />
<br />
http://www.killertechtips.com/2009/05/05/disable-driver-signing-windows-7/Anonymoushttp://www.blogger.com/profile/05147604902119329862noreply@blogger.com0tag:blogger.com,1999:blog-6360387417013059640.post-59534091591243429552010-02-27T11:09:00.000-08:002010-02-27T11:09:37.901-08:00How to use a Belkin Universal Range Extender as an access pointI was given one of these and for the life of me couldn't get it to work. Adding security to the device would cause the web management page to crash and make the device unconfigurable. I discovered that though the security on the belkin causes problems the MAC address rules do. So if you've got the same problem leave the device as an unsecured access point and define your MAC rules. Worked first time.Anonymoushttp://www.blogger.com/profile/05147604902119329862noreply@blogger.com0tag:blogger.com,1999:blog-6360387417013059640.post-60960986467595809922010-02-10T15:31:00.000-08:002010-02-10T15:31:28.403-08:00Streaming video onto your iphone or pspFor psp you'll need custom firmware, one that'll run 1.5 homebrew - run over to <a href="http://pimpware.org">pimpstreamer</a> and get going. You'll have to muck about with the conversion rates if your wifi is a little bit slacky.<br />
<br />
For iphone I'll recommend <a href="http://www.inmethod.com/air-video/index.html">Air Video</a>. Works a treat and you won't have to convert all your nice avi files. It'll convert on the fly - on a dual core machine or higher. Runs fine with my little HP 3020 Slimline PC and that's something like a AMD x2 3800+ if memory serves me right.Anonymoushttp://www.blogger.com/profile/05147604902119329862noreply@blogger.com0