This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
new d367107cdb feat(Shapefile): generate consistant feature index when
filters are used
d367107cdb is described below
commit d367107cdb8ff621e3be4d2b465672dec4ad6ba0
Author: jsorel <[email protected]>
AuthorDate: Mon May 11 12:04:17 2026 +0200
feat(Shapefile): generate consistant feature index when filters are used
---
.../main/org/apache/sis/storage/shapefile/ShapefileStore.java | 6 +++---
.../main/org/apache/sis/storage/shapefile/shp/ShapeRecord.java | 1 +
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git
a/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/ShapefileStore.java
b/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/ShapefileStore.java
index 499b13770a..5bd2209ac6 100644
---
a/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/ShapefileStore.java
+++
b/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/ShapefileStore.java
@@ -502,7 +502,6 @@ public final class ShapefileStore extends DataStore
implements WritableFeatureSe
final int geomSrid = srid;
final boolean generateId = mustGenerateId();
- final AtomicInteger nextId = new AtomicInteger();
final String baseId = type.getName().tip().toString() +".";
final Spliterator spliterator;
@@ -529,7 +528,7 @@ public final class ShapefileStore extends DataStore
implements WritableFeatureSe
for (int i = 0; i < dbfPropertiesIndex.length;
i++) {
next.setPropertyValue(header.fields[dbfPropertiesIndex[i]].fieldName,
dbfRecord[i]);
}
- if (generateId)
next.setPropertyValue(AttributeConvention.IDENTIFIER, baseId +
nextId.incrementAndGet());
+ if (generateId)
next.setPropertyValue(AttributeConvention.IDENTIFIER, baseId +
shpRecord.recordNumber);
action.accept(next);
return true;
@@ -552,7 +551,7 @@ public final class ShapefileStore extends DataStore
implements WritableFeatureSe
shpRecord.geometry.setSRID(geomSrid);
}
next.setPropertyValue(GEOMETRY_NAME,
shpRecord.geometry);
- if (generateId)
next.setPropertyValue(AttributeConvention.IDENTIFIER, baseId +
nextId.incrementAndGet());
+ if (generateId)
next.setPropertyValue(AttributeConvention.IDENTIFIER, baseId +
shpRecord.recordNumber);
action.accept(next);
return true;
} catch (IOException ex) {
@@ -562,6 +561,7 @@ public final class ShapefileStore extends DataStore
implements WritableFeatureSe
};
} else {
//read only dbf
+ final AtomicInteger nextId = new AtomicInteger();
final DBFHeader header = dbfreader.getHeader();
spliterator = new
Spliterators.AbstractSpliterator(Long.MAX_VALUE, Spliterator.ORDERED) {
@Override
diff --git
a/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/shp/ShapeRecord.java
b/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/shp/ShapeRecord.java
index 620ebbbfc2..e31b3b9a34 100644
---
a/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/shp/ShapeRecord.java
+++
b/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/shp/ShapeRecord.java
@@ -35,6 +35,7 @@ public final class ShapeRecord {
/**
* Record number.
+ * Starts at 1 in the file.
*/
public int recordNumber;
/**