Re: [gdal-dev] zonal statistics with gdal

2012-06-23 Thread jdmorgan
Anssim, Petteri and others, Thanks for you great feedback on this topic. Cheers, Derek On 6/20/2012 5:26 AM, anssi wrote: If you first rasterize your shapefile to the extent of your raster, you can compute some basic stats and/or full histogram for your polygons using Open Foris Geospatial Too

Re: [gdal-dev] zonal statistics with gdal

2012-06-20 Thread anssi
Dear Even, many thanks for your prompt reply and the link. I found them both very helpful! Cheers, anssi On Wed, Jun 20, 2012 at 4:00 PM, Even Rouault wrote: > Selon anssi : > >> Dear Joaquim, >> >> thanks for pointing that out. >> >> There´s absolutely no intention to abuse any of the great

Re: [gdal-dev] zonal statistics with gdal

2012-06-20 Thread Even Rouault
Selon anssi : > Dear Joaquim, > > thanks for pointing that out. > > There´s absolutely no intention to abuse any of the great work of the > gdal/ogr developers. Rather the opposite. > > The license is being discussed as we speak and we're considering > various options. What would you suggest? Sho

Re: [gdal-dev] zonal statistics with gdal

2012-06-20 Thread Jose Gomez-Dans
Hi, On 19 June 2012 17:37, jdmorgan wrote: > Is there a way to do something along the lines of zonal statistics with > gdal.  Basically, I have a county shape file and a classified raster > dataset.  I would like to count the number of raster pixels/county (FIPS). > Is this possible with GDAL/O

Re: [gdal-dev] zonal statistics with gdal

2012-06-20 Thread anssi
No problem at all, you had a good point. Anyone here who knows these issues thoroughly and could provide some recommendations? Cheers, Anssi On Wed, Jun 20, 2012 at 3:20 PM, Joaquim Luis wrote: > Anssi, > > OK, may I overreact a bit. It's just that I don't like GPL much, specially > when it

Re: [gdal-dev] zonal statistics with gdal

2012-06-20 Thread Giuseppe Amatulli
Ciao, keeping on the issues of the Subject:"zonal statistics with gdal", one month ego i put on the web page http://www.spatial-ecology.net/doku.php?id=wiki:geo_tools a python script that calculate zonal statistics between two raster. Is not so fast as the Anssi's OpenForis but i could coded by my

Re: [gdal-dev] zonal statistics with gdal

2012-06-20 Thread Joaquim Luis
Anssi, OK, may I overreact a bit. It's just that I don't like GPL much, specially when it used on codes that rely on non GPLed codes. But this thing of licensing issue is delicate (and boring), so you'll excuse me if I don't give you one opinion on what you should. The most I can say is that

Re: [gdal-dev] zonal statistics with gdal

2012-06-20 Thread anssi
Dear Joaquim, thanks for pointing that out. There´s absolutely no intention to abuse any of the great work of the gdal/ogr developers. Rather the opposite. The license is being discussed as we speak and we're considering various options. What would you suggest? Should it be MIT or would , for ex

Re: [gdal-dev] zonal statistics with gdal

2012-06-20 Thread Joaquim Luis
One other thing called my attention. If, as we can read on the wiki page of OFGT "... Most of the stand-alone programs use GDAL libraries and many of the scripts rely heavily on GDAL command-line utilities." than why the OFGT's licence is GPL? I know MIT's license allows it, but it clearly l

Re: [gdal-dev] zonal statistics with gdal

2012-06-20 Thread Etienne Tourigny
Distributing software via dropbox is a rather unusual practice, you might consider hosting it elsewhere... Etienne On Wed, Jun 20, 2012 at 6:53 AM, chenliang wang wrote: > Hi, Anssi > > Cool ! Open Foris Geospatial Toolkit is a great geospatial library . > Unfortunately, I can't download it from

Re: [gdal-dev] zonal statistics with gdal

2012-06-20 Thread chenliang wang
Hi, Anssi Cool ! Open Foris Geospatial Toolkit is a great geospatial library . Unfortunately, I can't download it from dropbox site because ofInternet censorship of China. Can u upload it to other site or send it for me? Thanks a lot. I are a Linux and MINGW user . Chen-Liang Wang 于 2012-6-

Re: [gdal-dev] zonal statistics with gdal

2012-06-20 Thread anssi
If you first rasterize your shapefile to the extent of your raster, you can compute some basic stats and/or full histogram for your polygons using Open Foris Geospatial Toolkit : http://km.fao.org/OFwiki/index.php/Open_Foris_Toolkit Installation instructions are under the "How to get it?" link.

Re: [gdal-dev] zonal statistics with gdal

2012-06-20 Thread Anton Korosov
Hi, though be prepared that converting large images into shape is quite slow. I would go opposite way: convert a shape to a raster [0, 1]; extract band from the image as another raster [2]; and then extract statistics using Numpy [e.g. 3]. [0] http://stackoverflow.com/questions/2220749/raste

Re: [gdal-dev] zonal statistics with gdal

2012-06-19 Thread Petteri Packalen
Derek, Look at the http://starspan.projects.atlas.ca.gov project. Petteri On Tue, 19 Jun 2012, jdmorgan wrote: Hello, Is there a way to do something along the lines of zonal statistics with gdal.Basically, I have a county shape file and a classified raster dataset.I would like to count the

Re: [gdal-dev] zonal statistics with gdal

2012-06-19 Thread Alexander Bruy
Hi, you can use GDAL Python bindigs for this [0, 1]. The process may look as open shape and raster, then convert pixel coordinates into map (shape) coordinates and process only pixels inside your polygon. [0] http://gdal.org/gdal_tutorial.html [1] http://gdal.org/ogr/ogr_apitut.html 2012/6/19 jd

[gdal-dev] zonal statistics with gdal

2012-06-19 Thread jdmorgan
Hello, Is there a way to do something along the lines of zonal statistics with gdal.Basically, I have a county shape file and a classified raster dataset.I would like to count the number of raster pixels/county (FIPS).Is this possible with GDAL/OGR?If so can someone point me in the right dire

Re: [gdal-dev] Zonal statistics with GDAL/StarSpan

2008-12-19 Thread Greg Ederer
That's interesting.  This may explain why the --fid switch has no effect.  I wonder what the --fid switch is for, then. Brent Fraser wrote: Is the FID supposed to be in the .dbf file that accompanies the .shp file? I have examined this file, and I don't see an FID column (col

Re: [gdal-dev] Zonal statistics with GDAL/StarSpan

2008-12-19 Thread Brent Fraser
Is the FID > supposed to be in the .dbf file that accompanies the .shp file? > I have examined this file, and I don't see an FID column (column > names are in the first row). In particular, since starspan2 > reports an FID of 0 for Zemmour, Mauritania, I would expect to > see a column with t

Re: [gdal-dev] Zonal statistics with GDAL/StarSpan

2008-12-19 Thread Greg Ederer
Great question.  I should have mentioned that I did so, and didn't see anything weird.  I zoomed way in, and it just looks like an unbroken line.  I did this with the Tiris Zemmour polygon selected, and again with the Adrar polygon selected, hoping something would pop out.  But, it looks fine.

Re: [gdal-dev] Zonal statistics with GDAL/StarSpan

2008-12-19 Thread Greg Ederer
a) Is there some way to get a dump of FIDs with their corresponding country/province names? You could use dbfdump. I think it is delivered with FWTools. Is the FID supposed to be in the .dbf file that accompanies the .shp file?  I have examined this file, and I don't s

Re: [gdal-dev] Zonal statistics with GDAL/StarSpan

2008-12-19 Thread Brent Fraser
> Hi, > > I performed the OpenJump procedure. But, I still get: > > Macintosh-4:starspan_tests gregederer$ starspan2 --progress --RID none > --vector afadmn2n.shp --fid 3 --raster rfe_2006_04_pct.tif --stats > results.txt avg --out-prefix bar --out-type table > Number of features: 550 > starspan_

Re: [gdal-dev] Zonal statistics with GDAL/StarSpan

2008-12-19 Thread Greg Ederer
Hi, I performed the OpenJump procedure. But, I still get: Macintosh-4:starspan_tests gregederer$ starspan2 --progress --RID none --vector afadmn2n.shp --fid 3 --raster rfe_2006_04_pct.tif --stats results.txt avg --out-prefix bar --out-type table Number of features: 550 starspan_csv: 1: E

Re: [gdal-dev] Zonal statistics with GDAL/StarSpan

2008-12-18 Thread Greg Ederer
Thanks, Brent. I'll give this a whirl. Cheers, Greg Brent Fraser wrote: Greg, OpenJump is a good topology/geometry fixing tool. Load your shapefile and do Tools->Generate->Buffer, set the Buffer distance to 0 to clean up the polygon vertices. I seem to recall it may have a problem pres

Re: [gdal-dev] Zonal statistics with GDAL/StarSpan

2008-12-18 Thread Brent Fraser
Greg, OpenJump is a good topology/geometry fixing tool. Load your shapefile and do Tools->Generate->Buffer, set the Buffer distance to 0 to clean up the polygon vertices. I seem to recall it may have a problem preserving attributes when the results are saved as a shapefile, but you may be a

Re: [gdal-dev] Zonal statistics with GDAL/StarSpan

2008-12-18 Thread Greg Ederer
Brent, My Google search didn't turn up much of use (most of the results were PostGIS-specific). Do you know of a tool that would tell me which feature(s) have problems? Do you know of a tool that might be able to fix these polygons? Thanks! Greg Brent Fraser wrote: Greg, It means the

Re: [gdal-dev] Zonal statistics with GDAL/StarSpan

2008-12-18 Thread Brent Fraser
Greg, It means the GEOS topology library is having problems with geometry of your input shapefile. Most likely related to duplicate vertices (or near-duplicate) in a polygon. Do a Google for "side location conflict". It would be nice if it spat out the FID of the offending polygon... Bre

Re: [gdal-dev] Zonal statistics with GDAL/StarSpan

2008-12-18 Thread Greg Ederer
Hi Brent, Thanks for the example. Here's what I got: Macintosh-4:starspan_tests gregederer$ starspan2 --progress --RID none --vector /Users/gregederer/servers/geoserver_data/data/shapefiles/Admin/afadmn2n.shp --raster rfe_2006_04_pct.tif --stats results.txt avg starspan: --out-prefix: ? T

Re: [gdal-dev] Zonal statistics with GDAL/StarSpan

2008-12-18 Thread Brent Fraser
Greg, I've used StarSpan to do similar things; in my case I wanted "mode" not "avg". Using v1.2.01 (I don't think I made major mods to the source): starspan2.exe --progress --RID none --vector boundaries.shp --raster big.tif --stats results.txt mode I edited the resulting results.

[gdal-dev] Zonal statistics with GDAL/StarSpan

2008-12-18 Thread Greg Ederer
Hello all, I'm a GDAL newbie. I have a shape file containing subnational boundaries for Africa. I have a raster containing rainfall for Africa. I need to pull out the spatial average of rainfall for each of the subnational units. I think that I might be able to pull this off using StarSpa