• Post Reply Bookmark Topic Watch Topic
  • New Topic

servlets and maps  RSS feed

 
Sri Sar
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
i want to know whether the following can be done using servlets:
by using a form , the user chooses an empty map(say usamap.jpg).
he also chooses a text file that contains data about the map. the user
is also allowed to choose a color that denotes a particular range ie
all regions in the range 1000 to 2000 to be represented by pink color.
is it possible to use servlets such that the color chosen by the
user(ie pink) is applied to specific regions on the map?
thanks in advance and waiting to hear from u.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes
 
Sri Sar
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi william,
thank u very much for the reply. if u don't mind can u give me some idea/links on how to achieve it.
thanks in advance
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can dynamically generate and return an image from a servlet, therefore if you can determine how it's done on the server, you can build and return the image to the client.

I've done this using a java.awt.Image to PNG encoder, but I don't have an example at the moment.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, it is an interesting problem, so I have been thinking about how to efficiently create a map image in which selected areas get a custom color.

With GIF file base map
GIF image files have a color map that maps display color to a pixel index. In addition to white and black, you get about 253 additional "colors" so if your base map has less than 253 distinct areas, you could create it with a distinct "color index" for each area. When it comes time to create the custom map, load the GIF in memory and modify the color map so that the selected areas unique indexs all map to the selected color and the non selected areas map to white (or whatever).

With JPG file base map
I think you could use the same approach but I think handling the map is trickier.

With SVG base map
SVG is "Scalable Vector Graphics" a w3c standard for creating graphics from an XML markup language. Very powerful stuff. Seems to me that if your base map can be in SVG, setting a very few parameters could control the coloring of selected areas. Of course this requires client browsers that handle SVG correctly, but the effects possible are impressive - see:
http://wwws.sun.com/software/xml/developers/svg/
Thanks for calling my attention to an interesting problem. I think the group will be interested in what you come up with.

Bill
[ May 18, 2004: Message edited by: William Brogden ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!