I use ST_area(geometry) in order to calculate the area of each grid cell of a vector grid with LCC projection and 6x6km2 resolution. The CRS of the vector is: +proj=lcc +lat_1=45 +lat_2=22 +lat_0=38.7 +lon_0=20 +x_0=0 +y_0=0 +a=6370000 +b=6370000 +units=m +no_defs

I do the following:

ogrinfo -dialect SQLite -sql "SELECT id,ST_Area(geometry) as AREA FROM grid" grid.shp
ogrinfo grid.shp -sql "ALTER TABLE grid ADD COLUMN AREA_grid float"
ogrinfo grid.shp -dialect SQLite -sql "UPDATE grid SET AREA_grid =ST_Area(geometry)"

The result is that the area_grid takes the value of 36000000m2 for all grid cells. This is not correct since the real area of grid cell slightly varies in different coordinates.

Do I have to define in a different way the area of the grid cell?

  • What spatial reference are you using? (Please Edit the question) If it's a projected CS, the projection is assumed to be Cartesian. You'd have to deproject to geographic CS, then cast to geography to get a spheroidal area. – Vince Feb 8 '19 at 18:57
  • @Vince I didn't understand what you mean. I edited the question and wrote the exact projection I used, the datum is spherical and the units are in meters. Do I have to reproject the grid in another projection? – Nat Feb 9 '19 at 8:27

Your grid is 6km x 6km so each cell will remain 36 square km. No matter what your projection each grid cell will be the same. The shape of each grid cell will likely change. Whether you can perceive this in your data. I'm not sure

|improve this answer|||||
  • in QGIS , for example, when I calculate the $area of each grid cell of the specific vector file it calculates the real area (which varies for each grid cell in different coordinates). Are you saying that this is not possible to achieve with ogrinfo? – Nat Feb 12 '19 at 7:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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