Re: [gdal-dev] C# OGR reading OSM features "stalls"

2014-03-05 Thread agerrius
OK, I will do that. I had thought about that before, it is doesn't feel intuitive to read tens of thousands of features from a layer and then just ignore/delete them. I had hope that with the filter I could get better performance by not reading them at all. But it seems that's not how it works wi

Re: [gdal-dev] C# OGR reading OSM features "stalls"

2014-03-04 Thread Even Rouault
Le mardi 04 mars 2014 21:41:45, agerrius a écrit : > > Only set the filter on the multipolygons layer. > > But if I don't set any filter on the other layers I do get all other point > and line features (for example highway, etc). And I don't want them, I for > example only want landuse features. S

Re: [gdal-dev] C# OGR reading OSM features "stalls"

2014-03-04 Thread agerrius
> Only set the filter on the multipolygons layer. But if I don't set any filter on the other layers I do get all other point and line features (for example highway, etc). And I don't want them, I for example only want landuse features. So I want no features to be returned from layers that don't h

Re: [gdal-dev] C# OGR reading OSM features "stalls"

2014-03-04 Thread Even Rouault
Le mardi 04 mars 2014 20:56:59, agerrius a écrit : > Even, > > In my actual application I am looping over all layers, but it still doesn't > work. > > But from your feedback I now know what is going wrong. My problem is what > to do with layers that don't contain the field I am filtering on. If I

Re: [gdal-dev] C# OGR reading OSM features

2014-03-04 Thread Jukka Rahkonen
agerrius agerrius.nl> writes: > So how would one get all the OSM features that have an attribute landuse? As > you can see I used "landuse IS NOT NULL" for the attribute filter. But if I > set that on the points layer I get an error, since there are no landuse > points. How can I set the filter

Re: [gdal-dev] C# OGR reading OSM features "stalls"

2014-03-04 Thread agerrius
Even, In my actual application I am looping over all layers, but it still doesn't work. But from your feedback I now know what is going wrong. My problem is what to do with layers that don't contain the field I am filtering on. If I apply the filter to them and error is thrown (ERROR 1: 'landuse'

Re: [gdal-dev] C# OGR reading OSM features "stalls"

2014-03-03 Thread Even Rouault
Arno, > > Now if I enable interleaved reading and add the extra do-while loop around > my code I get 0 features returned. I only apply the filter to the layer the > first time I go through the loop. > > Ogr.RegisterAll(); > Gdal.SetConfigOption("OGR_INTERLEAVED_RE

Re: [gdal-dev] C# OGR reading OSM features "stalls"

2014-03-03 Thread agerrius
Arno, I have made a small sample to show my problem. It uses the same OSM file as I mentioned above. Hopefully you can see what I did wrong from my code. If I read the data in non-interleaved mode it all works fine, I find 298 features on the layer: Ogr.RegisterAll();

Re: [gdal-dev] C# OGR reading OSM features "stalls"

2014-03-02 Thread agerrius
Even, No, this is not the same problem as before. With the changes we discussed before I did get the filter to work perfectly. But now when I add the do-while loop around it for the interleaved reading I get unexpected results again. I'll try to isolate the problem in a small sample program tonig

Re: [gdal-dev] C# OGR reading OSM features "stalls"

2014-03-02 Thread Even Rouault
Le dimanche 02 mars 2014 21:26:39, agerrius a écrit : > Thanks for the answer. > > I do have a question about the interleaved mode. I have trouble to combine > it with the SetAttributeFilter command on a layer. I have the impression > that when the first "slice" of the interleaved reading doesn't

Re: [gdal-dev] C# OGR reading OSM features "stalls"

2014-03-02 Thread agerrius
Thanks for the answer. I do have a question about the interleaved mode. I have trouble to combine it with the SetAttributeFilter command on a layer. I have the impression that when the first "slice" of the interleaved reading doesn't contain any features that match the filter, that the reading sto

Re: [gdal-dev] C# OGR reading OSM features "stalls"

2014-03-02 Thread Even Rouault
Le dimanche 02 mars 2014 17:59:49, agerrius a écrit : > Even, > > Thanks for the quick reply and the quick fix. > > I'm looking at implementing the interleaved reading in my code as well, > since some files throw an error with the normal reading mode. Are you > saying this issue will not happen w

Re: [gdal-dev] C# OGR reading OSM features "stalls"

2014-03-02 Thread agerrius
Even, Thanks for the quick reply and the quick fix. I'm looking at implementing the interleaved reading in my code as well, since some files throw an error with the normal reading mode. Are you saying this issue will not happen with interleaved reading mode? Arno -- View this message in conte

Re: [gdal-dev] C# OGR reading OSM features "stalls"

2014-03-02 Thread Even Rouault
Le dimanche 02 mars 2014 15:47:37, agerrius a écrit : > Hi all, > > I'm using the OGR libraries from a C# application to read OSM data. But I > have a problem now, with a certain file the reading of the features > "stalls". It seems GetNextFeature() never returns anything. > > When I use ogrinfo

[gdal-dev] C# OGR reading OSM features "stalls"

2014-03-02 Thread agerrius
Hi all, I'm using the OGR libraries from a C# application to read OSM data. But I have a problem now, with a certain file the reading of the features "stalls". It seems GetNextFeature() never returns anything. When I use ogrinfo -al on the same file it also seems to stall (probably at the same po