Archive

Archive for July, 2008

Using GDALWARP to reproject raster that will fit with Google Satellite

July 29th, 2008 rupert Comments off

Just a couple of notes to onself using gdal: Use gdalwarp to reproject your GeoTIFF files! I wanted to use my own satellite images acquired from GeoEye, however, on some areas I wanted to use google sat images as well since I don’t have the coverage. In order to do so, I need to reproject the sat images to 900913. Note you need to specify this in your epsg file in my previous post.

rupert:beijing_900913_satellite rupert$ gdalinfo Mosaic_RGB.tif
Driver: GTiff/GeoTIFF
Files: Mosaic_RGB.tif
Size is 4248, 4553
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.2572235630016,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
Origin = (116.291476140000000,40.025198500000002)
Pixel Size = (0.000046860000000,-0.000035970000000)
Metadata:
  AREA_OR_POINT=Area
  TIFFTAG_XRESOLUTION=100
  TIFFTAG_YRESOLUTION=100
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  ( 116.2914761,  40.0251985) (116d17'29.31"E, 40d 1'30.71"N)
Lower Left  ( 116.2914761,  39.8614271) (116d17'29.31"E, 39d51'41.14"N)
Upper Right ( 116.4905374,  40.0251985) (116d29'25.93"E, 40d 1'30.71"N)
Lower Right ( 116.4905374,  39.8614271) (116d29'25.93"E, 39d51'41.14"N)
Center      ( 116.3910068,  39.9433128) (116d23'27.62"E, 39d56'35.93"N)
Band 1 Block=4248x1 Type=Byte, ColorInterp=Red
Band 2 Block=4248x1 Type=Byte, ColorInterp=Green
Band 3 Block=4248x1 Type=Byte, ColorInterp=Blue
rupert:beijing_900913_satellite rupert$ gdalwarp -s_srs epsg:4326 -t_srs epsg:900913 Mosaic_RGB.tif sat_4m_rgb.tif
Creating output file that is 4245P x 4556L.
Processing input file Mosaic_RGB.tif.
0...10...20...30...40...50...60...70...80...90...100 - done.
rupert:beijing_900913_satellite rupert$ gdalinfo sat_4m_rgb.tif
Driver: GTiff/GeoTIFF
Files: sat_4m_rgb.tif
Size is 4245, 4556
Coordinate System is:
PROJCS["Google Maps Global Mercator",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.2572235630016,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Mercator_1SP"],
    PARAMETER["central_meridian",0],
    PARAMETER["scale_factor",1],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]]]
Origin = (12945507.907502911984921,4869604.732793668285012)
Pixel Size = (5.219801430503303,-5.219801430503303)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (12945507.908, 4869604.733) (116d17'29.31"E, 40d12'53.10"N)
Lower Left  (12945507.908, 4845823.317) (116d17'29.31"E, 40d 3'2.78"N)
Upper Right (12967665.965, 4869604.733) (116d29'25.89"E, 40d12'53.10"N)
Lower Right (12967665.965, 4845823.317) (116d29'25.89"E, 40d 3'2.78"N)
Center      (12956586.936, 4857714.025) (116d23'27.60"E, 40d 7'58.12"N)
Band 1 Block=4245x1 Type=Byte, ColorInterp=Red
Band 2 Block=4245x1 Type=Byte, ColorInterp=Green
Band 3 Block=4245x1 Type=Byte, ColorInterp=Blue

MacOSX Utilities: iTerm + MarsEdit

July 29th, 2008 rupert Comments off

Just a quick note before I go home tonight…

1. Replace your current terminal with iTerm.

2. MarsEdit rocks! Ive been posting lazy and all but with this blog client at hand.. blog posting is easier. Way way better compared to ecto!! (IMHO).

Categories: mac, osx Tags: ,

Installing Chinese Font for Mapserver

July 28th, 2008 rupert Comments off

We wanted to use a different font for mapserver which is Microsoft Yahei instead of zysong. Apparently, mapserver have some issues with path problems or with the ttf having more than one word as a font name.

Thanks to Martin Hosken’s perl modules for fonts, we were able to rename the Microsoft Yahei TTF to msyh.ttf.

1. Download: (a) Font-TTF-0.45 (b) Font-TTF-Scripts-0.11.1

2. Unzip

#perl Makefile.pl
#make
#make install

3. ttfname

rupert:Desktop rupert$ ttfname
Usage:
ttfname [-f "full_name"] -n "name" [-t num] [-q] infile.ttf outfile.ttf 
Renames the TTF with the given name and outputs the newly named font to out.ttf.
Options:
      -f "name"   specifies new full name (optional) as opposed to the
                  default calculated form.
      -l lang     language number to use (default all langs)
                  if specified name entries will be added for all platforms and
                      encodings covered by the cmap if not already there
      -n "name"   specifies new font family name (not optional)
      -q          disable signon message
      -s filename overrides -n and gets string from file. Useful for -t
      -t num      overrides the normal naming areas to change another
                  string -f becomes inactive.
#ttfname -f "Microsoft YaHei" -n "msyh" Microsoft\ YaHei.ttf msyh.ttf

Picture 1.png

Categories: china Tags: ,

Postgres Clients Update: Navicat and EMS

July 28th, 2008 rupert Comments off

Picture 4.png

Navicat already produced some lite (free) versions for Postgres both for Windows and Mac. Browse over the feature matrix to find out which version works for you. Note that all versions allow you to edit the record which I can’t do in pgadmin3.

Picture 3.png

A quick look at EMS on Windows (VMWare) is also a note worthy client. Though the MDI interface is a bit complex, one good feature is to able to see your spatial geometry as text and the corresponding SRID immediately…

Picture 1.png

Picture 2.png

Categories: osx, postgres Tags: , ,

Installing Oracle11g x64 on CentOS5

July 26th, 2008 rupert Comments off

FOR EDITING.. This is just a couple of notes from my Oracle testing a few weeks back that I forgot to post..

A. Installing

1. Check for rpm packages:

rpm -q binutils compat-db control-center gcc gcc-c++ glibc glibc-common gnome-libs libstdc++ libstdc++-devel make pdksh sysstat xscreensaver libaio openmotif21 elfutils-libelf libaio-devel libgcc

NOTE: For 10g, you need libXp.so.6 installed. It seems the oracle installer is messed up with some i386 modules pointing to x86? Anyway, I was able to resolve the problem by installing the libXp.i386.rpm version.

2. install the necessary rpm packages:

rpm -ivh compat-db-4.2.52-5.1.x86_64.rpm 
rpm -ivh libgnome-2.16.0-6.el5.x86_64.rpm 
rpm -ivh sysstat-7.0.0-3.el5.x86_64.rpm 
rpm -ivh libaio-devel-0.3.106-3.2.x86_64.rpm 
rpm -ivh lm_sensors-2.10.0-3.1.x86_64.rpm
rpm -ivh beecrypt-devel-4.1.2-10.1.1.x86_64.rpm elfutils-devel-0.125-3.el5.x86_64.rpm net-snmp-devel-5.3.1-19.el5.x86_64.rpm elfutils-devel-static-0.125-3.el5.x86_64.rpm net-snmp-5.3.1-19.el5.x86_64.rpm net-snmp-libs-5.3.1-19.el5.x86_64.rpm

3. vim /etc/profile

ORACLE_BASE=/opt/oracle/product
ORACLE_SID=csdbora
ORACLE_HOME=/opt/oracle/product/11.1.0/db_1
 
export ORACLE_BASE ORACLE_SID ORACLE_HOME
 
PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib

4. Create oracle Account

groupadd oinstall
groupadd dba
useradd -m -g oinstall -G dba oracle
id oracle

uid=501(oracle) gid=501(oinstall) groups=501(oinstall),502(dba)

5. Run modify_kernel.sh

cat >> /etc/sysctl.conf << EOF
kernel.shmall = 2097152
kernel.shmmax = 1073741824 
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1025 65000
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.core.rmem_max = 262144
net.core.wmem_max = 262144
EOF

6. vim /etc/sysctl.conf and comment kernel.shmall and kernel.shmmax because if
you don’t then we will have double results

7. /sbin/sysctl -p

8. Create Directories:

mkdir -p /u01
mkdir -p /opt/oracle
mkdir -p /opt/oracle/product
chown -R oracle:oinstall /u01
chown -R oracle:oinstall /opt/oracle
chmod -R 755 /u01
chmod -R 755 /opt/oracle
chmod -R 755 /opt/oracle/product

9. Run sh -v modify_shelllimits.sh

10. Add the ff lines in /etc/pam.d/login
session required /lib/security/pam_limits.so
session required pam_limits.so

11. cp -rf /home/installers/linux.x64_11gR1_database.zip /opt/oracle

12. chown oracle:oinstall /opt/oracle/linux.x64_11gR1_database.zip

13. Clost all terminals and logout as root from desktop.

14. Login as oracle

15. Follow tutorial until installing oracle
Installing Oracle 11g on CentOS under VMWare on a Macbook.doc

To extract: cpio -idmv < 10201_database_linux_x86_64.cpio

vim /etc/redhat-release
Redhat 4

16. Run the 2 scripts after the dialog:

[root@cs5ora11g db1]# sh root.sh
Running Oracle 11g root.sh script…

The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /opt/oracle/product/11.1.0/db1

Enter the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin …
Copying oraenv to /usr/local/bin …
Copying coraenv to /usr/local/bin …

Creating /etc/oratab file…
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
Finished product-specific root actions.

17. Open your firewall to 1158

18. Go to https://192.168.1.155:1158/em

- Login as SYSMAN:[password] (nickname+wife)

19. Install Oracle Instant Client for your distro [MacOS]

http://www.oracle.com/technology/software/tech/oci/instantclient/index.html

a. Add exports to runsqlplus.sh
b. copy tnsnames.ora from centos to mac
c. add in firewall: 1521
d. sh runsqlplus.sh

20. do sqlplus
Enter user-name: SYSMAN@cybersof
Enter password:

Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>

You are now connected successfully.

21. Check for oracle processes: ps -ef | grep ora

SQLPLUS DBINSTANCE:
oraclecybersof (LOCAL=NO)
 
 
ORACLE LISTENER:
/opt/oracle/product/11.1.0/db1/bin/tnslsnr LISTENER -inherit
 
ORACLE ENTERPRISE MANAGER:
oracle   14487     1  0 15:37 ?        00:00:00
/opt/oracle/product/11.1.0/db1/perl/bin/perl
/opt/oracle/product/11.1.0/db1/bin/emwd.pl dbconsole
/opt/oracle/product/11.1.0/db1/cs5ora11g_csmlcc/sysman/log/emdb.nohup
oracle   14511 14487  2 15:37 ?        00:00:36
/opt/oracle/product/11.1.0/db1/jdk/bin/java -server -Xmx512M
-XX:MaxPermSize=1024M -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40
-DORACLE_HOME=/opt/oracle/product/11.1.0/db1
-Doracle.home=/opt/oracle/product/11.1.0/db1/oc4j
-Doracle.oc4j.localhome=/opt/oracle/product/11.1.0/db1/cs5ora11g_csmlcc/sysman
-DEMSTATE=/opt/oracle/product/11.1.0/db1/cs5ora11g_csmlcc
-Doracle.j2ee.dont.use.memory.archive=true
-Djava.protocol.handler.pkgs=HTTPClient
-Doracle.security.jazn.config=/opt/oracle/product/11.1.0/db1/oc4j/j2ee/OC4J_DBConsole_cs5ora11g_csmlcc/config/jazn.xml
-Djava.security.policy=/opt/oracle/product/11.1.0/db1/oc4j/j2ee/OC4J_DBConsole_cs5ora11g_csmlcc/config/java2.policy
-Djavax.net.ssl.KeyStore=/opt/oracle/product/11.1.0/db1/sysman/config/OCMTrustedCerts.txt-Djava.security.properties=/opt/oracle/product/11.1.0/db1/oc4j/j2ee/home/config/jazn.security.props
-DEMDROOT=/opt/oracle/product/11.1.0/db1/cs5ora11g_csmlcc
-Dsysman.md5password=true -Drepapi.oracle.home=/opt/oracle/product/11.1.0/db1
-Ddisable.checkForUpdate=true
-Doracle.sysman.ccr.ocmSDK.websvc.keystore=/opt/oracle/product/11.1.0/db1/jlib/emocmclnt.ks
-Dice.pilots.html4.ignoreNonGenericFonts=true -Djava.awt.headless=true -jar
/opt/oracle/product/11.1.0/db1/oc4j/j2ee/home/oc4j.jar -config
/opt/oracle/product/11.1.0/db1/oc4j/j2ee/OC4J_DBConsole_cs5ora11g_csmlcc/config/server.xml

22. Set Oracle Environment

# su - oracle
# vim ~/.bash_profile
ORACLE_BASE=/opt/oracle/product
ORACLE_SID=cybersof
ORACLE_HOME=/opt/oracle/product/11.1.0/db1
export ORACLE_BASE ORACLE_SID ORACLE_HOME
 
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib

23. Shutdown and Startup of Oracle

$ . oraenv
<enter your SID>
 
$ sqlplus "/ as sysdba"
SQL> startup
SQL> exit
 
$ lsnrctl
LSNRCTL> start
LSNRCTL> exit
 
$ cd $ORACLE_HOME/bin
./emctl start dbconsole

B. Creating Users

Login to https://192.168.1.155:1158/em
username:sysman
password: [nickname+wifey]
connect as “sysdba”

1. Creating admin user:

http://download.oracle.com/docs/cd/B28359_01/server.111/b28301/admqs_administer_users.htm#CHDBDBGI

em > Setup > Administrators > Create

2. Create appdev user:
em > Server > Roles

http://download.oracle.com/docs/cd/B28359_01/server.111/b28301/admqs_administer_users.htm

CREATE USER "APPDEV" PROFILE "DEFAULT" IDENTIFIED BY "*******" DEFAULT TABLESPACE "USERS" TEMPORARY TABLESPACE "TEMP" ACCOUNT UNLOCK
GRANT UNLIMITED TABLESPACE TO "APPDEV";
GRANT "CONNECT" TO "APPDEV";
GRANT "RESOURCE" TO "APPDEV";

Picture 1.png

Part II. Installing Oracle10g on CentOS5

1. Choose Advanced Installation”

Picture 1.png

2. If its just network prerequisite.. ignore it. It’s not a big deal.

Picture 2.png

3. ORACLE_HOME: /opt/oracle/product/10.2.0/db_1

Picture 3.png

4. ORACLE_SID: orcl, CHARSET: utf8

Picture 4.png

5. EM Installed…

Picture 6.png

6. ISQLPLUS

Picture 7.png

7. Run root.sh

Picture 9.png

output…

Picture 8.png

8. Other settings

Picture 10.png

9. Oracle Environment Variables

Picture 12.png

Categories: oracle Tags: , ,