views:

44

answers:

3

We would like to display all countries by continent (e.g. asia, europe, south america, africa ...) and capture user selection of a particular country within a continent. What kind of options are available for achieving this? This would be much similar to identifying countries on the map in freerice. I am not sure of the available options other than google maps, but not sure if this can be done using google maps api either. Need some direction on this.

EDIT: Ours is a jee 5 based application developed using java, seam, richfaces and deployed on a jboss 5.1 container

A: 

I don't understand the down vote of your question. Granted it is very vague as you do not specify the interface that will be used for this (is it a java desktop client, a javascript based solution...)

I can only advise on the Java Swing case so here it goes. Your best bet is to first find a vector map of the world with different shapes for each country (or make one yourself). Then you can convert the shapes to java2D shapes, create a zoomable JPanel (easier than it sounds trust me) and simply have your mouse clicks checked against all the country shapes with the contains(Point p) method. (of course you will have to take into account the zoom transformations of the panel but as i said it is far easier than it sounds).

I'm afraid i can't elaborate more with code examples because even though it is "easier than it sounds", it's not a five minute solution :)

Savvas Dalkitsis
apologize for not giving the platform initially, I have added more information to the question now (its a jee 5 application built using richfaces)
Samuel
java swing will not work for us
Samuel
+1  A: 

You could accomplish this with HTML and CSS. And maybe use JavaScript for your functionality.

Here is an example: http://www.cssplay.co.uk/menu/imap.html

KLee1
+2  A: 

I am assuming that you want to create a clickable map for users to select a country - like this Map.

This can be done either using an HTML image map, or Flash. You would need to manually define the clickable hotspots in both cases.

If you only have a few selectable areas (rather then every country on the planet), using Google Maps could be used with custom markers (to blend it with your site style) each with their own click handlers to handle the selection.

DrDeth