diff gnv-artifacts/src/main/java/de/intevation/gnv/utils/ShapeFileWriter.java @ 655:6eccb68a8b99

Added WMS-Publishing to Product Layer gnv-artifacts/trunk@747 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Mon, 08 Mar 2010 14:04:28 +0000
parents 4fc97074eb90
children 22dc921cd8b1
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/utils/ShapeFileWriter.java	Mon Mar 08 10:51:01 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/ShapeFileWriter.java	Mon Mar 08 14:04:28 2010 +0000
@@ -178,9 +178,11 @@
     }
 
     
-    public static boolean writeDataToFile(File shapeFile,
+    public static String writeDataToFile(File shapeFile,
                                           String name,
                                           Collection<Result> data){
+        String geomType = null;
+        
         WKTReader wktReader = new WKTReader();
         
         Map<String, Serializable> params = new HashMap<String, Serializable>();
@@ -190,7 +192,7 @@
         }
         catch (MalformedURLException mue) {
             log.error(mue.getLocalizedMessage(), mue);
-            return false;
+            return null;
         }
 
         params.put("create spatial index", Boolean.TRUE);
@@ -210,6 +212,7 @@
                 Geometry g = wktReader.read(result.getString(0));
                 if (type == null){
                     try { 
+                        geomType = g.getGeometryType().toUpperCase();
                         type = DataUtilities.createType(
                             name,
                             "geom:"+g.getGeometryType()+":srid=4326");
@@ -217,7 +220,7 @@
                     }
                     catch (SchemaException se) {
                         log.error(se.getLocalizedMessage(), se);
-                        return false;
+                        return null;
                     }
                     featureBuilder = new SimpleFeatureBuilder(type);
                 }
@@ -271,7 +274,7 @@
             }
         }
 
-        return success;
+        return geomType;
         
     }
     

http://dive4elements.wald.intevation.org