FeatureIterator is intended to be an efficient way to iterate through individual Features in a FeatureCollection without ever having to parse the entire FeatureCollection into memory at once.
To do so, it seeks through the input stream until it finds the features array, and then starts parsing the individual features one by one.
Currently however, the way we seek to the "start of the features" array is looking for any occurrence of [. This would fail with a document like:
FeatureIterator
is intended to be an efficient way to iterate through individual Features in a FeatureCollection without ever having to parse the entire FeatureCollection into memory at once.To do so, it seeks through the input stream until it finds the features array, and then starts parsing the individual features one by one.
Currently however, the way we seek to the "start of the features" array is looking for any occurrence of
[
. This would fail with a document like:or more complicated ones like this:
We should update FeatureIterator to be more robust in how it parses a FeatureCollection.