I have a shape file, a simple a map of countries that I need to display on screen, but each country needs to be a specific color. Say I have an int
variable named HKDensity = 21
, then if a value of 21 is red, the color of the Hongkong polygon should be red.
This is for a school assignment in Java Swing, any help, hints examples is greatly appreciated. Thanks.
Have a look at the GeoTools Style tutorial for details of how to display a shapefile and colour in the polygons. The tutorial only shows how to produce a single colour but you should be able to work out how to create a variable colour fill with out too much difficulty.