Plotting Jonathan's pink dots using Netbeans 5.5 Visual Web Pack
You must be impressed by the Jonathan's pink dots showing the worldwide Solaris growth. It would be equally impressive if we could create the pink dots Google Map mashup using Netbeans - Sun's another successful product. Yes, it is very simple to create such mashup using Netbeans 5.5 Visual Web Pack AJAX components with as few as 10-20 lines of pure Java code. Also, it is possible to make the mashup much more interactive, like providing a dropdown list to select the dots only in particular country or show the dots only above or below certain threshold value.
Here is how you can do it.
Assume you have some data like city, country and some reletaded data to plot. Ex:
"Oxford, United Kingdom", 105663 "Louisville, Kentucky, United States", 85108
In order to plot this using the VWP Google map viewer component, you must first convert the city, country information to corresponding Latitude and Longitude. This can be easily done by writing a simple web service using Netbeans. Now the converted data would look like
"Oxford, United Kingdom", 105663, 51.75, -1.2599 "Louisville; Kentucky; United States", 85108, 38.24, -85.7699
Once we include the Latitude & Longitude of the cities in the data, it is very easy to plot the data. After following the tutorial Using the AJAX Map Viewer Component , the additional code you need is to place the markers corresponding to different cities. Following are the additional few lines of code I added to the "prerender" method of the page bean.
int maxCount = 2000;
markers = new MapMarker[maxCount];
ServletContext context = (ServletContext) getExternalContext().getContext();
String realPath = context.getRealPath("/resources/sample_data.txt");
try{
BufferedReader in = new BufferedReader(new FileReader(realPath));
String str;
while ((str = in.readLine()) != null) {
String[] data = str.split(",");
markers[count] = new MapMarker();
markers[count].setLatitude(Double.valueOf(data[2]).doubleValue());
markers[count].setLongitude(Double.valueOf(data[3]).doubleValue());
markers[count].setMarkup(data[1]);
if(count++ > maxCount) break;
}
}catch (Exception exc) {
log(exc.getLocalizedMessage();
}
It is possible to show the intensity at a point by using different icons (like various shades and size of dots) for the marker. I used just the default icon for the markers and some dummy data for the locations (I don't have the actual pink dots data). The plots looked like the pictures below
Posted at 10:55AM Jan 12, 2007 | Permanent link to this entry
Posted by jamey on January 12, 2007 at 11:26 AM PST #
Haven't you seen some (google maps) performance problems?
Oh, and what's up with Australia, no NetBeans there? ;)
Posted by Alexis MP on January 12, 2007 at 11:43 AM PST #
Posted by Alexis MP on January 12, 2007 at 11:47 AM PST #
Posted by Winston Prakash on January 12, 2007 at 12:50 PM PST #
Posted by Winston Prakash on January 12, 2007 at 12:55 PM PST #
Posted by jeremiah johnson on January 12, 2007 at 02:35 PM PST #
Posted by vivek goel on January 25, 2007 at 07:47 AM PST #
Posted by Ashish Samant on June 26, 2007 at 12:41 AM PDT #
Posted by Ashish Samant on July 23, 2007 at 01:02 AM PDT #
Hi All,
I have problem and I need anyone of you here to give me some point of view on how am I supposed to develop a map application using NetBeans.I am planning to develop it in mobile application but I am not sure how to do it. How to call the map and create lines on it to show the path from the starting point and destination allocate by user. My application enable user to choose their preferable route selection, such as shortest path/ scenic route or least jam route.Please help.Thank You.
Posted by Sharon on October 29, 2007 at 10:13 AM PDT #
<head>
<body>
bash
</body>
</head>
Posted by basheer on July 02, 2009 at 10:46 PM PDT #
hai
Posted by basheer on July 02, 2009 at 10:49 PM PDT #