I am completely new to GIS.

I need to find an open-source Java framework/library/api that would generate an map image with multiple coordinates markers. In particular I need to customize the shape of the markers (i.e. making the marker circle size bigger or smaller depending on external additional data). Moreover, it would be nice that the map would fit to the markers (so if I place markers only in Europe, the image would show Europe only, not the whole globe). The target display is a java webapp so I would nee to generate the image and get it in a byte form, so I can display it on the page.

Does any one know an Java API that has such functionality?

I looked at things like geotools or jmapviewer but they seem to lack the features I require.

2 Answers 2


If you are making a java webabb, you could use OpenLayers (a Javascript mapping api) for displaying markers).

I guess you could in some way generate a GeoJSON of your data, e.g. follow some of the examples on OpenLayers Vector Layers.

Here is one such example (well, generating data on the fly): http://openlayers.org/dev/examples/styles-context.html

And for the "map fit the contents"-requirement, use something like:

  • Actually I was thinking about making it more likely in the Java backing code (not javascript) but the example looks promising, so I might decide to go with that. Thanks for the suggestion.
    – srd.pl
    May 9, 2012 at 17:26
  • Maybe I should open another question but I'll try here for now - does OpenLayers work with xhtml? I was trying to implement this example (just in the raw form) on my JSF .xhtml page and the map is shown but the markers are not displayed at all. However the trick with centring the map on according to the points works, so that proves that the points are added to the maps just not displayed.
    – srd.pl
    May 10, 2012 at 12:05
  • I do not see why OpenLayers shouldn't work with .xhtml pages. I guess there are some other reason why your markers aren't displayed. I would recommend opening another question with relevant code sample(s)
    – atlefren
    May 10, 2012 at 13:29

Try OpenJump. It's in java and has an API.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.