diff --git a/datasources/shape/shape_featureset.cpp b/datasources/shape/shape_featureset.cpp index 93a4fef24..8bb1bada3 100644 --- a/datasources/shape/shape_featureset.cpp +++ b/datasources/shape/shape_featureset.cpp @@ -94,9 +94,16 @@ feature_ptr shape_featureset::next() while (!filter_.pass(shape_.current_extent())) { unsigned reclen=shape_.reclength_; - shape_.move_to(long(shape_.shp().pos()) + 2 * reclen - 36); - if ((long)shape_.shp().pos() >= file_length_ * 2) + if (!shape_.shp().is_eof()) + { + long pos = shape_.shp().pos(); + shape_.move_to(pos + 2 * reclen - 36); + } + else + { return feature_ptr(0); + + } } switch (type) diff --git a/datasources/shape/shape_index_featureset.cpp b/datasources/shape/shape_index_featureset.cpp index dfaabedec..2b321561c 100644 --- a/datasources/shape/shape_index_featureset.cpp +++ b/datasources/shape/shape_index_featureset.cpp @@ -19,6 +19,7 @@ //$Id: shape_index_featureset.cc 36 2005-04-05 14:32:18Z pavlenko $ #include "shape_index_featureset.hpp" +#include "feature_factory.hpp" template shape_index_featureset::shape_index_featureset(const filterT& filter, @@ -66,8 +67,8 @@ feature_ptr shape_index_featureset::next() int pos=*itr_++; shape_.move_to(pos); int type=shape_.type(); - feature_ptr feature(new Feature(shape_.id_)); - + feature_ptr feature(feature_factory::create(shape_.id_)); + if (type==shape_io::shape_point) { double x=shape_.shp().read_double();