FRIHOST ē FORUMS ē SEARCH ē FAQ ē TOS ē BLOGS ē COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


gis application dev. for rain,river,flood





tukun2009manit
Introduction:-
To develop a Rain Information System.
To develop a River Information System.
To develop a simple Flood Model System depending on Rain & River Information System.

Software Requirements:-
PostgreSQL (database)
PostGIS (plugin to the database)
GeoServer (server)
Google Maps (google map apiís)
Netbeans with Apache tomcat & java enabled (programming platform)

Note:- all of this software can be easily downloaded from its official website I have also shared it in uhuroo.com for easily.

Rain information System:-
Tables used in this project :-
Raindata(sid,day,rainfall,gid)
Locdata(gid,long,lat,the_geom)
tukun2009manit
tukun2009manit wrote:
Introduction:-
To develop a Rain Information System.
To develop a River Information System.
To develop a simple Flood Model System depending on Rain & River Information System.

Software Requirements:-
PostgreSQL (database)
PostGIS (plugin to the database)
GeoServer (server)
Google Maps (google map apiís)
Netbeans with Apache tomcat & java enabled (programming platform)

Note:- all of this software can be easily downloaded from its official website I have also shared it in uhuroo.com for easily.

Rain information System:-
Tables used in this project :-
Raindata(sid,day,rainfall,gid)
Locdata(gid,long,lat,the_geom)


Query used to show the rainfall on a particular day in this project.
select * from locdata,(select * from raindata where day='jan 9,2001') as rain where locdata.gid=rain.gid

note:-this query is used in user.java file in the source code
tukun2009manit
tukun2009manit wrote:
tukun2009manit wrote:
Introduction:-
To develop a Rain Information System.
To develop a River Information System.
To develop a simple Flood Model System depending on Rain & River Information System.

Software Requirements:-
PostgreSQL (database)
PostGIS (plugin to the database)
GeoServer (server)
Google Maps (google map apiís)
Netbeans with Apache tomcat & java enabled (programming platform)

Note:- all of this software can be easily downloaded from its official website I have also shared it in uhuroo.com for easily.

Rain information System:-
Tables used in this project :-
Raindata(sid,day,rainfall,gid)
Locdata(gid,long,lat,the_geom)


Algorithms used in Rainfall Information System
Itís a simple logic if rainfall is greater than 0 & less than 10 show marker green at that location.

var temp=0;
for(var count=0;count<1109;count++){
temp=count+1;
if(rain2[temp]>0){
if(rain2[temp]<=10){
var latlng =new GLatLng(lat[temp],lon[temp]);
map.addOverlay(createMarker1(latlng,temp));
}

else if(rain2[temp]>10 && rain2[temp]<=60){
var latlng =new GLatLng(lat[temp],lon[temp]);
map.addOverlay(createMarker2(latlng,temp));
}
else if(rain2[temp]>60){
var latlng =new GLatLng(lat[temp],lon[temp]);
map.addOverlay(createMarker3(latlng,temp));
}

}

}


Query used to show the rainfall on a particular day in this project.
select * from locdata,(select * from raindata where day='jan 9,2001') as rain where locdata.gid=rain.gid

note:-this query is used in user.java file in the source code
tukun2009manit
tukun2009manit wrote:
tukun2009manit wrote:
tukun2009manit wrote:
Introduction:-
To develop a Rain Information System.
To develop a River Information System.
To develop a simple Flood Model System depending on Rain & River Information System.

Software Requirements:-
PostgreSQL (database)
PostGIS (plugin to the database)
GeoServer (server)
Google Maps (google map apiís)
Netbeans with Apache tomcat & java enabled (programming platform)

Note:- all of this software can be easily downloaded from its official website I have also shared it in uhuroo.com for easily.

Rain information System:-
Tables used in this project :-
Raindata(sid,day,rainfall,gid)
Locdata(gid,long,lat,the_geom)


River Information System

Tables used in this project :-

Rivers10(gid,name,river_geom)

Geoserver :-

For creating a new data store.
setting of geoserver with postgis is provided in a html file please refer it for creating a new data store.

To get this feature on the map use this java script code:-


Algorithms used in Rainfall Information System
Itís a simple logic if rainfall is greater than 0 & less than 10 show marker green at that location.

var temp=0;
for(var count=0;count<1109;count++){
temp=count+1;
if(rain2[temp]>0){
if(rain2[temp]<=10){
var latlng =new GLatLng(lat[temp],lon[temp]);
map.addOverlay(createMarker1(latlng,temp));
}

else if(rain2[temp]>10 && rain2[temp]<=60){
var latlng =new GLatLng(lat[temp],lon[temp]);
map.addOverlay(createMarker2(latlng,temp));
}
else if(rain2[temp]>60){
var latlng =new GLatLng(lat[temp],lon[temp]);
map.addOverlay(createMarker3(latlng,temp));
}

}

}


Query used to show the rainfall on a particular day in this project.
select * from locdata,(select * from raindata where day='jan 9,2001') as rain where locdata.gid=rain.gid

note:-this query is used in user.java file in the source code
tukun2009manit
tukun2009manit wrote:
Introduction:-
To develop a Rain Information System.
To develop a River Information System.
To develop a simple Flood Model System depending on Rain & River Information System.

Software Requirements:-
PostgreSQL (database)
PostGIS (plugin to the database)
GeoServer (server)
Google Maps (google map apiís)
Netbeans with Apache tomcat & java enabled (programming platform)

Note:- all of this software can be easily downloaded from its official website I have also shared it in uhuroo.com for easily.

Rain information System:-
Tables used in this project :-
Raindata(sid,day,rainfall,gid)
Locdata(gid,long,lat,the_geom)


Flood Model System

Algorithm used:-
select * from raindata,( select * from locdata,(SELECT ST_x(ST_Line_Interpolate_Point(rivers_geom, " + (float) (i * 0.1) + ")),ST_y(ST_Line_Interpolate_Point(rivers_geom, " + (float) (i * 0.1) + ")) from rivers10) as foo where ST_Point_Inside_Circle(the_geom, foo.st_x, foo.st_y, 1)=true) as foo2 where day=date '" + day2 + "' - integer '2' and rainfall>0 and raindata.gid=foo2.gid;
tukun
tukun2009manit wrote:
Introduction:-
To develop a Rain Information System.
To develop a River Information System.
To develop a simple Flood Model System depending on Rain & River Information System.

Software Requirements:-
PostgreSQL (database)
PostGIS (plugin to the database)
GeoServer (server)
Google Maps (google map apiís)
Netbeans with Apache tomcat & java enabled (programming platform)

Note:- all of this software can be easily downloaded from its official website I have also shared it in uhuroo.com for easily.

Rain information System:-
Tables used in this project :-
Raindata(sid,day,rainfall,gid)
Locdata(gid,long,lat,the_geom)

CONTENTS
1. Acknowledgement
2. Introduction
a) What is GIS?
b) Three Views of a GIS
i) The Database View
ii) The Map View
iii) The Model View
3. Project Requirements
a. Database Requirements
i) PostgreSQL
ii) PostGIS
iii) pgAdmin III
b. Server Requirements
i) GeoServer & GeoWebCache
ii) Apache Tomcat.
c. Functional Requirements
i) Google Maps APIís
ii) Jsp & JavaScript enabled browser
tukun
tukun wrote:
tukun2009manit wrote:
Introduction:-
To develop a Rain Information System.
To develop a River Information System.
To develop a simple Flood Model System depending on Rain & River Information System.

Software Requirements:-
PostgreSQL (database)
PostGIS (plugin to the database)
GeoServer (server)
Google Maps (google map apiís)
Netbeans with Apache tomcat & java enabled (programming platform)

Note:- all of this software can be easily downloaded from its official website I have also shared it in uhuroo.com for easily.

Rain information System:-
Tables used in this project :-
Raindata(sid,day,rainfall,gid)
Locdata(gid,long,lat,the_geom)

CONTENTS
1. Acknowledgement
2. Introduction
a) What is GIS?
b) Three Views of a GIS
i) The Database View
ii) The Map View
iii) The Model View
3. Project Requirements
a. Database Requirements
i) PostgreSQL
ii) PostGIS
iii) pgAdmin III
b. Server Requirements
i) GeoServer & GeoWebCache
ii) Apache Tomcat.
c. Functional Requirements
i) Google Maps APIís
ii) Jsp & JavaScript enabled browser








Flood Information System
Flood Information System contains no data. Itís a Flood Model System which determine the rise in water level of river Ganga due to the rainfall in near by areas
This is a simple model which first determines the catchment area.
Then it calculates the water runoff in that catchment area due to previous two days rain.
Runoff1 of previous day=k1*avg(CA)
K1 is a constant it is taken 0.6 here which implies 60% of previous day rainwater is contributing to water runoff.
CA is the catchment area
Avg() is a function which returns the average rainfall of that catchment area supplied to it as an argument.
Similarly, runoff2 for day before previous day is calculated where k1 is modified to k2 whose value is 0.4
So, rise in river water level due to rainfall is given by:-
deltaH=runoff1+runoff2
tukun
tukun wrote:
tukun wrote:
tukun2009manit wrote:
Introduction:-
To develop a Rain Information System.
To develop a River Information System.
To develop a simple Flood Model System depending on Rain & River Information System.

Software Requirements:-
PostgreSQL (database)
PostGIS (plugin to the database)
GeoServer (server)
Google Maps (google map apiís)
Netbeans with Apache tomcat & java enabled (programming platform)

Note:- all of this software can be easily downloaded from its official website I have also shared it in uhuroo.com for easily.

Rain information System:-
Tables used in this project :-
Raindata(sid,day,rainfall,gid)
Locdata(gid,long,lat,the_geom)

CONTENTS
1. Acknowledgement
2. Introduction
a) What is GIS?
b) Three Views of a GIS
i) The Database View
ii) The Map View
iii) The Model View
3. Project Requirements
a. Database Requirements
i) PostgreSQL
ii) PostGIS
iii) pgAdmin III
b. Server Requirements
i) GeoServer & GeoWebCache
ii) Apache Tomcat.
c. Functional Requirements
i) Google Maps APIís
ii) Jsp & JavaScript enabled browser








Flood Information System
Flood Information System contains no data. Itís a Flood Model System which determine the rise in water level of river Ganga due to the rainfall in near by areas
This is a simple model which first determines the catchment area.
Then it calculates the water runoff in that catchment area due to previous two days rain.
Runoff1 of previous day=k1*avg(CA)
K1 is a constant it is taken 0.6 here which implies 60% of previous day rainwater is contributing to water runoff.
CA is the catchment area
Avg() is a function which returns the average rainfall of that catchment area supplied to it as an argument.
Similarly, runoff2 for day before previous day is calculated where k1 is modified to k2 whose value is 0.4
So, rise in river water level due to rainfall is given by:-
deltaH=runoff1+runoff2



souce code for river

package user;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/**
*
* @author Abhijeet
*/


import java.sql.*;

public class UserData {
String str1=null;
float xaxis[]=new float[1109];
float yaxis[]=new float[1109];
float rain[]=new float[1109];
String day1="jan 1,2001";
//int aaa;


public void connectDemo() throws SQLException {
Statement st = null;
ResultSet rs = null;
System.out.println("Checking if Driver is registered with DriverManager.");

try {
Class.forName("org.postgresql.Driver");
} catch (ClassNotFoundException cnfe) {
System.out.println("Couldn't find the driver!");
System.out.println("Let's print a stack trace, and exit.");
cnfe.printStackTrace();
System.exit(1);
}

System.out.println("Registered the driver ok, so let's make a connection.");

Connection c = null;

try {
// The second and third arguments are the username and password,
// respectively. They should be whatever is necessary to connect
// to the database.
c = DriverManager.getConnection("jdbc:postgresql://localhost:5432/test2",
"postgres", "gis12");
} catch (SQLException se) {
System.out.println("Couldn't connect: print out a stack trace and exit.");
se.printStackTrace();
System.exit(1);
}

st = c.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);

// sql Query editing part
rs= st.executeQuery("select * from locdata,(select * from raindata where day='"+ day1 +"') as rain where locdata.gid=rain.gid");
/*while(rs.next()){
System.out.println(rs.getString(2));
}*/

rs.next();
str1=rs.getString(2);
System.out.println("str1 value reached");
for(int i=0;i<1109;i++){
xaxis[i]=rs.getFloat(2);
yaxis[i]=rs.getFloat(3);
rain[i]=rs.getFloat(7);
rs.next();
}
//aaa=xaxis[3];

// st.executeUpdate("insert into india2(gid,long,lat,rainfall,day) select gid,long,lat,jan16,'jan16' from final;");




/* PreparedStatement ps=c.prepareStatement("UPDATE SET day=? WHERE gid=6;");

ps.setString(4,"jan1");
ps.executeUpdate();*/
/*while (rs.next()) {
System.out.println(rs.getString(1));

}*/

if (c != null) {
System.out.println("Hooray! We connected to the database!");
} else {
System.out.println("We should never get here.");
}

}

String username;
String email;
int age;

public void setUsername( String value )
{
username = value;
}

public void setDay1( String value )
{
day1 = value;
}

public void setEmail( String value )
{
email = value;
}

public void setAge( int value )
{
age = value;
}

public String getUsername() { return username; }

public String getEmail() { return email; }

public int getAge() { return age; }

public String getStr1() { return str1; }

public float[] getXaxis() { return xaxis; }

public float[] getYaxis() { return yaxis; }
//public int getAaa() { return aaa; }
public float[] getRain() { return rain; }

}
tukun
tukun2009manit wrote:
tukun2009manit wrote:
tukun2009manit wrote:
tukun2009manit wrote:
Introduction:-
To develop a Rain Information System.
To develop a River Information System.
To develop a simple Flood Model System depending on Rain & River Information System.

Software Requirements:-
PostgreSQL (database)
PostGIS (plugin to the database)
GeoServer (server)
Google Maps (google map apiís)
Netbeans with Apache tomcat & java enabled (programming platform)

Note:- all of this software can be easily downloaded from its official website I have also shared it in uhuroo.com for easily.

Rain information System:-
Tables used in this project :-
Raindata(sid,day,rainfall,gid)
Locdata(gid,long,lat,the_geom)


River Information System

Tables used in this project :-

Rivers10(gid,name,river_geom)

Geoserver :-

For creating a new data store.
setting of geoserver with postgis is provided in a html file please refer it for creating a new data store.

To get this feature on the map use this java script code:-


Algorithms used in Rainfall Information System
Itís a simple logic if rainfall is greater than 0 & less than 10 show marker green at that location.

var temp=0;
for(var count=0;count<1109;count++){
temp=count+1;
if(rain2[temp]>0){
if(rain2[temp]<=10){
var latlng =new GLatLng(lat[temp],lon[temp]);
map.addOverlay(createMarker1(latlng,temp));
}

else if(rain2[temp]>10 && rain2[temp]<=60){
var latlng =new GLatLng(lat[temp],lon[temp]);
map.addOverlay(createMarker2(latlng,temp));
}
else if(rain2[temp]>60){
var latlng =new GLatLng(lat[temp],lon[temp]);
map.addOverlay(createMarker3(latlng,temp));
}

}

}


Query used to show the rainfall on a particular day in this project.
select * from locdata,(select * from raindata where day='jan 9,2001') as rain where locdata.gid=rain.gid

note:-this query is used in user.java file in the source code



sorce code for flood

package user2;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/**
*
* @author Abhijeet
*/
import java.sql.*;

public class UserData2 {

int r1, r2;
Statement st = null;
ResultSet rs = null;
float sum1 = 0, avg1 = 0;
float sum2 = 0, avg2 = 0;
float[] deltaH = new float[11];
String day2 = null;
boolean b = false;
float lon[] = new float[11];
float lat[] = new float[11];

public void connectDemo() throws SQLException {
System.out.println("Checking if Driver is registered with DriverManager.");

try {
Class.forName("org.postgresql.Driver");
} catch (ClassNotFoundException cnfe) {
System.out.println("Couldn't find the driver!");
System.out.println("Let's print a stack trace, and exit.");
cnfe.printStackTrace();
System.exit(1);
}

System.out.println("Registered the driver ok, so let's make a connection.");

Connection c = null;

try {
// The second and third arguments are the username and password,
// respectively. They should be whatever is necessary to connect
// to the database.
c = DriverManager.getConnection("jdbc:postgresql://localhost:5432/test2",
"postgres", "gis12");
} catch (SQLException se) {
System.out.println("Couldn't connect: print out a stack trace and exit.");
se.printStackTrace();
System.exit(1);
}

st = c.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);

for (int i = 0; i <= 10; i++) {
System.out.println("round " + i);
rs = st.executeQuery("select * from raindata,( select * from locdata,(SELECT ST_x(ST_Line_Interpolate_Point(rivers_geom, " + (float) (i * 0.1) + ")),ST_y(ST_Line_Interpolate_Point(rivers_geom, " + (float) (i * 0.1) + ")) from rivers10) as foo where ST_Point_Inside_Circle(the_geom, foo.st_x, foo.st_y, 1)=true) as foo2 where day=date '" + day2 + "' - integer '1' and rainfall>0 and raindata.gid=foo2.gid;");
while (rs.next()) {
sum1 = sum1 + rs.getFloat(3);
if (b == false) {
lon[i] = rs.getFloat(9);
lat[i] = rs.getFloat(10);
System.out.println("longitude =" + lon[i]);
System.out.println("latitude =" + lat[i]);
}
b = true;
}
rs.afterLast();
rs.previous();
r1 = rs.getRow();
System.out.println("no of rows here =" + rs.getRow());
avg1 = sum1 / r1;

System.out.println("avg1=" + avg1);

System.out.println(sum1);
rs = st.executeQuery("select * from raindata,( select * from locdata,(SELECT ST_x(ST_Line_Interpolate_Point(rivers_geom, " + (float) (i * 0.1) + ")),ST_y(ST_Line_Interpolate_Point(rivers_geom, " + (float) (i * 0.1) + ")) from rivers10) as foo where ST_Point_Inside_Circle(the_geom, foo.st_x, foo.st_y, 1)=true) as foo2 where day=date '" + day2 + "' - integer '2' and rainfall>0 and raindata.gid=foo2.gid;");
while (rs.next()) {
sum2 = sum2 + rs.getFloat(3);
}
rs.afterLast();
rs.previous();
r2=rs.getRow();
System.out.println("no of rows here ="+rs.getRow());
avg2=sum2/r2;
System.out.println(sum2);
deltaH[i] = (float) (0.6 * avg1 + 0.4 * avg2);
System.out.println(deltaH[i]);
sum1 = 0;
sum2 = 0;
b = false;
}

if (c != null) {
System.out.println("Hooray! We connected to the database!");
} else {
System.out.println("We should never get here.");
}
}
String username;
String email;
int age;

public void setUsername(String value) {
username = value;
}

public void setEmail(String value) {
email = value;
}

public void setAge(int value) {
age = value;
}

public void setDay2(String value) {
day2 = value;
}

public String getUsername() {
return username;
}

public String getEmail() {
return email;
}

public int getAge() {
return age;
}

public float[] getDeltaH() {
return deltaH;
}

public float[] getLon() {
return lon;
}

public float[] getLat() {
return lat;
}
}
tukun
tukun wrote:
tukun2009manit wrote:
tukun2009manit wrote:
tukun2009manit wrote:
tukun2009manit wrote:
Introduction:-
To develop a Rain Information System.
To develop a River Information System.
To develop a simple Flood Model System depending on Rain & River Information System.

Software Requirements:-
PostgreSQL (database)
PostGIS (plugin to the database)
GeoServer (server)
Google Maps (google map apiís)
Netbeans with Apache tomcat & java enabled (programming platform)

Note:- all of this software can be easily downloaded from its official website I have also shared it in uhuroo.com for easily.

Rain information System:-
Tables used in this project :-
Raindata(sid,day,rainfall,gid)
Locdata(gid,long,lat,the_geom)


River Information System

Tables used in this project :-

Rivers10(gid,name,river_geom)

Geoserver :-

For creating a new data store.
setting of geoserver with postgis is provided in a html file please refer it for creating a new data store.

To get this feature on the map use this java script code:-


Algorithms used in Rainfall Information System
Itís a simple logic if rainfall is greater than 0 & less than 10 show marker green at that location.

var temp=0;
for(var count=0;count<1109;count++){
temp=count+1;
if(rain2[temp]>0){
if(rain2[temp]<=10){
var latlng =new GLatLng(lat[temp],lon[temp]);
map.addOverlay(createMarker1(latlng,temp));
}

else if(rain2[temp]>10 && rain2[temp]<=60){
var latlng =new GLatLng(lat[temp],lon[temp]);
map.addOverlay(createMarker2(latlng,temp));
}
else if(rain2[temp]>60){
var latlng =new GLatLng(lat[temp],lon[temp]);
map.addOverlay(createMarker3(latlng,temp));
}

}

}


Query used to show the rainfall on a particular day in this project.
select * from locdata,(select * from raindata where day='jan 9,2001') as rain where locdata.gid=rain.gid

note:-this query is used in user.java file in the source code



sorce code for flood

package user2;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/**
*
* @author Abhijeet
*/
import java.sql.*;

public class UserData2 {

int r1, r2;
Statement st = null;
ResultSet rs = null;
float sum1 = 0, avg1 = 0;
float sum2 = 0, avg2 = 0;
float[] deltaH = new float[11];
String day2 = null;
boolean b = false;
float lon[] = new float[11];
float lat[] = new float[11];

public void connectDemo() throws SQLException {
System.out.println("Checking if Driver is registered with DriverManager.");

try {
Class.forName("org.postgresql.Driver");
} catch (ClassNotFoundException cnfe) {
System.out.println("Couldn't find the driver!");
System.out.println("Let's print a stack trace, and exit.");
cnfe.printStackTrace();
System.exit(1);
}

System.out.println("Registered the driver ok, so let's make a connection.");

Connection c = null;

try {
// The second and third arguments are the username and password,
// respectively. They should be whatever is necessary to connect
// to the database.
c = DriverManager.getConnection("jdbc:postgresql://localhost:5432/test2",
"postgres", "gis12");
} catch (SQLException se) {
System.out.println("Couldn't connect: print out a stack trace and exit.");
se.printStackTrace();
System.exit(1);
}

st = c.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);

for (int i = 0; i <= 10; i++) {
System.out.println("round " + i);
rs = st.executeQuery("select * from raindata,( select * from locdata,(SELECT ST_x(ST_Line_Interpolate_Point(rivers_geom, " + (float) (i * 0.1) + ")),ST_y(ST_Line_Interpolate_Point(rivers_geom, " + (float) (i * 0.1) + ")) from rivers10) as foo where ST_Point_Inside_Circle(the_geom, foo.st_x, foo.st_y, 1)=true) as foo2 where day=date '" + day2 + "' - integer '1' and rainfall>0 and raindata.gid=foo2.gid;");
while (rs.next()) {
sum1 = sum1 + rs.getFloat(3);
if (b == false) {
lon[i] = rs.getFloat(9);
lat[i] = rs.getFloat(10);
System.out.println("longitude =" + lon[i]);
System.out.println("latitude =" + lat[i]);
}
b = true;
}
rs.afterLast();
rs.previous();
r1 = rs.getRow();
System.out.println("no of rows here =" + rs.getRow());
avg1 = sum1 / r1;

System.out.println("avg1=" + avg1);

System.out.println(sum1);
rs = st.executeQuery("select * from raindata,( select * from locdata,(SELECT ST_x(ST_Line_Interpolate_Point(rivers_geom, " + (float) (i * 0.1) + ")),ST_y(ST_Line_Interpolate_Point(rivers_geom, " + (float) (i * 0.1) + ")) from rivers10) as foo where ST_Point_Inside_Circle(the_geom, foo.st_x, foo.st_y, 1)=true) as foo2 where day=date '" + day2 + "' - integer '2' and rainfall>0 and raindata.gid=foo2.gid;");
while (rs.next()) {
sum2 = sum2 + rs.getFloat(3);
}
rs.afterLast();
rs.previous();
r2=rs.getRow();
System.out.println("no of rows here ="+rs.getRow());
avg2=sum2/r2;
System.out.println(sum2);
deltaH[i] = (float) (0.6 * avg1 + 0.4 * avg2);
System.out.println(deltaH[i]);
sum1 = 0;
sum2 = 0;
b = false;
}

if (c != null) {
System.out.println("Hooray! We connected to the database!");
} else {
System.out.println("We should never get here.");
}
}
String username;
String email;
int age;

public void setUsername(String value) {
username = value;
}

public void setEmail(String value) {
email = value;
}

public void setAge(int value) {
age = value;
}

public void setDay2(String value) {
day2 = value;
}

public String getUsername() {
return username;
}

public String getEmail() {
return email;
}

public int getAge() {
return age;
}

public float[] getDeltaH() {
return deltaH;
}

public float[] getLon() {
return lon;
}

public float[] getLat() {
return lat;
}
}






<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><link rel="stylesheet" type="text/css" href="ex2.css" />
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<h2 style="text-align:center">
<a href="index.jsp">Home</a>
<a href="help.jsp">Help/FAQ</a></h2>
<h2 style="text-align:center">This projects provide rainfall analysis on the google map for india. along with these,this project construct the river ganga and tried to examine the rise in water level due the the rainfall. </h2>
<a href="http://localhost:8080/geoserver/wms?bbox=67.075,6.65,98.425,36.35&styles=&Format=application/openlayers&request=GetMap&version=1.1.1&layers=topp:india2&width=800&height=711&srs=EPSG:4326" target="_blank"> <img src="rain.jpg" width="400" height="300" alt="rain"/></a>
<a href="river.jsp"> <img src="river.jpg" width="400" height="300" alt="river"/></a>
<a href="http://localhost:8080/geoserver/wms?bbox=77.50433063507077,24.358221442296696,88.57547664642334,30.409652035973405&styles=&Format=application/openlayers&request=GetMap&version=1.1.1&layers=topp:rivers10&width=800&height=410&srs=EPSG:4326" target="_blank"> <img src="flood.jpg" width="400" height="300" alt="flood"/></a>

<form action="SaveName.jsp">Enter the date in date type format,to view to rain data:<input type="text" name="day1" value="" /><input type="submit" value="submitt" /></form>
<form action="SaveName2.jsp">Enter the date in date type format to get raise in water level:<input type="text" name="day2" value="" /><input type="submit" value="submitt" /></form>
<p>note:- date type format implies mmddyy format for eg:- jan 9,2001 or january 9,2001 or 1/9/01 or 1-9-01 etc are valid,to get rain & water level information, entering jan 9,2001 and click submitt button then continue this will show rainfall in 9th of january of 2001.<p>
<p>note:- the database contains rainfall data of year 2001 so, rainfall data for the year 2001 is only available now</p>
</body>
</html>
tukun
tukun wrote:
tukun wrote:
tukun wrote:
tukun2009manit wrote:
Introduction:-
To develop a Rain Information System.
To develop a River Information System.
To develop a simple Flood Model System depending on Rain & River Information System.

Software Requirements:-
PostgreSQL (database)
PostGIS (plugin to the database)
GeoServer (server)
Google Maps (google map apiís)
Netbeans with Apache tomcat & java enabled (programming platform)

Note:- all of this software can be easily downloaded from its official website I have also shared it in uhuroo.com for easily.

Rain information System:-
Tables used in this project :-
Raindata(sid,day,rainfall,gid)
Locdata(gid,long,lat,the_geom)

CONTENTS
1. Acknowledgement
2. Introduction
a) What is GIS?
b) Three Views of a GIS
i) The Database View
ii) The Map View
iii) The Model View
3. Project Requirements
a. Database Requirements
i) PostgreSQL
ii) PostGIS
iii) pgAdmin III
b. Server Requirements
i) GeoServer & GeoWebCache
ii) Apache Tomcat.
c. Functional Requirements
i) Google Maps APIís
ii) Jsp & JavaScript enabled browser








Flood Information System
Flood Information System contains no data. Itís a Flood Model System which determine the rise in water level of river Ganga due to the rainfall in near by areas
This is a simple model which first determines the catchment area.
Then it calculates the water runoff in that catchment area due to previous two days rain.
Runoff1 of previous day=k1*avg(CA)
K1 is a constant it is taken 0.6 here which implies 60% of previous day rainwater is contributing to water runoff.
CA is the catchment area
Avg() is a function which returns the average rainfall of that catchment area supplied to it as an argument.
Similarly, runoff2 for day before previous day is calculated where k1 is modified to k2 whose value is 0.4
So, rise in river water level due to rainfall is given by:-
deltaH=runoff1+runoff2



souce code for river

package user;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/**
*
* @author Abhijeet
*/


import java.sql.*;

public class UserData {
String str1=null;
float xaxis[]=new float[1109];
float yaxis[]=new float[1109];
float rain[]=new float[1109];
String day1="jan 1,2001";
//int aaa;


public void connectDemo() throws SQLException {
Statement st = null;
ResultSet rs = null;
System.out.println("Checking if Driver is registered with DriverManager.");

try {
Class.forName("org.postgresql.Driver");
} catch (ClassNotFoundException cnfe) {
System.out.println("Couldn't find the driver!");
System.out.println("Let's print a stack trace, and exit.");
cnfe.printStackTrace();
System.exit(1);
}

System.out.println("Registered the driver ok, so let's make a connection.");

Connection c = null;

try {
// The second and third arguments are the username and password,
// respectively. They should be whatever is necessary to connect
// to the database.
c = DriverManager.getConnection("jdbc:postgresql://localhost:5432/test2",
"postgres", "gis12");
} catch (SQLException se) {
System.out.println("Couldn't connect: print out a stack trace and exit.");
se.printStackTrace();
System.exit(1);
}

st = c.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);

// sql Query editing part
rs= st.executeQuery("select * from locdata,(select * from raindata where day='"+ day1 +"') as rain where locdata.gid=rain.gid");
/*while(rs.next()){
System.out.println(rs.getString(2));
}*/

rs.next();
str1=rs.getString(2);
System.out.println("str1 value reached");
for(int i=0;i<1109;i++){
xaxis[i]=rs.getFloat(2);
yaxis[i]=rs.getFloat(3);
rain[i]=rs.getFloat(7);
rs.next();
}
//aaa=xaxis[3];

// st.executeUpdate("insert into india2(gid,long,lat,rainfall,day) select gid,long,lat,jan16,'jan16' from final;");




/* PreparedStatement ps=c.prepareStatement("UPDATE SET day=? WHERE gid=6;");

ps.setString(4,"jan1");
ps.executeUpdate();*/
/*while (rs.next()) {
System.out.println(rs.getString(1));

}*/

if (c != null) {
System.out.println("Hooray! We connected to the database!");
} else {
System.out.println("We should never get here.");
}

}

String username;
String email;
int age;

public void setUsername( String value )
{
username = value;
}

public void setDay1( String value )
{
day1 = value;
}

public void setEmail( String value )
{
email = value;
}

public void setAge( int value )
{
age = value;
}

public String getUsername() { return username; }

public String getEmail() { return email; }

public int getAge() { return age; }

public String getStr1() { return str1; }

public float[] getXaxis() { return xaxis; }

public float[] getYaxis() { return yaxis; }
//public int getAaa() { return aaa; }
public float[] getRain() { return rain; }

}


<!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<jsp:useBean id="user" class="user.UserData" scope="session"/>


<html xmlns="http://www.w3.org/1999/xhtml">
<head><link rel="stylesheet" type="text/css" href="ex1.css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Maps JavaScript API Example</title>

</head>
<body onload="initialize()" onunload="GUnload()">
<h2 style="text-align:center">
<a href="index.jsp">Home</a>
<a href="help.jsp">Help/FAQ</a></h2>

<% user.connectDemo();%>

<h2> help: double click to zoom, clicking on any symbol will display the rainfall data & its gid data</h2>
<% float[] arr1 = new float[1109];
float[] arr2 = new float[1109];
float[] rain1 = new float[1109];
arr1 = user.getXaxis();
arr2 = user.getYaxis();
rain1 = user.getRain();
%>

<script type="text/javascript">
var lon=new Array(1109);
var lat=new Array(1109);
var rain2=new Array(1109);
<% for (int i = 0; i < 1109; i++) {
out.println("lon[" + i + "]=" + arr1[i]);
out.println("lat[" + i + "]=" + arr2[i]);
out.println("rain2[" + i + "]=" + rain1[i]);
}%>

</script>
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAA7uRTWxvISQoTUJPuTxW9gRTb4SoZVl-h9Om3Zq_Z-kMl7U1GEhTc4NuIkzepAxtPtGUtkegOLH3lIg&sensor=true"
type="text/javascript"></script>

<script type="text/javascript">
function initialize() {

if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(28,77), 6);
// map.setMapType(G_SATELLITE_MAP);
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());

var tilelayer = new GTileLayer(null, null, null, {
tileUrlTemplate: 'http://localhost:8080/geoserver/gwc/service/gmaps?layers=topp:rivers10&zoom={Z}&x={X}&y={Y}',
isPng:true,
opacity:0.5 }
);

var myTileLayer = new GTileLayerOverlay(tilelayer);
map.addOverlay(myTileLayer);

var tinyIcon1 = new GIcon();
tinyIcon1.image = "http://labs.google.com/ridefinder/images/mm_20_blue.png";
tinyIcon1.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
tinyIcon1.iconSize = new GSize(12, 20);
tinyIcon1.shadowSize = new GSize(22, 20);
tinyIcon1.iconAnchor = new GPoint(6, 20);
tinyIcon1.infoWindowAnchor = new GPoint(5, 1);

var tinyIcon2 = new GIcon();
tinyIcon2.image = "http://labs.google.com/ridefinder/images/mm_20_green.png";
tinyIcon2.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
tinyIcon2.iconSize = new GSize(12, 20);
tinyIcon2.shadowSize = new GSize(22, 20);
tinyIcon2.iconAnchor = new GPoint(6, 20);
tinyIcon2.infoWindowAnchor = new GPoint(5, 1);

var tinyIcon3 = new GIcon();
tinyIcon3.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
tinyIcon3.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
tinyIcon3.iconSize = new GSize(12, 20);
tinyIcon3.shadowSize = new GSize(22, 20);
tinyIcon3.iconAnchor = new GPoint(6, 20);
tinyIcon3.infoWindowAnchor = new GPoint(5, 1);

var blueIcon = new GIcon(G_DEFAULT_ICON);
blueIcon.image = "http://gmaps-samples.googlecode.com/svn/trunk/markers/blue/blank.png";

markerOptions1 = { icon:tinyIcon1 };

var greenIcon = new GIcon(G_DEFAULT_ICON);
greenIcon.image = "http://gmaps-samples.googlecode.com/svn/trunk/markers/green/blank.png";

markerOptions2 = { icon:tinyIcon2 };

var redIcon = new GIcon(G_DEFAULT_ICON);
redIcon.image = "http://gmaps-samples.googlecode.com/svn/trunk/markers/red/blank.png";

markerOptions3 = { icon:tinyIcon3 };

function createMarker1(latlng, number) {
var marker = new GMarker(latlng,markerOptions1);
marker.value = number;
GEvent.addListener(marker,"click", function() {
var myHtml = "<b># gid= " + number + "</b><br/>" + rain2[number] +"mm of rainfall";
map.openInfoWindowHtml(latlng, myHtml);
});
return marker;
}

function createMarker2(latlng, number) {
var marker = new GMarker(latlng,markerOptions2);
marker.value = number;
GEvent.addListener(marker,"click", function() {
var myHtml = "<b># gid= " + number + "</b><br/>" + rain2[number] +"mm of rainfall";
map.openInfoWindowHtml(latlng, myHtml);
});
return marker;
}

function createMarker3(latlng, number) {
var marker = new GMarker(latlng,markerOptions3);
marker.value = number;
GEvent.addListener(marker,"click", function() {
var myHtml = "<b># gid= " + number + "</b><br/>" + rain2[number] +"mm of rainfall";
map.openInfoWindowHtml(latlng, myHtml);
});
return marker;
}

var temp=0;
for(var count=0;count<1109;count++){
temp=count+1;
if(rain2[temp]>0){
if(rain2[temp]<=10){
var latlng =new GLatLng(lat[temp],lon[temp]);
map.addOverlay(createMarker1(latlng,temp));
}

else if(rain2[temp]>10 && rain2[temp]<=60){
var latlng =new GLatLng(lat[temp],lon[temp]);
map.addOverlay(createMarker2(latlng,temp));
}
else if(rain2[temp]>60){
var latlng =new GLatLng(lat[temp],lon[temp]);
map.addOverlay(createMarker3(latlng,temp));
}

}

}



}
}
</script>

<div id="map_canvas" style="width: 1200px; height: 600px"></div>
<h2> <p>color code: blue denotes less than or equalto 10 mm of rainfall</p></h2>
<h2><p> green denotes greater than 10 but less than equalto 60 mm of rainfall</p> </h2>
<h2><p>red denotes above 60 mm of rainfall</p></h2>
</body>
</html>
tukun
tukun wrote:
tukun wrote:
tukun2009manit wrote:
tukun2009manit wrote:
tukun2009manit wrote:
tukun2009manit wrote:
Introduction:-
To develop a Rain Information System.
To develop a River Information System.
To develop a simple Flood Model System depending on Rain & River Information System.

Software Requirements:-
PostgreSQL (database)
PostGIS (plugin to the database)
GeoServer (server)
Google Maps (google map apiís)
Netbeans with Apache tomcat & java enabled (programming platform)

Note:- all of this software can be easily downloaded from its official website I have also shared it in uhuroo.com for easily.

Rain information System:-
Tables used in this project :-
Raindata(sid,day,rainfall,gid)
Locdata(gid,long,lat,the_geom)


River Information System

Tables used in this project :-

Rivers10(gid,name,river_geom)

Geoserver :-

For creating a new data store.
setting of geoserver with postgis is provided in a html file please refer it for creating a new data store.

To get this feature on the map use this java script code:-


Algorithms used in Rainfall Information System
Itís a simple logic if rainfall is greater than 0 & less than 10 show marker green at that location.

var temp=0;
for(var count=0;count<1109;count++){
temp=count+1;
if(rain2[temp]>0){
if(rain2[temp]<=10){
var latlng =new GLatLng(lat[temp],lon[temp]);
map.addOverlay(createMarker1(latlng,temp));
}

else if(rain2[temp]>10 && rain2[temp]<=60){
var latlng =new GLatLng(lat[temp],lon[temp]);
map.addOverlay(createMarker2(latlng,temp));
}
else if(rain2[temp]>60){
var latlng =new GLatLng(lat[temp],lon[temp]);
map.addOverlay(createMarker3(latlng,temp));
}

}

}


Query used to show the rainfall on a particular day in this project.
select * from locdata,(select * from raindata where day='jan 9,2001') as rain where locdata.gid=rain.gid

note:-this query is used in user.java file in the source code



sorce code for flood

package user2;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/**
*
* @author Abhijeet
*/
import java.sql.*;

public class UserData2 {

int r1, r2;
Statement st = null;
ResultSet rs = null;
float sum1 = 0, avg1 = 0;
float sum2 = 0, avg2 = 0;
float[] deltaH = new float[11];
String day2 = null;
boolean b = false;
float lon[] = new float[11];
float lat[] = new float[11];

public void connectDemo() throws SQLException {
System.out.println("Checking if Driver is registered with DriverManager.");

try {
Class.forName("org.postgresql.Driver");
} catch (ClassNotFoundException cnfe) {
System.out.println("Couldn't find the driver!");
System.out.println("Let's print a stack trace, and exit.");
cnfe.printStackTrace();
System.exit(1);
}

System.out.println("Registered the driver ok, so let's make a connection.");

Connection c = null;

try {
// The second and third arguments are the username and password,
// respectively. They should be whatever is necessary to connect
// to the database.
c = DriverManager.getConnection("jdbc:postgresql://localhost:5432/test2",
"postgres", "gis12");
} catch (SQLException se) {
System.out.println("Couldn't connect: print out a stack trace and exit.");
se.printStackTrace();
System.exit(1);
}

st = c.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);

for (int i = 0; i <= 10; i++) {
System.out.println("round " + i);
rs = st.executeQuery("select * from raindata,( select * from locdata,(SELECT ST_x(ST_Line_Interpolate_Point(rivers_geom, " + (float) (i * 0.1) + ")),ST_y(ST_Line_Interpolate_Point(rivers_geom, " + (float) (i * 0.1) + ")) from rivers10) as foo where ST_Point_Inside_Circle(the_geom, foo.st_x, foo.st_y, 1)=true) as foo2 where day=date '" + day2 + "' - integer '1' and rainfall>0 and raindata.gid=foo2.gid;");
while (rs.next()) {
sum1 = sum1 + rs.getFloat(3);
if (b == false) {
lon[i] = rs.getFloat(9);
lat[i] = rs.getFloat(10);
System.out.println("longitude =" + lon[i]);
System.out.println("latitude =" + lat[i]);
}
b = true;
}
rs.afterLast();
rs.previous();
r1 = rs.getRow();
System.out.println("no of rows here =" + rs.getRow());
avg1 = sum1 / r1;

System.out.println("avg1=" + avg1);

System.out.println(sum1);
rs = st.executeQuery("select * from raindata,( select * from locdata,(SELECT ST_x(ST_Line_Interpolate_Point(rivers_geom, " + (float) (i * 0.1) + ")),ST_y(ST_Line_Interpolate_Point(rivers_geom, " + (float) (i * 0.1) + ")) from rivers10) as foo where ST_Point_Inside_Circle(the_geom, foo.st_x, foo.st_y, 1)=true) as foo2 where day=date '" + day2 + "' - integer '2' and rainfall>0 and raindata.gid=foo2.gid;");
while (rs.next()) {
sum2 = sum2 + rs.getFloat(3);
}
rs.afterLast();
rs.previous();
r2=rs.getRow();
System.out.println("no of rows here ="+rs.getRow());
avg2=sum2/r2;
System.out.println(sum2);
deltaH[i] = (float) (0.6 * avg1 + 0.4 * avg2);
System.out.println(deltaH[i]);
sum1 = 0;
sum2 = 0;
b = false;
}

if (c != null) {
System.out.println("Hooray! We connected to the database!");
} else {
System.out.println("We should never get here.");
}
}
String username;
String email;
int age;

public void setUsername(String value) {
username = value;
}

public void setEmail(String value) {
email = value;
}

public void setAge(int value) {
age = value;
}

public void setDay2(String value) {
day2 = value;
}

public String getUsername() {
return username;
}

public String getEmail() {
return email;
}

public int getAge() {
return age;
}

public float[] getDeltaH() {
return deltaH;
}

public float[] getLon() {
return lon;
}

public float[] getLat() {
return lat;
}
}






<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><link rel="stylesheet" type="text/css" href="ex2.css" />
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<h2 style="text-align:center">
<a href="index.jsp">Home</a>
<a href="help.jsp">Help/FAQ</a></h2>
<h2 style="text-align:center">This projects provide rainfall analysis on the google map for india. along with these,this project construct the river ganga and tried to examine the rise in water level due the the rainfall. </h2>
<a href="http://localhost:8080/geoserver/wms?bbox=67.075,6.65,98.425,36.35&styles=&Format=application/openlayers&request=GetMap&version=1.1.1&layers=topp:india2&width=800&height=711&srs=EPSG:4326" target="_blank"> <img src="rain.jpg" width="400" height="300" alt="rain"/></a>
<a href="river.jsp"> <img src="river.jpg" width="400" height="300" alt="river"/></a>
<a href="http://localhost:8080/geoserver/wms?bbox=77.50433063507077,24.358221442296696,88.57547664642334,30.409652035973405&styles=&Format=application/openlayers&request=GetMap&version=1.1.1&layers=topp:rivers10&width=800&height=410&srs=EPSG:4326" target="_blank"> <img src="flood.jpg" width="400" height="300" alt="flood"/></a>

<form action="SaveName.jsp">Enter the date in date type format,to view to rain data:<input type="text" name="day1" value="" /><input type="submit" value="submitt" /></form>
<form action="SaveName2.jsp">Enter the date in date type format to get raise in water level:<input type="text" name="day2" value="" /><input type="submit" value="submitt" /></form>
<p>note:- date type format implies mmddyy format for eg:- jan 9,2001 or january 9,2001 or 1/9/01 or 1-9-01 etc are valid,to get rain & water level information, entering jan 9,2001 and click submitt button then continue this will show rainfall in 9th of january of 2001.<p>
<p>note:- the database contains rainfall data of year 2001 so, rainfall data for the year 2001 is only available now</p>
</body>
</html>




<!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><link rel="stylesheet" type="text/css" href="ex2.css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Maps with GeoWebCache</title>
<script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAA7uRTWxvISQoTUJPuTxW9gRQxny6npzr3gA2BlEj2uSZQZL2GchTHxEUbx0ZrTWw-dmUNBRK-ELHzvQ'></script>
<script type="text/javascript">

function initialize() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(28, 77), 4);

var tilelayer = new GTileLayer(null, null, null, {
tileUrlTemplate: 'http://localhost:8080/geoserver/gwc/service/gmaps?layers=topp:rivers10&zoom={Z}&x={X}&y={Y}',
isPng:true,
opacity:0.5 }
);

var myTileLayer = new GTileLayerOverlay(tilelayer);
map.addOverlay(myTileLayer);
}
}

</script>
</head>
<body onload="initialize()" onunload="GUnload()">
<h2 style="text-align:center">
<a href="index.jsp">Home</a>
<a href="help.jsp">Help/FAQ</a></h2>
<div id="map_canvas" style="width: 1200px; height: 500px"></div>
</body>
</html>
abhijeet
tukun wrote:
tukun wrote:
tukun wrote:
tukun2009manit wrote:
tukun2009manit wrote:
tukun2009manit wrote:
tukun2009manit wrote:
Introduction:-
To develop a Rain Information System.
To develop a River Information System.
To develop a simple Flood Model System depending on Rain & River Information System.

Software Requirements:-
PostgreSQL (database)
PostGIS (plugin to the database)
GeoServer (server)
Google Maps (google map apiís)
Netbeans with Apache tomcat & java enabled (programming platform)

Note:- all of this software can be easily downloaded from its official website I have also shared it in uhuroo.com for easily.

Rain information System:-
Tables used in this project :-
Raindata(sid,day,rainfall,gid)
Locdata(gid,long,lat,the_geom)


River Information System

Tables used in this project :-

Rivers10(gid,name,river_geom)

Geoserver :-

For creating a new data store.
setting of geoserver with postgis is provided in a html file please refer it for creating a new data store.

To get this feature on the map use this java script code:-


Algorithms used in Rainfall Information System
Itís a simple logic if rainfall is greater than 0 & less than 10 show marker green at that location.

var temp=0;
for(var count=0;count<1109;count++){
temp=count+1;
if(rain2[temp]>0){
if(rain2[temp]<=10){
var latlng =new GLatLng(lat[temp],lon[temp]);
map.addOverlay(createMarker1(latlng,temp));
}

else if(rain2[temp]>10 && rain2[temp]<=60){
var latlng =new GLatLng(lat[temp],lon[temp]);
map.addOverlay(createMarker2(latlng,temp));
}
else if(rain2[temp]>60){
var latlng =new GLatLng(lat[temp],lon[temp]);
map.addOverlay(createMarker3(latlng,temp));
}

}

}


Query used to show the rainfall on a particular day in this project.
select * from locdata,(select * from raindata where day='jan 9,2001') as rain where locdata.gid=rain.gid

note:-this query is used in user.java file in the source code



sorce code for flood

package user2;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/**
*
* @author Abhijeet
*/
import java.sql.*;

public class UserData2 {

int r1, r2;
Statement st = null;
ResultSet rs = null;
float sum1 = 0, avg1 = 0;
float sum2 = 0, avg2 = 0;
float[] deltaH = new float[11];
String day2 = null;
boolean b = false;
float lon[] = new float[11];
float lat[] = new float[11];

public void connectDemo() throws SQLException {
System.out.println("Checking if Driver is registered with DriverManager.");

try {
Class.forName("org.postgresql.Driver");
} catch (ClassNotFoundException cnfe) {
System.out.println("Couldn't find the driver!");
System.out.println("Let's print a stack trace, and exit.");
cnfe.printStackTrace();
System.exit(1);
}

System.out.println("Registered the driver ok, so let's make a connection.");

Connection c = null;

try {
// The second and third arguments are the username and password,
// respectively. They should be whatever is necessary to connect
// to the database.
c = DriverManager.getConnection("jdbc:postgresql://localhost:5432/test2",
"postgres", "gis12");
} catch (SQLException se) {
System.out.println("Couldn't connect: print out a stack trace and exit.");
se.printStackTrace();
System.exit(1);
}

st = c.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);

for (int i = 0; i <= 10; i++) {
System.out.println("round " + i);
rs = st.executeQuery("select * from raindata,( select * from locdata,(SELECT ST_x(ST_Line_Interpolate_Point(rivers_geom, " + (float) (i * 0.1) + ")),ST_y(ST_Line_Interpolate_Point(rivers_geom, " + (float) (i * 0.1) + ")) from rivers10) as foo where ST_Point_Inside_Circle(the_geom, foo.st_x, foo.st_y, 1)=true) as foo2 where day=date '" + day2 + "' - integer '1' and rainfall>0 and raindata.gid=foo2.gid;");
while (rs.next()) {
sum1 = sum1 + rs.getFloat(3);
if (b == false) {
lon[i] = rs.getFloat(9);
lat[i] = rs.getFloat(10);
System.out.println("longitude =" + lon[i]);
System.out.println("latitude =" + lat[i]);
}
b = true;
}
rs.afterLast();
rs.previous();
r1 = rs.getRow();
System.out.println("no of rows here =" + rs.getRow());
avg1 = sum1 / r1;

System.out.println("avg1=" + avg1);

System.out.println(sum1);
rs = st.executeQuery("select * from raindata,( select * from locdata,(SELECT ST_x(ST_Line_Interpolate_Point(rivers_geom, " + (float) (i * 0.1) + ")),ST_y(ST_Line_Interpolate_Point(rivers_geom, " + (float) (i * 0.1) + ")) from rivers10) as foo where ST_Point_Inside_Circle(the_geom, foo.st_x, foo.st_y, 1)=true) as foo2 where day=date '" + day2 + "' - integer '2' and rainfall>0 and raindata.gid=foo2.gid;");
while (rs.next()) {
sum2 = sum2 + rs.getFloat(3);
}
rs.afterLast();
rs.previous();
r2=rs.getRow();
System.out.println("no of rows here ="+rs.getRow());
avg2=sum2/r2;
System.out.println(sum2);
deltaH[i] = (float) (0.6 * avg1 + 0.4 * avg2);
System.out.println(deltaH[i]);
sum1 = 0;
sum2 = 0;
b = false;
}

if (c != null) {
System.out.println("Hooray! We connected to the database!");
} else {
System.out.println("We should never get here.");
}
}
String username;
String email;
int age;

public void setUsername(String value) {
username = value;
}

public void setEmail(String value) {
email = value;
}

public void setAge(int value) {
age = value;
}

public void setDay2(String value) {
day2 = value;
}

public String getUsername() {
return username;
}

public String getEmail() {
return email;
}

public int getAge() {
return age;
}

public float[] getDeltaH() {
return deltaH;
}

public float[] getLon() {
return lon;
}

public float[] getLat() {
return lat;
}
}






<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><link rel="stylesheet" type="text/css" href="ex2.css" />
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<h2 style="text-align:center">
<a href="index.jsp">Home</a>
<a href="help.jsp">Help/FAQ</a></h2>
<h2 style="text-align:center">This projects provide rainfall analysis on the google map for india. along with these,this project construct the river ganga and tried to examine the rise in water level due the the rainfall. </h2>
<a href="http://localhost:8080/geoserver/wms?bbox=67.075,6.65,98.425,36.35&styles=&Format=application/openlayers&request=GetMap&version=1.1.1&layers=topp:india2&width=800&height=711&srs=EPSG:4326" target="_blank"> <img src="rain.jpg" width="400" height="300" alt="rain"/></a>
<a href="river.jsp"> <img src="river.jpg" width="400" height="300" alt="river"/></a>
<a href="http://localhost:8080/geoserver/wms?bbox=77.50433063507077,24.358221442296696,88.57547664642334,30.409652035973405&styles=&Format=application/openlayers&request=GetMap&version=1.1.1&layers=topp:rivers10&width=800&height=410&srs=EPSG:4326" target="_blank"> <img src="flood.jpg" width="400" height="300" alt="flood"/></a>

<form action="SaveName.jsp">Enter the date in date type format,to view to rain data:<input type="text" name="day1" value="" /><input type="submit" value="submitt" /></form>
<form action="SaveName2.jsp">Enter the date in date type format to get raise in water level:<input type="text" name="day2" value="" /><input type="submit" value="submitt" /></form>
<p>note:- date type format implies mmddyy format for eg:- jan 9,2001 or january 9,2001 or 1/9/01 or 1-9-01 etc are valid,to get rain & water level information, entering jan 9,2001 and click submitt button then continue this will show rainfall in 9th of january of 2001.<p>
<p>note:- the database contains rainfall data of year 2001 so, rainfall data for the year 2001 is only available now</p>
</body>
</html>




<!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><link rel="stylesheet" type="text/css" href="ex2.css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Maps with GeoWebCache</title>
<script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAA7uRTWxvISQoTUJPuTxW9gRQxny6npzr3gA2BlEj2uSZQZL2GchTHxEUbx0ZrTWw-dmUNBRK-ELHzvQ'></script>
<script type="text/javascript">

function initialize() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(28, 77), 4);

var tilelayer = new GTileLayer(null, null, null, {
tileUrlTemplate: 'http://localhost:8080/geoserver/gwc/service/gmaps?layers=topp:rivers10&zoom={Z}&x={X}&y={Y}',
isPng:true,
opacity:0.5 }
);

var myTileLayer = new GTileLayerOverlay(tilelayer);
map.addOverlay(myTileLayer);
}
}

</script>
</head>
<body onload="initialize()" onunload="GUnload()">
<h2 style="text-align:center">
<a href="index.jsp">Home</a>
<a href="help.jsp">Help/FAQ</a></h2>
<div id="map_canvas" style="width: 1200px; height: 500px"></div>
</body>
</html>


Behind every major project there are a number of people involved other than the ones whose names are elucidated. People, who help us by their experience and wise suggestions, the ones who direct us back on the right track when we go astray,are the real spirit of the project.

I take this opportunity to thank all of them who guided me patiently during the course of this 8 week summer internship at Indian Institute of Technology,Bombay. First and foremost, I thank my entire group along as without their cooperation this project wouldnít have completed successfully. Working as a team with proper coordination is the main essence of any group project.
Related topics
our All-Time Favourite Movies?, share em with us!
Rain Disaster in Mumbai (India)
science vs. religion
Are christians educated?
poetry challenge
Greatest Disaster
Climate studies urge California, West to prepare for floods
Genesis in the spotlight..2
gis application development basic problems i faced and soln
Application form - getting rid of ucwords
Application form - onSubmit='return false;
Android Development
My hiking/survival gear, explained. (Warning, ~90 pics)
Australlia Floods
Reply to topic    Frihost Forum Index -> Science -> Education

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.