You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by js...@apache.org on 2026/05/11 13:37:32 UTC
(sis) 02/02: feat(Shapefile): add support for timezone parameter
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
commit ea81e2ea107ffefed07576cb68d583715e1309bb
Author: jsorel <jo...@geomatys.com>
AuthorDate: Mon May 11 15:37:03 2026 +0200
feat(Shapefile): add support for timezone parameter
---
.../org/apache/sis/storage/shapefile/ShapefileProvider.java | 13 ++++++++++---
.../main/org/apache/sis/storage/shapefile/dbf/DBFField.java | 2 +-
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/ShapefileProvider.java b/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/ShapefileProvider.java
index db23ad3371..89e4d9a001 100644
--- a/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/ShapefileProvider.java
+++ b/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/ShapefileProvider.java
@@ -54,12 +54,20 @@ public final class ShapefileProvider extends DataStoreProvider {
.setRequired(true)
.create(URI.class, null);
+ /**
+ * Timezone of the dbf date fields.
+ */
+ public static final ParameterDescriptor<String> ZONEID = new ParameterBuilder()
+ .addName(TIMEZONE)
+ .setRequired(false)
+ .create(String.class, null);
+
/**
* Shapefile store creation parameters.
*/
public static final ParameterDescriptorGroup PARAMETERS_DESCRIPTOR =
new ParameterBuilder().addName(NAME).addName("EsriShapefileParameters").createGroup(
- PATH);
+ PATH, ZONEID);
private static ShapefileProvider INSTANCE;
@@ -117,7 +125,6 @@ public final class ShapefileProvider extends DataStoreProvider {
*/
@Override
public DataStore open(StorageConnector connector) throws DataStoreException {
- final Path path = connector.getStorageAs(Path.class);
- return new ShapefileStore(path);
+ return new ShapefileStore(connector);
}
}
diff --git a/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/dbf/DBFField.java b/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/dbf/DBFField.java
index 055d9b8486..9896943a70 100644
--- a/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/dbf/DBFField.java
+++ b/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/dbf/DBFField.java
@@ -151,7 +151,7 @@ public final class DBFField {
switch (Character.toUpperCase(fieldType)) {
case TYPE_BINARY : valueClass = Long.class; reader = this::readBinary; writer = this::writeBinary; break;
case TYPE_CHAR : valueClass = String.class; reader = this::readChar; writer = this::writeChar; break;
- case TYPE_DATE : valueClass = LocalDate.class; reader = this::readDate; writer = this::writeDate; break;
+ case TYPE_DATE : valueClass = timezone == null ? LocalDate.class : ZonedDateTime.class; reader = this::readDate; writer = this::writeDate; break;
case TYPE_NUMBER : {
if (fieldDecimals != 0) { valueClass = Double.class; reader = this::readNumber; writer = this::writeNumber;
format = NumberFormat.getNumberInstance(Locale.US);