[gdal-dev] SetAttributeFilter has no effect ?

Even Rouault even.rouault at mines-paris.org
Fri Jul 8 03:08:27 EDT 2011


Selon ahmet temiz <ahmettemiz88 at gmail.com>:

GetFeature(n) returns the feature such as feature.GetFID() == n, so attribute or
spatial filter are not taken into account.

If you want to iterate over the feature of the layers, and take into account
filters, you have to use GetNextFeature(), until it returns null.

> hello
>
> I tried to implement SetAttributeFilter with a critaria.
>  There seems to have no effect on getting data.
>
> what might be wrong ?
>
> I am still getting all data
>
> here is the code fragment.
>
> ly2.SetAttributeFilter("il='kastamonu'");
>
>
> 		for (int i = 0;i<1244; i++) {
> 			Feature f = ly2.GetFeature(i);
> 			System.out.print(f.GetFID());
> 			System.out.println(" " + f.GetFieldAsString("il"));
> 			System.out.println(" " + f.GetFieldAsString("ilce"));
> 			System.out.println(" " + f.GetFieldAsString("koy"));
> 			System.out.println(" " + f.GetFieldAsString("etkili_nak"));
> 			//System.out.println(" " + f.GetFieldAsString("lkod"));
>
>
> 			out.print(f.GetFID());
> 			out.print(" " + f.GetFieldAsString("il"));
> 			out.println(" " + f.GetFieldAsString("koy"));
>
> 		}
>
>
> regards
> --
> Ahmet Temiz
> Jeoloji Müh.
> Afet ve Acil Durum Yönetimi Baþkanlýðý
> Planlama ve Zarar Azaltma Dairesi Baþkanlýðý
> Bilgi ve CBS grubu
> Eskiþehir Yolu 10. km.
> Lodumlu / Ankara
> Tel : 0 312 2872680 / 1535
> ________________________
>
> Ahmet Temiz
> Geological Eng.
> Information Systems - GIS Group
> Disaster and Emergency Management
> of Presidency
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>




More information about the gdal-dev mailing list