tags:

views:

653

answers:

4

I have a shapefile of India with states (probably as polygons). I want to convert each polygon into equally divided cells ("raster" way), and populate (actually coloring) each cell by a value that would be calculated from an algorithm which is cell's location specific. This should be done for all the cells in the polygon (programmatically) so that at the end I have the shapefile, looking as a thematic (of what my algorithm calculates), raster image. I am not starting any image because the information is actually calculated value from algorithm and not coming from satellite imagery or anything like that.

In other words, it is not a vegetation or elevation thematic but something like population distribution, where each value (color) of cell represents a mean value of population there, showing wholly as a distribution at large scale.

Can any one please help how to do this using any open source application? (both as application and also programmatically using API like sharpmap) Please help

A: 

One easy way to do this would be to use Mapnik and its Python binding. See their site for a tutorial on thebasic usage and their XML configuration schema.

Kitto
A: 

I've done this using MapScript (from UMN's Mapserver).

http://mapserver.org/mapscript/index.html#mapscript

It's fairly straight forward and has many bindings (PHP, Ruby, Python, .NET and so forth), but the API is the same across all bindings. Those bindings when I last used it were of varying quality and I'm not up to date on the current quality

Vinko Vrsalovic
A: 

The GDAL utilities and scripting would be my choice.

http://www.gdal.org/index.html

I don't quite understand how you are going to decide cell values based on position, but have a look at the following utilites:

http://www.gdal.org/gdal_grid.html

http://www.gdal.org/gdal_rasterize.html

If you can't get the required output from the command line, then the GDAL functions can be scripted (C++ or Python have the most examples).

geographika
A: 

Hi,

I've done this using python and GDAL by following the instructions outlined here:

http://proj.lis.ic.unicamp.br/webmaps/docs/calc_ndvi/

I hope this helps.

ps. The site is in portugese, so if you don't speak the language you may find Google translate very useful. Good luck.

n

nayden