[gdal-dev] vertex counts in ogr

2012-06-20 Thread Cody Schank
Hi, I just started using ogr a couple of weeks ago, as I move away from arcpy. After some head scratching, I came up with the following code to get a vertex count for a polygon shapefile: numVertices = 0 dataSource = driver.Open(shp, 0) layer = dataSource.GetLayer() for feature in layer: ge

Re: [gdal-dev] Updating shapefile "fields" name with ogr2ogr

2012-06-20 Thread Paolo Corti
On Wed, Jun 20, 2012 at 7:50 PM, Even Rouault wrote: > > ogrinfo CHEMIN.shp -sql "ALTER TABLE CHEMIN RENAME COLUMN prec_alti TO foo" > really nice, I was not aware of this. Another option I have been always using is: ogr2ogr -sql 'select field1, field2, fieldn, ..., oldname as newname from input

Re: [gdal-dev] Updating shapefile "fields" name with ogr2ogr

2012-06-20 Thread Even Rouault
Le mercredi 20 juin 2012 18:41:40, Emmanuel Séguin a écrit : > Hi, > > This may be very easy but I did not find a way to use ogr2ogr to change > a shapefile field (attribute) name. > I've tried something like this : ' ogr2ogr -f "ESRI Shapefile" -sql > "ALTER TABLE CHEMIN RENAME COLUMN prec_alti T

[gdal-dev] Updating shapefile "fields" name with ogr2ogr

2012-06-20 Thread Emmanuel Séguin
Hi, This may be very easy but I did not find a way to use ogr2ogr to change a shapefile field (attribute) name. I've tried something like this : ' ogr2ogr -f "ESRI Shapefile" -sql "ALTER TABLE CHEMIN RENAME COLUMN prec_alti TO foo" CHEMIN2.shp CHEMIN.shp ' but I get the following error "ERROR

Re: [gdal-dev] OGR 1.9.0 won't open DGN file

2012-06-20 Thread Jukka Rahkonen
Jukka Rahkonen mmmtike.fi> writes: > > Zoltan Szecsei geograph.co.za> writes: > > Just do > > ogrinfo -al -so Sorry, after really reading your message I notice that you were not after the standard summary report. Read this page about OGR and SQL and start playing with your data http://www

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] OGR 1.9.0 won't open DGN file

2012-06-20 Thread Jukka Rahkonen
Zoltan Szecsei geograph.co.za> writes: Just do ogrinfo -al -so -Jukka Rahkonen ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev

Re: [gdal-dev] OGR 1.9.0 won't open DGN file

2012-06-20 Thread Zoltan Szecsei
On 2012/06/20 12:56, Even Rouault wrote: Selon Zoltan Szecsei: Hi, I have some DGN v7 files with contours, and I wish to add up the total length of all the contours in the file. Using: zls@gs0:~/ngi10k/ngi10k_geo$ ogrinfo --version GDAL 1.9.0, released 2011/12/29 I get: zls@gs0:~/ngi10k/ngi10

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] [gdal_translate] Spatial subset HDF4Image with multiple subdatasets?

2012-06-20 Thread Jose Gomez-Dans
Hi, On 20 June 2012 14:13, Vincent Schut wrote: > On 06/20/2012 02:55 PM, Etienne Tourigny wrote: >> >> You could combine them as a multi-band gtiff file for example > > No, in this case (MOD09GA data) you cannot, because the subdatasets have > different resolutions / raster sizes, and datatype

Re: [gdal-dev] [gdal_translate] Spatial subset HDF4Image with multiple subdatasets?

2012-06-20 Thread dcd
On 06/20/2012 02:55 PM, Etienne Tourigny wrote: > You could combine them as a multi-band gtiff file for example No, in this case (MOD09GA data) you cannot, because the subdatasets have different resolutions / raster sizes, and datatypes. Imho there is no other way than to subset each subdataset

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] [gdal_translate] Spatial subset HDF4Image with multiple subdatasets?

2012-06-20 Thread Vincent Schut
On 06/20/2012 02:55 PM, Etienne Tourigny wrote: You could combine them as a multi-band gtiff file for example No, in this case (MOD09GA data) you cannot, because the subdatasets have different resolutions / raster sizes, and datatypes. Imho there is no other way than to subset each subdataset s

Re: [gdal-dev] [gdal_translate] Spatial subset HDF4Image with multiple subdatasets?

2012-06-20 Thread dcd
You could combine them as a multi-band gtiff file for example Yes, but I could just as easily combine the individual subdatasets after using "-sds" switch or Even's method into a single HDF4Image as well. I'd rather just be able to do that all in one line using the "-b" switch in gdal_translate w

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] [gdal_translate] Spatial subset HDF4Image with multiple subdatasets?

2012-06-20 Thread Etienne Tourigny
You could combine them as a multi-band gtiff file for example On Wed, Jun 20, 2012 at 9:50 AM, dcd wrote: > > Le mardi 19 juin 2012 23:55:49, dcd a écrit : >> Hi, >> >> Is it possible to spatially subset an HDF4Image that contains multiple >> subdatasets using gdal_translate (GDAL 1.9.1)? When us

Re: [gdal-dev] [gdal_translate] Spatial subset HDF4Image with multiple subdatasets?

2012-06-20 Thread dcd
Le mardi 19 juin 2012 23:55:49, dcd a écrit : > Hi, > > Is it possible to spatially subset an HDF4Image that contains multiple > subdatasets using gdal_translate (GDAL 1.9.1)? When using a spatial subset > switch ("-a_ullr"), I get the following response: > > "Input file contains subdatasets. Pl

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] OGR 1.9.0 won't open DGN file

2012-06-20 Thread Even Rouault
Selon Zoltan Szecsei : > Hi, > I have some DGN v7 files with contours, and I wish to add up the total > length of all the contours in the file. > > Using: > zls@gs0:~/ngi10k/ngi10k_geo$ ogrinfo --version > GDAL 1.9.0, released 2011/12/29 > > I get: > zls@gs0:~/ngi10k/ngi10k_geo$ ogrinfo 3117bb_lin

Re: [gdal-dev] add my email

2012-06-20 Thread Ari Jolma
On 06/20/2012 12:59 PM, SIVA RAMA KRISHNA wrote: s.r.kriis...@gmail.com http://lists.osgeo.org/listinfo/gdal-dev ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev

[gdal-dev] add my email

2012-06-20 Thread SIVA RAMA KRISHNA
s.r.kriis...@gmail.com ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev

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.

[gdal-dev] OGR 1.9.0 won't open DGN file

2012-06-20 Thread Zoltan Szecsei
Hi, I have some DGN v7 files with contours, and I wish to add up the total length of all the contours in the file. Using: zls@gs0:~/ngi10k/ngi10k_geo$ ogrinfo --version GDAL 1.9.0, released 2011/12/29 I get: zls@gs0:~/ngi10k/ngi10k_geo$ ogrinfo 3117bb_lin_v7.dgn INFO: Open of `3117bb_lin_v7.dg

Re: [gdal-dev] Cannot read NetCDF subdatasets

2012-06-20 Thread Paolo Corti
On Tue, Jun 19, 2012 at 7:48 PM, Etienne Tourigny wrote: > no... unless your system uses the hdf5 driver before the netcdf driver. > > If the netcdf driver detects a hdf5 file that ends with nc, nc2, nc4 > or cdf (the common extensions) then it opens it, else it passes it to > the hdf5 driver. > T

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