Sunday, August 23, 2009

Bhuvan- Google Map of India by ISRO


BhuvanA great and national level effort by ISRO towards the web world. I feel a great proud on this effort. ISRO has taken an outstanding step towards use of its technology. Though the Indian government might be gaining a lot by the use of Indian Remote Sensing satellite (IRS), but Bhuvan demonstrates the use of IRS for the common man (I meant here by the Internet users). This is a great move to show how strong is India in terms of technologies and how far has it moved. The data collection through IRS is a simple case. India might have many other uses. But Bhuvan depicts a large picture for end user. It says – ‘Hey, IRS is not meant for business only. It is for you also. Come and see this. We are having that much of information and much more.’ Bhuvan is a small exhibition of IRS strength.



I don’t know whether in current scenario, it will compete to google map or not. But It really depicts the strength and innovation of Indian scientists. I hope they will be able to enhance the features provided in Bhuvan as they already have planned.



Jay ho



In this article, I would like to share my user experience with the Bhuvan.



Excerpts from bhuvan website at following link:



Bhuvan



1. Bhuvan gives you an easy way to experience, explore and visualize IRS images over Indian region



2. Bhuvan, an ambitious project of ISRO to take Indian images and thematic information in multiple spatial resolutions to people through a web portal through easy access to information on basic natural resources in the geospatial domain.



3. Bhuvan showcases Indian images by the superimposition of these IRS satellite imageries on 3D globe. It displays satellite images of varying resolution of India’s surface, allowing users to visually see things like cities and important places of interest looking perpendicularly down or at an oblique angle, with different perspectives and can navigate through 3D viewing environment.



4. The degree of resolution showcased is based on the points of interest and popularity, but most of the Indian terrain is covered upto at least 5.8 meters of resolution with the least spatial resolution being 55 meters from AWifs Sensor. With such rich content, Bhuvan opens the door to graphic visualisation of digital geospatial India allowing individuals to experience the fully interactive terrain viewing capabilities.



5. Multi-resolution images from multi-sensor IRS satellites of India is seamlessly depicted through the Bhuvan web portal by enabling a common man to zoom into specific area of interest at high resolution.



6. Bhuvan brings a whole lot of uniqueness in understanding our own natural resources whilst presenting beautiful images and thematic vectors generated from varieties of geospatial information.





Basic features of Bhuvan:



  • Access, explore and visualise 2D and 3D image data along with rich thematic information on Soil, wasteland, water resources etc.

  • Visualise multi-resolution, multi-sensor, multi-temporal image data

  • Superpose administrative boundaries of choice on images as required

  • Visualisation of AWS ( Automatic Weather Stations) data/information in a graphic view and use tabular weather data of user choice

  • Fly to locations ( Flies from the current location directly to the selected location)

  • Heads-Up Display ( HUD) naviation controls ( Tilt slider, north indicator, opacity, compass ring, zoom slider)

  • Navigation using the 3D view Pop-up menu (Fly-in, Fly out, jump in, jump around, view point)

  • 3D Fly through (3D view to fly to locations, objects in the terrain, and navigate freely using the mouse or keyboard)

  • Drawing 2D objects (Text labels, polylines, polygons, rectangles, 2D arrows, circles, ellipse)

  • Drawing 3D Objects (placing of expressive 3D models, 3D polygons, boxes)

  • Snapshot creation (copies the 3D view to a floating window and allows to save to a external file)

  • Measurement tools (Horizontal distance, aerial distance, vertical distance, measure area)

  • Shadow Analysis (it sets the sun position based on the given time creating shadows and effects the lighting on the terrain)

  • Urban Design Tools (to build roads, junctions and traffic lights in an urban setting)

  • Contour map ( Displays a colorized terrain map and contour lines)

  • Draw tools (Creates simples markers, free hand lines, urban designs)





Procedure for using Bhuvan is as follows:



1. Register for Bhuvan at following link:



Bhuvan



Note: Remember your username and password as for now they have not provided any forget password link. Don’t know why, but I faced this at one time as I forget the password J, Though I remembered it again.



2. After registration download Plugin to use Bhuvan. Since Bhuvan is currently intented for Internet Explorer 6.0+ and this plugin will be installed for IE so that Bhuvan can be used in IE.



(Though, as an developer in open source technologies, I am a great fan of browsers like Firefox, Safari and Chrome, as Indian end user market is dominated by Microsoft so they targeted mainly to Internet Explorer users, so that can be a reason to develop it currently for IE only. But I will be happy if they aim it for other browsers also, so that developers also can take interest into it. This will be really needed if they want to popularize Bhuvan similar to Google Map.)



3. After downloading install the plugin.



4. Go to Bhuvan website (Bhuvan) and login into that site.



5. It is very slow currently and will take few seconds to open. But after it will open you can get a picture as follows:











Now let see some of features:



1. At the right pane of the website, you will see many items, the main three are:



§ Search box: Searc h any location



§ Add layers: One can add layers here



§ Bhuvan Layers: It further contains Vector, which contains two layers:



§ Base layers



§ Information Layers





2. You can get information at following levels of region from Bhuvan:



§ Country



§ State



§ District



§ Taluk



§ Towns



§ Villages: It seems, currently this feature is only following states:



§ Andhra Pradesh



§ Haryana



§ Gujrat



§ Karnataka



§ Kerla



§ Tamilnadu



3. Road and highway information can be retrieved at following basis:



§ Golden Quadrilateral (Swarnim Chaturbhuj)



§ National Highway



4. Other information also can be retrieved on map:



§ Location



§ Watershed



§ Wasteland



§ Soil



The problems with the current version of Bhuvan can be subdivided in two parts:



a. Look and feel of website is not so good.



b. I was not able to scroll in left pane when all items are open in Tree



c. Images at city and street levels are not clear. Sometimes it seems like I am zooming in and zooming out same image.



A great organization like ISRO should also concentrate on the user perspective. If look n feel and Processing will be so slow, they will find less number of users. As a developer I (and many more) would like to join the development, but will they allow. The main points are:



1. Are they having intention to compete with google map?



2. Will this be a simple start and end or there will be more versions in both – End users and Developer’s perspective.



3. Google map is popular because they let user participate in each manner to their products – in each term whether it is Development or Suggestions. User willingly participates and plays around their products like. What is ISRO’s plan for this?



4. How is ISRO going to market it and popularize it?



There are many more questions, answers of which may lie under plan list of ISRO or the time will reply for these. But I am hoping that Bhuvan will change the world and leads India to front in terms of Innovation.


Wednesday, July 16, 2008

J2ME Custom List

Custom List using J2ME CustomItem

Very recently I've undergone with a problem of creating a custom list in j2me. The list should contain items which will not only have three items at three differnt places but also they will contain an image. The image needed to be changed based on some flags. It was a little tough to do as I am very much New Comer int the mobile technologies as well as for the J2Me.My PM got so much angered at me for taking too much time (It took about 2 days for me) that he once even said that It can be doable by even a 12th standard child (I really don't know whether it is true.). But after scolding me for whole a day at last I could survive this problem after taking his help((:-) Thanks to him for his Kind help with (a liitle lot) scold).


For the convinience of the new comers who will not face same problem as me I am putting the solution here itself.


I have created My CustomList by extending CustomItem class. This class is very useful fpr creating new custom item. You can create any type of view using this class. Though you have to have a lot of logic for key handling at your new view.


Some Assumptions For the list are as under:-
1.It holds only 6 item at a time.
2.Right now I only could test only on the WTK default color emulator. There may be    some problems on running same code in other devices or emulators.
3. Though I tried to use as much as the programming technique to compute the width and heights and other stuff, there may are some hard coded stuff as well. e.g. the number of items in the list etc.

I hope This code will be a lot of help for you visitors.

Logic fot the list as under:-
1. Declares a number of variables to be used. There use is mentioned in the comments.
2. Constructor is used to initializes many a thing like height of item etc.
3.The paint method and overridden traverse method are of modt important.
Firstly paint method draws various items recatngle.
paint method is used to draw the items using a loop which loops on from 0 to 5. Then it will takes the string array and draws those strings.
4. The traverse method is used to handle key navigation
     

Now Leave all. Come to point. Here is my code for the custom list:-



/**
*
*/
package date160708;

import java.io.IOException;
import java.util.Vector;

import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.CustomItem;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;


/**
* @author Administrator
*
*/
public class CustomList extends CustomItem {

/*
* The following array variable contains the strings each of which will be further build an
* array of strings(in this case having length 3), which will be used to draw at differnt places in the same item.
*/
private String [] strData;
/*
* The following variables wll contain height and width of the customlist
*/
private int listHeight;
private int listWidth;

/*
* The following variables contain the num of items to be drawn
*/
private int numRows = 6;
/*
* Mainly there will be one column. If you want to draw a table like thing you can change this ,
* but you will have to make some changes in the code inside paint() method also.
*/
private int numColumns = 1;

/*
* The following variables are used as height and width of the items in custom list
*/
private int hRect;
private int wRect;

/*
* The following will indicate the current items. If you have more than two columns
* then xCurrent will also be changed but since here only one column so this value will not changed.
*/
private int xCurrent = 0;
private int yCurrent = 0;

/*
* This array will contain 0 and 1 values - used for the changes of images.
*/
private int [] imageFlags;

/*
* Image variables
*/
private static Image image1;
private static Image image2;
/*
* Loading images.
*/
static {
try {
image1 = Image.createImage("/single2.png");
image2 = Image.createImage("/single8.png");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

/**
* Constructor
* Description:- initializes different variables
* @param title:- Title of the custom item
* @param strArray :-
* @param width
* @param height
* @param flags
*/
protected CustomList(String title, String [] strArray, int width, int height, int[] flags) {
super("");
this.strData = strArray;
this.hRect = height / 6;
this.wRect = width - 2;
this.imageFlags = flags;

}

/**
* return minimum height requires
*/
protected int getMinContentHeight() {
return (numRows * hRect +1);
}

/**
* returns minimum width
*/
protected int getMinContentWidth() {
return (numColumns * wRect + 2);
}

/**
* return preferred content height
*/
protected int getPrefContentHeight(int arg0) {
return (numRows * hRect +1);
}
/**
* return preferred width
*/
protected int getPrefContentWidth(int arg0) {
return (numColumns * wRect + 2);
}

/*
* paint method used to draw the list items.
*/
protected void paint(Graphics g, int w, int h) {
Font font = g.getFont();
for(int i = 0; i <= numRows; i++) {
g.drawLine(0, i * hRect, numColumns * wRect, i * hRect);
}

for(int i = 0; i <= numColumns; i++) {
g.drawLine(i * wRect, 0, i * wRect, numRows * hRect);
}

int oldColor = g.getColor();
g.setColor(0x00D0D0D0);
g.fillRect((xCurrent * wRect) + 1, (yCurrent * hRect) + 1, wRect - 1, hRect - 1);

g.setColor(oldColor);

for(int i = 0; i < numRows; i++) {
String [] splitArray = createArrayOfStrings(strData[i], '@');
for(int j = 0; j < numColumns; j++) {
int oldClipX = g.getClipX();
int oldClipY = g.getClipY();

int oldClipWidth = g.getClipWidth();
int oldClipHeight = g.getClipHeight();
int x1 = (j * wRect) +2;
if(imageFlags[i] == 1) {
g.drawImage(image1, x1, (i * hRect) + font.getHeight(), Graphics.BOTTOM| Graphics.LEFT);
x1 += image1.getWidth();
} else {
g.drawImage(image2, x1, (i * hRect) + font.getHeight(), Graphics.BOTTOM| Graphics.LEFT);
x1 += image2.getWidth();
}
g.drawString(splitArray[0], x1, (i * hRect) + font.getHeight(),
Graphics.BOTTOM| Graphics.LEFT);

int x2 = getMinContentWidth() - (font.stringWidth(splitArray[1]) + font.charWidth(' '));
g.drawString(splitArray[1], x2 , (i * hRect) + font.getHeight(),
Graphics.BOTTOM| Graphics.RIGHT);

g.drawString(splitArray[2], x1, (i * hRect) +2 * font.getHeight(),
Graphics.BOTTOM| Graphics.LEFT);
// g.setClip((j * boxWidth) + 1, i * boxHeight, boxWidth - 1, boxHeight - 1);
// g.setClip(oldClipX, oldClipY, oldClipWidth, oldClipHeight);
}
}
}

/**
* createArrayOfStrings(String str, char ch)
* Description:- this method is used to create array of strings from a string
* @param str
* @param ch
* @return : a string array
*/

private String[] createArrayOfStrings(String str, char ch) {
Vector vector = new Vector();
int index = str.lastIndexOf(ch);

String[] strArray = null;
for(int i = 0; i < str.length(); i++) {
if(index < 0) {
vector.addElement(str);
break;
} else {
index = str.indexOf(ch);
if(index > 0) {
String elemStr = str.substring(0, index);
str = str.substring(index + 1, str.length());
vector.addElement(elemStr);
}
}
}
strArray = new String[vector.size()];
vector.copyInto(strArray);
return strArray;
}

/**
* travrse is am important method for keyhandling.
*/
protected boolean traverse(int dir, int viewportWidth, int viewportHeight,
int[] visRect_inout) {

switch(dir) {
case Canvas.DOWN : {
if(yCurrent < numRows - 1) {
yCurrent++;
repaint(xCurrent * wRect, (yCurrent - 1) * hRect, wRect, hRect);
repaint(xCurrent * wRect, yCurrent * hRect, wRect, hRect);
}
break;
}
case Canvas.UP : {
if(yCurrent > 0) {
yCurrent--;
repaint(xCurrent * wRect, (yCurrent + 1) * hRect, wRect, hRect);
repaint(xCurrent * wRect, yCurrent * hRect, wRect, hRect);
}
break;
}
}
visRect_inout[0] = xCurrent;
visRect_inout[1] = yCurrent;
visRect_inout[2] = wRect;
visRect_inout[3] = hRect;

return true;
}

}