Select to view content in your preferred language

How to extract information from a raster to a shapefile

2509
2
03-04-2012 04:15 AM
BrunoCaprettini
New Contributor
Hello everyone.

I'm a PhD student in economics and a newbie to ArcGIS, so forgive my incompetence.

I've the following problem. I've a raster dataset with information on the number of lightning on a 50Km x 50Km cell-grid over Europe.
The information comes actually from a ASCII file but I have no problem in converting into a raster dataset.
I also have a shapefile with the borders of all the provinces of Europe, and I can superimpose the 2 datasets correctly and define a common projection for the 2.

What I would like to do is to calculate the total number of lightning that fell in every province in Europe. Since not all the cells fall exactly within 1 province, I would like to weight the number of lightning contained in every cell by the % of area of this cell that falls within every province. In this way a cell were 3 lightnings fell in 2003 that is entirely within the province of Barcelona will assign 3 lightnings to Barcelona, while another cell with 3 lightnings that were only 1/3 over the province of Barcelona would assign only 1 lightning.
The final database to be exported would be one with 1 observation for every province in Europe and the corresponding statistics for lightnings attached to it.

What I can do now is to transform the raster dataset into a point dataset, and then ask a spacial join to compute summary statistics for all the cells whose center falls within any given province.
I don't like this procedure because not only does not allow me to weight less cells that do not fall entirely within a province, but also because it does not use the information of cells whose center does not fall within the province (but still cover part of the province).

I am not sure what I should do and with which tools or file types I should work.
I tried to Clip the raster with the shapefile but it could not use the raster as an input.
I also tried to compute Zonal Statistics as a Table (under the Spatial Analyst Toolbox), but the result is a table of only 1 row.
Finally, I tried to compute Zonal Statistics but ArcGIS crashed. I run ArcGIS with an ArcInfo licence for students, btw.

I hope to have made myself clear: let me know if I can clarify something.

Thanks a lot for the help!!

Bruno
0 Kudos
2 Replies
JeffreySwain
Esri Regular Contributor
For part of your description, I would think that a Zonal Statistics as a table would be the best fit and then again you also describe something that I think that weighted overlay should be better. The key to the weighted overlay is that you will have to create the density percentage raster.  However, since you said that the zonal statistics as a table will only make one result and the zonal statistics is failing there must be something else wrong. Do the polygon and raster have the same coordinate systems?  Since you did the conversion to points, generally how many points are in each polygon?  Also are you using the Ascii file directly or did you go ahead and convert it?  I am not sure why you could not clip the raster, the Raster clip is under Data Management > Raster > Raster Processing.  That clip will take the raster as an input. There are a lot of moving parts and will probably require a stepwise process, but based on your last statement I would re evaluate your inputs.
0 Kudos
BrunoCaprettini
New Contributor
Hi Jeff,

thanks a lot for answering!


I would think that a Zonal Statistics as a table would be the best fit


This time I tried to make a Zonal Statistics as a Table with the shapefile and the ASCII file (rather than with the raster) and it did produce a real table. I think that this solves the problem of the cells whose center is not inside a province (although they partly cover them) but the mean that the Zonal Statistics produces does not seem weighted according to what % of the cell covers every province. (Still, it's an improvement thanks!!).

I still don't understand 1) why I can't produce the same Zonal Statistics with the converted Raster and 2) why the ASCII file is a little shifted to the right with respect to the raster file: the raster file comes actually from a conversion of the ASCII file!! For some strange reason the position of the raster with respect to Europe is correct, while the position of the ASCII file is not.

you also describe something that I think that weighted overlay should be better.


One problem with the weighted overlay is that my lightning data are not integers but float (I just realized that from my message it sounded like they were integer: they are expressed in # of lightning per square Km in fact). Even abstracting from this issue, I'm not sure I understand how I would use the output of a weighted overlay to get the raster information into the polygons. How can I tell the Weighted Overlay to produce this "density percentage" based on how much of a province each cell covers (it doesn't seem that the Weighted Overlay takes the shapefile as an input in any place)? Also: for cells that cover more than 1 province, how can I tell ArcGIS to give different weights when assigning their value to the different provinces?

Do the polygon and raster have the same coordinate systems? 


Yes: EU's provinces come with a Geographic Coordinate System (ETRS 1989) and I assign it correctly to the raster (I know that the assignment is correct because I double checked the spacial join of the points to the polygons).

Since you did the conversion to points, generally how many points are in each polygon?


It depends on how big the provinces are: for some, there's only 1 cell covering the whole province (and for some of these small provinces this cell has even the center outside it, so that nothing gets assigned when I join the points to the polygons); other provinces however are very big, and are covered by 8-10 points/cells. In principle, I'm sure that the join of points to polygons is a fair approximation to what I need, but since this is not the first time I'm trying to perform this operation I wanted to know whether there was a better way around.

   Also are you using the Ascii file directly or did you go ahead and convert it? 


No: the first thing I do is to Convert the ASCII to a Raster: would it be easier to work with the ASCII file?

   I am not sure why you could not clip the raster, the Raster clip is under Data Management > Raster > Raster Processing.  That clip will take the raster as an input. There are a lot of moving parts and will probably require a stepwise process, but based on your last statement I would re evaluate your inputs.


I am trying to use this clip raster but I don't understand where the output is stored (and how it should look like). The procedure seems to work fine (there is not error message), but after I clip my raster with the shapefile it seems that i) no new layer gets added to the working directory and ii) in the directory where I asked ArcGIS to store the new clipped raster there is no file called as I called the clipped raster. I tried both checking and unchecking the option "Use Input Features for Clipping Geometry (optional)". I'm not sure what I am doing wrong...


Thanks again for your help!

Bruno
0 Kudos