From c3a768581480c1c800e39cea941eee228bc3127a Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期五, 25 十一月 2022 15:02:15 +0800
Subject: [PATCH] 1

---
 src/main/java/com/lf/server/helper/GdbHelper.java |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/main/java/com/lf/server/helper/GdbHelper.java b/src/main/java/com/lf/server/helper/GdbHelper.java
index 6398ea7..11a27f9 100644
--- a/src/main/java/com/lf/server/helper/GdbHelper.java
+++ b/src/main/java/com/lf/server/helper/GdbHelper.java
@@ -127,7 +127,7 @@
      */
     private static Field getGeomField(Class clazz) {
         try {
-            Field gField = clazz.getDeclaredField("geom");
+            Field gField = clazz.getSuperclass().getDeclaredField("geom");
             gField.setAccessible(true);
 
             return gField;
@@ -229,10 +229,10 @@
      * wkbLinearRing = 101
      */
     private static <T> void setGeom(T t, Feature f, Field gField) throws Exception {
-        Geometry geometry = f.GetGeometryRef();
-        if (null != geometry) {
-            String wkt = geometry.ExportToWkt();
-            switch (geometry.GetGeometryType()) {
+        String geo = "null";
+        if (null != f.GetGeometryRef()) {
+            String wkt = f.GetGeometryRef().ExportToWkt();
+            switch (f.GetGeometryRef().GetGeometryType()) {
                 case 2:
                     wkt = wkt.replace("LINESTRING (", "MULTILINESTRING ((") + ")";
                     break;
@@ -242,9 +242,10 @@
                 default:
                     break;
             }
-
-            gField.set(t, String.format("ST_GeomFromText('%s')", wkt));
+            geo = String.format("ST_GeomFromText('%s')", wkt);
         }
+
+        gField.set(t, geo);
     }
 
     /**

--
Gitblit v1.9.3