Monday, August 23, 2010

debian : locales problem

export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8
dpkg-reconfigure locales

Monday, August 9, 2010

debian : choosing java VM

update-alternatives --config java
update-alternatives --config javac

Saturday, August 7, 2010

OpenStreetMap+PostGIS+Geoserver in Ubuntu

After a fresh install one needs to create access to PostgreSQL. Use the instructions
in https://wiki.ubuntu.com/PostgreSQL

Create the database "osm"
createdb osm

Prepare the database
psql osm -c "ALTER TABLE spatial_ref_sys OWNER TO acizmeli"
psql osm -c "ALTER TABLE geometry_columns OWNER TO acizmeli"
psql -d osm -f /usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql
(debian) psql -d osm -f /usr/share/postgresql-8.3-postgis/lwpostgis.sql
(debian) psql -d osm -f /usr/share/postgresql-8.3-postgis/spatial_ref_sys.sql
createlang plpgsql osm


Enable the projection SRS 900913 in PostGIS (Spherical Mercator)
wget http://svn.openstreetmap.org/applications/utils/export/osm2pgsql/900913.sql
psql -f 900913.sql osm

Downlod the OSM data files (for Turkey)
http://downloads.cloudmade.com/asia/turkey#downloads_breadcrumbs

Download the world coastline database (as described in http://wiki.openstreetmap.org/wiki/Mapnik)
wget http://tile.openstreetmap.org/world_boundaries-spherical.tgz (50 MB)
wget http://tile.openstreetmap.org/processed_p.tar.bz2 (357 MB)
wget http://tile.openstreetmap.org/shoreline_300.tar.bz2 (48 MB)
wget http://www.naturalearthdata.com/download/10m/cultural/10m-populated-places.zip (1.5 MB)
wget http://www.naturalearthdata.com/download/110m/cultural/110m-admin-0-boundary-lines.zip (38 KB)

Extract the Marmara region from the high resolution land polygon and assign the missing projection information "EPSG:3785"
ogr2ogr -s_srs "EPSG:3785" -a_srs "EPSG:3785"  -where
"tile_x >= 228  AND tile_x <= 233  AND tile_y >= 248 AND tile_y <= 251"
Marmara_land_polygon_EPSG_3785.shp processed_p.shp     

Edit the OSM data in JOSM and fix the following features :
* Give the Küçükçekmece dam the attribute landuse=reservoir
* Create the polygon for the Durugöl dam (which did not exist)   

Import the OSM data in PostGIS osm2pgsql -d osm OSM/turkey.osm     

Worked the coastline edges of the mahalle polygons in OpenJump for it to match
those of Marmara_land_polygon.

A shapefile output from OpenJump does not put projection info in the output file.
To set it manually : 

ogr2ogr -a_srs EPSG:900913 mahalle_EPSG_900913_reworked.shp /WIN_C/Users/user/Desktop/mahalle_EPSG_900913_reworked.shp   

gdalwarp -wo SOURCE_EXTRA=125 -srcnodata "11 10 50"
-dstalpha  -t_srs '+proj=ortho +datum=WGS84' geoworld.tif ortho.tif   

Saturday, July 24, 2010

MicroSD adapter mounted read-only in Ubuntu Lucid

Try to remount it with the command :

sudo mount -o remount,rw /dev/mmcblk0p1 /media/microSD/

Thursday, July 22, 2010

installing a downloaded R source package file

From within R :

If the destdir argument is used, the downloaded packages are not deleted after the installation (or if the compilation fails) :
> install.packages("rJava", dep = T, destdir = "/home/user/Downloads/") :

If the compilation fails, one can get back later on the process by specifying the source file on disk :
> install.packages("/home/user/Downloads/rJava_0.8-4.tar.gz", repos=NULL)

Thursday, June 24, 2010

Shrinking Vista Partition

The "Shrink Volume" option of "Computer Management" tool in Windows Vista would not shrink as much as you want it to. To improve the situation, one can download the trial version of PerfectDisk Professional and perform 3 different types of defragmantation :

  • Consolidate Free Space
  • Boot Time defragmentation
Especially the latter is valuable as it is able to move Vista's normally unmovable system files, substantially (though not optimally) increasing the amount of volume to be gained from the shrink operation. More info is available.