It’s Khayer, Bangladesh


POI Finding using Google map and PostGIS

Google map and PostGis both are very nice tools for GIS application development. PostGis is an Open Source spatial database which support almost every spatial operation. We can give unique features in web application by combining Google Map and PostGis.
GmapPostGis
I want to developed an web page where use input an lat/lon of a location and distance. Then the application search all the POI(points) within this buffer an display them in Google map. I have a shape file in ESRI format shape file.

In above scenario, we can give the solution very easily using google map and PostGis. To do that, first we need to import shape file to PostGis. Secondly, have to make a PostGis query based on point and buffer area.Then will display query result in the Google map. Check the below link,

Click Here

Another post in this blog i have described how to import shape file to postgis. Please check this,

Click Here

PostGis have a set of GIS function. You can read the PostGis manual. we have to use ST_Buffe and ST_INTERSECTION to implement our requirement. We will create a max extend box by giving the distance parameter of the ST_BUFFER. Then we intersect this box with our point map in the database. Below is the SQL,

SELECT gid, landmark_n, groupcode, lat, lon, the_geom
FROM landmark
WHERE the_geom && ST_Buffer(ST_GeomFromText(‘POINT(90.4142 23.7948)’), .01)

Here the landmark is our PostGis map table. Using && we make intersection with buffer box. Our input point lng/lat is 90.4142,23.7948(Gulshan-1, Dhaka).We make .01 unit buffer area.

This SQL will return landmarks information with Lat/Lng. Now we need to display this points using Google Map. This not a very challenging task. There are many simple example available in the web to that. Check the below links,
Click Here

If this article do any help to you, please make comments.

Thanks,
Khayer
GIS Programmer, CEGIS
Bangladesh.



Creating Database and Importing Shape file in PostGis

Postgis is the next generation database. The popularity increase rate of postgis is very sharp. I first used the postgis when it is an university project. Now it become very stable. In this article i will describe the procedure of importing ESRI Shape file into the PostGIS.

At first we need to create an database with spatial support. To do than, open pgAdmin III and login the PostGreSql. Now right click in the Database and select new database. Create a new database name testgis with postgis templete.
postgisDBCrete

Then create new schema(table) named roads in public domain.

Now we import the shape file into the testgis. PostGreSql have an utility known as shp2pgsql. we need to convert shape file to spitial sql using that tools.

Follow below step to do that,
1. open command promt
2. # cd C:\Program Files\PostgreSQL\8.4\bin
3. # shp2pgsql c:\roads.shp public.roads > roads.sql

Finally import the dump to postgis database,
# psql -d testgis -U postgres -f roads.sql

Now shape file in imported. We can test the map using qgis.
Khayer
GIS Programmer, CEGIS
Bangladesh
khayer.wordpress.com



My Sony Ericsson s312 internet setting

se-s312

I am great fan of Sony Ericsson. Mainly I use mobile for internet access. After losing my k550 in sea in last cox’s Bazar tour, i decided to buy new SE phone. Then i brought SE S312 for its nice design and low price. But it confused me a lots when i found that there was no CD and data cable with the mobile. I downloaded latest PC suite from SE site but the PC suite can not recognize my S312 mobile. I called GP and SE service center for help. Unfortunately they can not do so much for me.  How can i use this phone as modem?

At last, i have got the solution with the help of my colleague. I have to follow below steps,

1. Call mobile service proveder for internet setting(Wap & internet setting is  not same) of the phone.

2. Download USB driver for s312 from here.

3.Install the Driver. Follow the instruction. Do not connect mobile with cable until prompt by installer.

4. After successfully installing the driver, check the phone modem.
Right Click My Computer>Hardware>Device Manager>Modems
If your day is not bad, You will get Sony Erricsson Mobile Device modem

5. Right click Sony Erricsson Mobile Device, click Diagnostics Tab, then click query Modem
Modem will response it status.

6. Then click Advance. Write belows Extra Setting to Connect with Grameen Phone(Banladeshi Mobile Operator).

AT+cgdcont=1,”ip”,”gpinternet”

Here “gpinternet” is the APN name of the Grameen phone. For other operator, you have to know the APN name of the mobile operator.

7. Click Okay.

8. Go Control Pannel>Network Setting >Create New Connection

9. Create a new connection with *99***1# or *99# dialing number(For Grameen phone). This number can be different depending on mobile operators. It’s is better if you take help from corresponding mobile operator’s customer care to create a new connection.

10. Then connect the PC to the internet.

11. Thanks  good, it save my phone from dumping.
This setting is also helpful for w302(No CD & Cable Package). For w302, you need to download USB-Modem driver form SE Service Center.

For more information about GPRS internet Setting click here.

Please write comment below if this post do any help for you.

Thanks
Abul Khayer
GIS Programmer,
CEGIS,
Bangladesh.



BDMapper for OSGEO Mapserver

OSGeo Mapserver (Previous UNM Mapserver) is a very strong opensource tools for web based GIS mapping. It is support all of the server side language like PHP, Perl and JSP. It can render map from ESRI Shape file, Wms, Spitial Database, Raster and others popular format.

For a begainer, it is very easy to display a hello world map. But for industry use, programmers need to use framework like GMap, Kmap, Openlayer and so on. The Gmap map is a nice tool which is written in PHP. Unfortunately, there is no regular update for GMAP. Besides, OpenLayer is a javaScript API for using Mapser server. But all of available framework are little bit complex to work. They require major changes for minor modification.

I have got chances to work with .NET component of mapping like ASP Map, Map Object (Desktop Application), SharpMap (Opensource) and MapWindowGIS (Opensource). They need small number of line code for creating mapping tool. All the time I am waiting for a Mapserver framework to work like .NET component. Unfortunately most of the Mapserver developer are very high skill, so they can not realize my simple requirement. At last I decided to write a viewer using phpMapscript only for use myself. I gave the viewer name BDMapper.

BdMapper_Home2

-Live Demo of BDMapper
-Source Code of BDMapper

BDMapper has developed using PHPMapscript, Mysql and Java Script. Some functions of GMAP are exteded here. User can create a mapping tool with writing some lines of code. But the main objective of BDMapper development is to easy enhancement with other application and easy modification.

BdMapper_Zoom

BdMapper_Ident

If you want to use BDMapper, the first thing you need to install the BDMapper demo in your local machine. You should follow below steps to run the demo in your local machine,

Installing Mapserver
Download mapserver form mapserver.org. To install the OSGeo mapserver, follow the installation guide. For BD mapper some extra configuration is recommended.

Apache Configuration (httpd.conf):
- Add temp director alias. Here is my local machine setting for temp directory

## Alias for MapServer tmp directory
##
Alias /ms_tmp/ “c:\OSGeo4w/tmp/ms_tmp/”

- Create a folder named ms_tmp in “c:\OSGeo4w/tmp/” directory.
####

** PHP Configuration (php.ini):
- Load PHP MapScript Extension
extension=php_mapscript.dll
- Load PHP_dbase Extension
extension=php_dbase.dll

Restart Apache service.

BD Mapper Demo Installation
- Download Source from here
- Unzip Source and copy in Apache hottdocs root directory
- Dirrctory Descrioption

/classes Main              Class Modules
/data_files                    Map Shape Files
/Documentation       Help and Documentation
/images                         Default Images
/JS                                  JS API

- Change tha MySQL Connection Paramere in Class/clsUmnMapDB.php
if(!($dbCon=mysql_connect(“localhost”,”root”,”cegis”)))
- Check the default map file (testMap.map) parameters. Extends parameter set a dummy value. Please keep extends value unchanged.

Mysql Database Creation
- Install Mysql 5 or higher
- Restore mysql dump using Mysql GUI Administration tools from Doccumentation\bdmapper 20090616 1619.sql file.

- Make sure that the Connection paramert in class/clsUmnMapDB.php is updated.

Description of the Main pages:

bdmapper.php:
This the main page of the viewer. There the MapID is hard coded to 102. Currently two map date created as example in Mysql database. You should assign this value dynamically. Program use a default map testMap.map. In every post back program store its view state crating temporary (tmp123.map) map in current directory.

testMap.map:
Default Map for the BDMapper.

clsUmnMap.php:
Main Mapping module.

clsUmnMapDB.php:
Data Access Layer of the program

clsGenFunc.php:
Collection of general use functions.

Please read the Doccumentation/Doccumentation.pdf carefully before any modification of the code.

I have published this script without any restriction. You are free to use this script in your product. You just need to acknowledge me.

Sample GIS Data (/data_files) are not available with the source code. You can mail me for the sample data.

Please give your feedback if this post is helpful.

Thanks,
Md. Abul Khayer
GIS Programmer,
CEGIS, Bangladesh.
Khayer.wordpress.com
Khayer117@yahoo.com



Resize VMWare Guest OS Disk Space
April 26, 2009, 5:24 pm
Filed under: VMWare | Tags: , ,

VMWare is a nice tool for developers to test Works. I have to use VMWare
very Frequently. But almost time I make same mistake. When I create
Virtual Machine, most of time I try to save my disk space creating smaller
size Virtual Machine. But I have to face trouble when my Guest OS promt me Low disk space.

We can increate Gust OS disk size applying some techniques. We can follow
below steps,

Resizing VMWare Virtual Disk Size
a. Turn Off Virtual Machine
b. Open Run
d. Write CMD
e. CD to C:\Program Files\VMware\VMware Workstation
f. Ran the command,
vmware-vdiskmanager -x 12GB “D:\VMWare_Image\WinxpSP2\Windows XP Professional.vmdk”

But this is not the End. The command only create space but it is now unallocated stage. For windows Guest OS we can use Disk Part ion Utilities like Partition Masic tools to extend Disk space or create new disk. I personally preffer EASEUS Partition Master which is free.

unluckily we have to do more for linux Guest OS. we should follow bellow steps,

(I test all command in RH4 Enterprise)

Create Partition from Unallocated Space
1.  Open Terminal
2. Check Current Disk Status
#> df -m
2. write command
#>parted

Parted is build in utilites of Redhat. Check the Links for manual

#(parted) print
Disk geometry for /dev/sda: 0.000-15360.000 megabytes
Disk label type: msdos
Minor    Start       End     Type      Filesystem  Flags
1          0.031   9209.135  primary   ext3        boot
2       9209.136  10236.730  primary   linux-swap

Notice that some unallocated spare exist. Now we will create new disk,

#(parted) help
#(parted) mkpartf logical ext3 10236.731 15359.018
# quit

At this moment we like to format the new disk in ext3

#>  fdisk -l
#> mkfs.ext3 /dev/sda3
#> fdisk -l

Then the new disk need ot mount to a folder. It’s better to add new
entry in /etc/fstab for permanent mount at boot time.

#> gedit /etc/fstab
Add the new line
###
/dev/sda3                /NewDocsFolder        ext3    defaults    1 1
####

Now the final task, Please restard the computer and check
#> df -m

————————
Khayer ,
GIS Programmer,
CEGIS, Dhaka, Bangaldesh



Installing Oracle 10g in RH4 Enterprise
April 15, 2009, 12:42 pm
Filed under: ORACLE | Tags: ,

1. Checking System
a. Host File:
edit /etc/hosts file, add following entry if not exit


127.0.0.1 localhost.localdomain localhost

Notes: there is a blank enter after the line, otherwise this setting will not effective.
Its better just restart the machine

b. Space:

# df -m
Oracle need at least 2GB

c. RMP:

The following packages (or later versions) must be installed:
Red Hat Enterprise Linux 3.0 and 4.0,
make-3.79.1
gcc-3.2.3-34
glibc-2.3.2-95.20
compat-db-4.0.14-5
compat-gcc-7.3-2.96.128
compat-gcc-c++-7.3-2.96.128
compat-libstdc++-7.3-2.96.128
compat-libstdc++-devel-7.3-2.96.128
openmotif21-2.1.30-8
setarch-1.3-1

2. Directory and user Create

a. Enter the following commands to create the oinstall and dba groups:
# /usr/sbin/groupadd oinstall
# /usr/sbin/groupadd dba

b. If the oracle user exists, but its primary group is not oinstall or it is not a member of the dba group, then enter the following command:

# /usr/sbin/usermod -g oinstall -G dba oracle

If the oracle user does not exist, enter the following command to create it:
# /usr/sbin/useradd -g oinstall -G dba oracle

Here, g=primary group, G=Secondary Group
c. Directory

#cd /
#mkdir orahome
#cd orahome
#mkdir home
#mkdir base
#chown -R oracle:oinstall orahome

#mkdir database

Copy the oracle database software in database directory form the media CD.

#chmod 777 database

3. Bash Profile
#gedit /home/oracle/.bash_profile

Add following text in bash profile


export ORACLE_HOME=/orahome/home
export ORACLE_BASE=/orahome/base
TEMP=/tmp
TMPDIR=/tmp
export TEMP TMPDIR

PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/s:bin
export PATH
unset USERNAME

4. Kernel parameters

To see all kernel parameters, execute:
#sysctl -a

#gedit /etc/sysctl.conf

Add following setting,


kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
rmem_default = 262144
rmem_max = 262144
wmem_default = 262144
wmem_max = 262144

Notes: If exiting value is grater than above value just remain this entry.

Adding these lines to the /etc/sysctl.conf file will cause the system to change these kernel parameters after each boot using the /etc/init.d/bootmisc script which is invoked by /etc/inittab. But in order that these new added lines or settings in /etc/sysctl.conf become effective immediately, execute the following command:
Configuring kernel parameters:
#sysctl -p

5. Start Installer
Logout root user and Login to oracle user (GUI mode). Then start Oracle Universal Installer, enter the following command:
#cd database
# ./runInstaller
If the Environment value is properly provided, oracle installer automatically set the installation Directory.

Then just follow the installer direction. Its better that fist time do not create database. Install only oracle home.
Tips: oracle installer prompts to execute two scripts at the end of the installation. Using su root, run these two scripts.

6. Checking Oracle
#sqlplus /nolog
Or
#cd /orahome/home/bin
#./sqlplus /nolog

7. Creating Database
Login as oracle user in GUI mode
a. Run Listener
#lsnrctl start
Or
#cd /orahome/home/bin
#./ lsnrctl start
b. Run DBCA
#dbca
Or
#cd /orahome/home/bin
#./dbca

8. User Database
Suppose databsae Instance name is KHDB
#export ORACLE_SID=KHDB;
sql>sqlplus /nolog;
sql>conn /as sysdba;
sql>startup;

For shutdownig oracle
sql>shutdown immediate;

Welcome oracle in Redhat.
######################################################
Md. Abul Khayer
GIS Programmer, CEGIS



Problem ORACLE 9i: file is more recent than controlfile – old controlfile

When I am practicing oracle 9i fundamental one, I execute Database base control file location change operation. But unfortunately I have performed this operation in database open state. This cause problem when next time I try to open my database. Oracle has prompted messages “file is more recent than controlfile – old controlfile”.

I am new in oracle. This problem creates in big trouble to me. After exploring in Google at least two hour at last I can resolve this problem.

Solution:
I have executed recovery operation. Here i follow incomplete user managed backup procedure. Before that I have backup my entire important file of the database. The follow below steps,

1. Open database at mount state
sql> startup mount

2. Identified the current Redo file
sql>select l.status, member from v$logfile inner join v$log l using (group#);
INACTIVE C:/oracle/MYDB/ctl/redo01.log
CURRENT C:/oracle/MYDB/ctl/redo02.log
INACTIVE C:/oracle/MYDB/ctl/redo03.log

OR
Sql> select * from v$log;

3. Start database recovery
SQL>recover database using backup controlfile until cancel;

Input the current redo log file dirrectory and press enter
C:/oracle/MYDB/ctl/redo02.log

4. Open Database using reset log
sql> alter database open resetlogs;

Thanks GOD!!!

Ref: Here




Deploy VS 2008 Window Project That use Crystal Report

I have to pass a terrible day for deploying a project where Cystal Report is used. I have used Install Shield 15 to make the installer of the project.  Project is installed to client pc hopefully, But when the user click the report generate button, System triger following error,

<code>Could not load file or assembly ‘CrystalDecisions.Windows.Forms, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304′ or one of its dependencies. The system cannot find the file specified.

</code>

Program does not find the assembly for generating report in the client PC. When i build the installer, Version =10.2.3600 is used which wrong. You can check it go to below directories,

C:/Windows/Assembly/

Now Solution, I have to spend the whole day for the solution, though i am experience in deploying web project of .NET 2.0  which use Crystal Report. Bussiness solution web site is one the complecated site in the web to me. It seems to me useless. Furtuantlly Microsoft forum help to solve the problem. I have to  install CRRedist2008_x86.msi in the Client PC to get desires assemblies. i have got the file in my development pc in following dirrectory,

C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\CrystalReports10_5

Then, at the end of the day i feel very relieve. Thanks Mirosoft foum.

Please Check these Link

Thanks
Khayer
GIS Programmer, CEGIS
Bangladesh



File Uploading tips in ASP.NET
February 3, 2009, 4:54 pm
Filed under: ASP.NET | Tags: ,

Error: Access denied

It is very common experience to every developer when he/she host a file uploader page.  Interestingly developer does not face this error in development PC.

The main reason of this problem is security issue of the host computer. Host pc does not allow write operation of IU or Guest user. But IU and guest user need write acces of upload folder in host pc.

the solutin if not very stadartd considering sercurity. folloe the belows steps,

1.  enable write access of virtual directory of the page using IIS(default value of write access is unchecked )

2. Right write click uploading folder of the site. In the security tab provide write access to Users, Internet Guest Account.

upload_share1

3. Complete

The main disadvantage of this technique is the security. Write access of IU user some time vulnerable. so, alternatively your can use database to store file instead of file system.

Thanks
Khayer
GIS Programmer, CEGIS
Bangladesh