[gdal-dev] Gdalinfo is missing documentation for -approx_stats

2012-09-04 Thread Jukka Rahkonen
Hi,

I was reading from Quantum GIS mailing list that there exists an -approx_stats
option in gdalinfo utility but it is not documented in
http://www.gdal.org/gdalinfo.html

It looks like the author did not bother to report the issue here so I did even I
do not know what is the purpose of this approx_stats thing.

-Jukka Rahkonen-

___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] Gdalinfo is missing documentation for -approx_stats

2012-09-04 Thread Piotr Tracz

W dniu 2012-09-04 14:53, Jukka Rahkonen pisze:

I was reading from Quantum GIS mailing list that there exists an -approx_stats
option in gdalinfo utility but it is not documented in
http://www.gdal.org/gdalinfo.html

It looks like the author did not bother to report the issue here so I did even I
do not know what is the purpose of this approx_stats thing.


Here you go with purpose of it:
http://www.gdal.org/classGDALRasterBand.html#a6aa58b6f0a0c17722b9bf763a96ff069

-approx_stats sets /bApproxOK as true.

/Piotr
/
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Re: [gdal-dev] How to cut a Raster map with a KML file

2012-09-04 Thread Luis Lisboa
Thank you Chitanya. But it created an output file with two layers (one with
the values from original file and another with a 255 for the pixels thar
are inside KMZ file: How can I have just one layer?
Other thing: as far as I saw it procewssed the data without needing to have
the KML and the Geotiff in the same CRS. Can anyone confimr that this is
true?
Thanks
Luis

On Mon, Sep 3, 2012 at 5:10 PM, Chaitanya kumar CH
chaitanya...@gmail.comwrote:

 Luis,

 gdalwarp has some options for this exact purpose.
 The cutline can be from any of the OGR readable datasource.

 http://www.gdal.org/gdalwarp.html

 On Mon, Sep 3, 2012 at 9:34 PM, Luis Lisboa luislisboa1...@gmail.comwrote:

 Greetings
 I have a raster file (Geotiff) and I have a KML file with a polygon and I
 want to cut raster map to only have valid values inside the polygon. How
 can I do this using just GDAL?

 Usually I used to cut geotiff file with gdalwarp and but in those cases I
 was cutting a square (xmin xmax ymin ymax) and in this case is a more
 complex polygon

 Thanks
 Regards,
 Luis

 ___
 gdal-dev mailing list
 gdal-dev@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/gdal-dev




 --
 Best regards,
 Chaitanya kumar CH.

 +91-9494447584
 17.2416N 80.1426E

___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Re: [gdal-dev] Gdalinfo is missing documentation for -approx_stats

2012-09-04 Thread Chaitanya kumar CH
Jukka,

The option -approx_stats is useful if you want less precise statistics in
less time.
Updated the dox in the revision 24905 and 24906.

Thanks for the notice Jukka.


On Tue, Sep 4, 2012 at 6:33 PM, Piotr Tracz pi...@cgis.pl wrote:

  W dniu 2012-09-04 14:53, Jukka Rahkonen pisze:

 I was reading from Quantum GIS mailing list that there exists an -approx_stats
 option in gdalinfo utility but it is not documented 
 inhttp://www.gdal.org/gdalinfo.html

 It looks like the author did not bother to report the issue here so I did 
 even I
 do not know what is the purpose of this approx_stats thing.


  Here you go with purpose of it:

 http://www.gdal.org/classGDALRasterBand.html#a6aa58b6f0a0c17722b9bf763a96ff069

 -approx_stats sets *bApproxOK as true.

 /Piotr
 *

 ___
 gdal-dev mailing list
 gdal-dev@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/gdal-dev




-- 
Best regards,
Chaitanya kumar CH.

+91-9494447584
17.2416N 80.1426E
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

[gdal-dev] Problems with OGRGeometry Intersects

2012-09-04 Thread Gabriel Fusca
Hi,

I'm using Gdal 1.9.

I have a function that has to perform a intersection of a geometry based on
the click that is made on the screen.

The raster file (Geotiff) that has a projected reference system (WGS 84 /
UTM zone 21S)  and the geometry a georeferenced system (EPSG - 4326 WGS84).

The click that comes from the screen (spatial reference of the image)
create a geometry from calling point.Buffer (radius).

When i want to verify that the geometries intersect the intersects method
from OGRGeometry fails, even if the querypoint is transformed into the
spatial reference system of the geometry.

Envelopes from the 2 geometries.
QueryPoint
env.
if i generates the querypoint from the spatial reference of the geometry
that i want to intersect)
minx -61.66, maxx -53.66;
miny -41.97, maxy -33.97
else
minx 443322.50, maxx 443330.50
miny 5798153.59, maxy 5798161.59

Geometry env.
minx -57.79, maxx -57.59;
miny -38.08, maxy-37.92


The code is something like this:

// spatialfilterwindow image subset transformed into
// the spatial reference of the vector to intersect
Extent spatialfilter(spatialfilterwindow);
player-SetSpatialFilterRect(spatialfilter.min_.x_,
spatialfilter.min_.y_,
spatialfilter.max_.x_,
spatialfilter.max_.y_);
OGRLayer* player = ...;
OGRFeature *pfeature = player-GetNextFeature();
OGRPoint querypoint = OGRPoint(Point.x_, Point.y_);
querypoint.assignSpatialReference(new OGRSpatialReference(SrWkt.c_str()));
OGRGeometry* pquerypoly = querypoint.Buffer(radius);
 *while *(pfeature) {
OGRGeometry *pgeometry = pfeature-GetGeometryRef();
*if *((pgeometry  pgeometry-Intersects(pquerypoly) == TRUE)
|| (pquerypoly  pquerypoly-Intersects(pgeometry) == TRUE)) {
// do something...
} *else *{
// handle the intersection fail
}
pfeature = player-GetNextFeature();
}

Any idea why it fails?

Thanks,
Regards,

-- 
Gabriel Fusca
SUR Emprendimientos Tecnológicos

Perú 345  Piso 5to Oficina B (C1067AAG)
Ciudad de Buenos Aires, Argentina
Tel. +54 (11) 4342-2976/84
gabrielfu...@suremptec.com.ar
http://www.suremptec.com/
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Re: [gdal-dev] Problems with OGRGeometry Intersects

2012-09-04 Thread Even Rouault
Le mardi 04 septembre 2012 23:04:16, Gabriel Fusca a écrit :
 Hi,
 
 I'm using Gdal 1.9.
 
 I have a function that has to perform a intersection of a geometry based on
 the click that is made on the screen.
 
 The raster file (Geotiff) that has a projected reference system (WGS 84 /
 UTM zone 21S)  and the geometry a georeferenced system (EPSG - 4326 WGS84).
 
 The click that comes from the screen (spatial reference of the image)
 create a geometry from calling point.Buffer (radius).
 
 When i want to verify that the geometries intersect the intersects method
 from OGRGeometry fails, even if the querypoint is transformed into the
 spatial reference system of the geometry.
 
 Envelopes from the 2 geometries.
 QueryPoint
 env.
 if i generates the querypoint from the spatial reference of the geometry
 that i want to intersect)
 minx -61.66, maxx -53.66;
 miny -41.97, maxy -33.97
 else
 minx 443322.50, maxx 443330.50
 miny 5798153.59, maxy 5798161.59
 
 Geometry env.
 minx -57.79, maxx -57.59;
 miny -38.08, maxy-37.92
 
 
 The code is something like this:
 
 // spatialfilterwindow image subset transformed into
 // the spatial reference of the vector to intersect
 Extent spatialfilter(spatialfilterwindow);
 player-SetSpatialFilterRect(spatialfilter.min_.x_,
 spatialfilter.min_.y_,
 spatialfilter.max_.x_,
 spatialfilter.max_.y_);
 OGRLayer* player = ...;
 OGRFeature *pfeature = player-GetNextFeature();
 OGRPoint querypoint = OGRPoint(Point.x_, Point.y_);
 querypoint.assignSpatialReference(new OGRSpatialReference(SrWkt.c_str()));
 OGRGeometry* pquerypoly = querypoint.Buffer(radius);
  *while *(pfeature) {
 OGRGeometry *pgeometry = pfeature-GetGeometryRef();
 *if *((pgeometry  pgeometry-Intersects(pquerypoly) == TRUE)
 
 || (pquerypoly  pquerypoly-Intersects(pgeometry) == TRUE)) {
 
 // do something...
 } *else *{
 // handle the intersection fail
 }
 pfeature = player-GetNextFeature();
 }
 
 Any idea why it fails?

I suspect that you assumed assignSpatialReference() would do the reprojection, 
which isn't the case (it just blindly assigns the specified SRS, but doesn't 
alter the geometry coordinates). You must use the TransformTo() method 
instead.

Incidental comment : you don't need to test ( A-Insersects(B) || B-
Insersects(A)). Intersects() is a symetrical operation, so just one test will 
be enough. 

 
 Thanks,
 Regards,
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev