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

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to create a raster from point data, averaging the point data over a given area and placing the results into a given pixel/cell. With each pixel/cell as 50m x 50m.

I'm new to this and have a beginner question.

I see that in PostGIS 2.0 there is a ST_MakeEmptyRaster() function, but what are the units for width, height, and pixelsize. And how do you determine the upperleftx, upperlefty points? Is this just random, or is there a convention used to determine this point?

raster ST_MakeEmptyRaster(integer width, integer height, float8 upperleftx, float8 upperlefty, float8 pixelsize);
share|improve this question
Also would be useful to know if the coordinate represents the corner of the upperleft pixel, or the centroid of the pixel. – Kirk Kuykendall Apr 11 '12 at 14:44

The units are not random but depend on your SRID. If you have no SRID then they are "unknown". The coordinates are wherever you want them to be in the real world and in the units of your SRID (be that decimal degrees or meters or whatever). In other words, the location and size of the raster is up to you.

You could work this out by getting the extent of your point data (possibly adding a margin around the edge to reduce edge effects). Alternatively, if you have a raster that covers the area in question, you could pass that into ST_MakeEmptyRaster as a 'seed' instead of all the coordinates. Or, a "cheap-and-dirty" way to get your coordinates if you don't have another raster handy and don't know how to get the extent of your point data (or can't be bothered to calculate your buffer) is to digitize a polygon in an appropriate SRID (or simply buffer your point data). Then convert to a raster either setting all the data to Null or using this as a seed for ST_MakeEmptyRaster.

share|improve this answer
I'd like to express the cell's width, height and size in meters, is there a commmon SRID that handles this? – monkut Apr 12 '12 at 1:22
That's not part of the SRID. That is just down to the resolution of your raster. You can type in the x and y pixel sizes as parameters in ST_MakeEmptyRaster. Alternatively, if you are using another raster as a seed, it will take those dimensions from the seed raster. In other words, the resolution of the raster is in your control. Let's say you want a raster with a nominal ground resolution of 10m, then (assuming you are using an SRID with meters as the units) simply enter 10 for the x and y pixel dimensions. Note, the X an Y dimensions don't need to be the same. It is just more usual. – MappaGnosis Apr 12 '12 at 9:07
Thanks! I'll play around and see what I can do. – monkut Apr 12 '12 at 12:58

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.