Sign up ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I want to create a multi-colored raster layer to overlay on my map in OpenLayers

I have the following information in my DataBase:

D_Cell_ID          Long            Lat         ColorCode
055113             121.4698        40.8417     FF6600
057113             121.4698        40.8325     FF6600
063125             121.0344        40.4658     FFCC00
063127             121.0344        40.4567     FFCC00

I would like to have the output something similar like this:Example

raster overlay

Hence I need to write some code to create a raster image based on long,latt,color information.

Do anyone know how to do this? or any library tool which can import into Java environment to do this?

Method and direction is needed. Thank you!

share|improve this question
are you aware of – Vincent Warmerdam Jan 29 '14 at 12:48
yes. I do. why? – jhyap Feb 6 '14 at 7:02

3 Answers 3

One way to do it is to see if you can get d3 to work with openlayers. D3 will plot on top of openlayers on the client side of the browser.

There are some demo's listed here, but they seem to be waiting for a websocket to respond before the tiles get in;

It depends on how attached you are to openlayers, leaflet might offer you a good alternative, it allows for plotting geojson ontop of its maps straight. It also has great d3 support.

share|improve this answer
What is the performance different between I use OpenLayers.Format.GeoJSON to add the vector layer compare to using d3? – jhyap Jan 25 '14 at 14:48
I would not know openlayers too well. D3 basically places SVG elements ontop of your map. Openlayers might have a similar feature, the benefit of d3 is that you would have more interactivity. D3 is a steep learning curve though. – Vincent Warmerdam Jan 25 '14 at 15:47

If your data is on a regular (ie equally-spaced) lat-long grid, then you can use Geotools or the GDAL Java bindings to create a georeferenced image file - basically an image file with metadata saying where the pixels are.

Having done that, add the image to your OpenLayers map as an Image layer: with the correct extent.

Note the layer in the example site you gave is showing tiles from a tile server - these look like they are probably pre-rendered from polygonal vector data.

share|improve this answer

I think, you'll find in the Geotools library, what you are looking for :

There are an objet which aim is to write GeoTiff file :

After you can serve the generated Geotiff file throught Geoserver.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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