polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [35/50] [abbrv] zest-qi4j git commit: Updates, Cleanup and preparation for a pull request.
Date Fri, 17 Apr 2015 16:46:22 GMT
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/d305f9da/libraries/spatial/src/main/java/org/qi4j/library/spatial/projection/transformations/fromto/ToHelper.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/projection/transformations/fromto/ToHelper.java b/libraries/spatial/src/main/java/org/qi4j/library/spatial/projection/transformations/fromto/ToHelper.java
new file mode 100644
index 0000000..752dffd
--- /dev/null
+++ b/libraries/spatial/src/main/java/org/qi4j/library/spatial/projection/transformations/fromto/ToHelper.java
@@ -0,0 +1,150 @@
+/*
+ * Copyright 2014 Jiri Jetmar.
+ *
+ * Licensed  under the  Apache License,  Version 2.0  (the "License");
+ * you may not use  this file  except in  compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed  under the  License is distributed on an "AS IS" BASIS,
+ * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.qi4j.library.spatial.projection.transformations.fromto;
+
+import org.cts.IllegalCoordinateException;
+import org.cts.crs.GeodeticCRS;
+import org.cts.op.CoordinateOperation;
+import org.cts.op.CoordinateOperationFactory;
+import org.qi4j.api.geometry.*;
+import org.qi4j.api.geometry.internal.Coordinate;
+import org.qi4j.api.geometry.internal.TGeometry;
+import org.qi4j.api.structure.Module;
+import org.qi4j.library.spatial.projection.ProjectionsRegistry;
+
+import java.util.List;
+
+
+public class ToHelper
+{
+
+    private Module module;
+    private TGeometry intermediate;
+    private double maxPrecisionMeanConversionError = Double.MAX_VALUE;
+
+    public ToHelper(Module module, TGeometry intermediate)
+    {
+        this.module = module;
+        this.intermediate = intermediate;
+    }
+
+    private ToHelper() {}
+
+
+    public  void to(String CRS, double maxPrecisionMeanConversionError) throws RuntimeException
+    {
+        this.maxPrecisionMeanConversionError = maxPrecisionMeanConversionError;
+        to(CRS);
+    }
+
+    public  void to(String CRS) throws RuntimeException
+    {
+    try
+    {
+        GeodeticCRS sourceCRS = (GeodeticCRS) new ProjectionsRegistry().getCRS(intermediate.getCRS());
+        GeodeticCRS targetCRS = (GeodeticCRS) new ProjectionsRegistry().getCRS(CRS);
+
+
+        if (sourceCRS.equals(targetCRS)) {
+            return;
+        }
+        switch (intermediate.getType()) {
+            case POINT:
+                transform(sourceCRS, targetCRS, new Coordinate[]{((TPoint) intermediate).getCoordinate()});
+                break;
+            case MULTIPOINT:
+                transform(sourceCRS, targetCRS, ((TMultiPoint) intermediate).getCoordinates());
+                break;
+            case LINESTRING:
+                transform(sourceCRS, targetCRS, ((TLineString) intermediate).getCoordinates());
+                break;
+            case MULTILINESTRING:
+                transform(sourceCRS, targetCRS, ((TMultiLineString) intermediate).getCoordinates());
+                break;
+            case POLYGON:
+                transform(sourceCRS, targetCRS, ((TPolygon) intermediate).getCoordinates());
+                break;
+            case MULTIPOLYGON:
+                transform(sourceCRS, targetCRS, ((TMultiPolygon) intermediate).getCoordinates());
+                break;
+            case FEATURE:
+                transform(sourceCRS, targetCRS, ((TFeature) intermediate).getCoordinates());
+                break;
+            case FEATURECOLLECTION:
+                transform(sourceCRS, targetCRS, ((TFeatureCollection) intermediate).getCoordinates());
+                break;
+        }
+
+        // JJ TODO - Set nested TGeometries CRSs as well
+        intermediate.setCRS(targetCRS.getCode());
+    } catch(Exception _ex)
+    {
+        throw new RuntimeException(_ex);
+    }
+    }
+
+
+
+    private void transformTPoint(GeodeticCRS sourceCRS, GeodeticCRS targetCRS, TPoint tPoint ) throws Exception
+    {
+        transform(sourceCRS, targetCRS, new Coordinate[] { tPoint.getCoordinate() });
+        tPoint.setCRS(targetCRS.getCode());
+    }
+
+    private void transformTMultiPoint(GeodeticCRS sourceCRS, GeodeticCRS targetCRS, TMultiPoint tMultiPoint ) throws Exception
+    {
+        transform(sourceCRS, targetCRS, tMultiPoint.getCoordinates());
+        tMultiPoint.setCRS(targetCRS.getCode());
+        // tMultiPoint.
+    }
+
+    private void transformTLineString(GeodeticCRS sourceCRS, GeodeticCRS targetCRS, TLineString tLineString ) throws Exception
+    {
+
+        transform(sourceCRS, targetCRS, tLineString.getCoordinates());
+        tLineString.setCRS(targetCRS.getCode());
+        // tMultiPoint.
+    }
+
+
+    private void transform(GeodeticCRS sourceCRS, GeodeticCRS targetCRS, Coordinate... coordinates) throws IllegalCoordinateException
+    {
+        List<CoordinateOperation> ops;
+        ops = CoordinateOperationFactory.createCoordinateOperations(sourceCRS, targetCRS);
+
+        if (!ops.isEmpty()) {
+            if (true) {
+                 System.out.println("Number of Operations " + ops.size());
+                 System.out.println("Precision " + ops.get(0).getPrecision() + " m.");
+                 System.out.println(ops.get(0));
+            }
+
+            if (maxPrecisionMeanConversionError < Double.MAX_VALUE && maxPrecisionMeanConversionError < ops.get(0).getPrecision())
+                throw new RuntimeException("Transformation from " + sourceCRS.getCode() + " to " + targetCRS.getCode() +
+                        " can not be done with the requested precision of " + maxPrecisionMeanConversionError + " meters." +
+                        " Current precision mean conversion error is " + ops.get(0).getPrecision() + " meters.");
+
+            for (Coordinate coordinate : coordinates)
+            {
+                double[] c = ops.get(0).transform(new double[]{coordinate.y(), coordinate.x() /** z */} );
+                coordinate.y(c[0]).x(c[1]);
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/d305f9da/libraries/spatial/src/main/java/org/qi4j/library/spatial/projections/ProjectionService.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/projections/ProjectionService.java b/libraries/spatial/src/main/java/org/qi4j/library/spatial/projections/ProjectionService.java
deleted file mode 100644
index cf840e16..0000000
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/projections/ProjectionService.java
+++ /dev/null
@@ -1,117 +0,0 @@
-package org.qi4j.library.spatial.projections;
-
-import org.cts.CRSFactory;
-import org.cts.IllegalCoordinateException;
-import org.cts.crs.CRSException;
-import org.cts.crs.CoordinateReferenceSystem;
-import org.cts.crs.GeodeticCRS;
-import org.cts.op.CoordinateOperation;
-import org.cts.op.CoordinateOperationFactory;
-import org.cts.registry.*;
-import org.qi4j.api.injection.scope.Structure;
-import org.qi4j.api.mixin.Mixins;
-import org.qi4j.api.service.ServiceActivation;
-import org.qi4j.api.service.ServiceComposite;
-import org.qi4j.api.structure.Module;
-
-import java.util.List;
-import java.util.Set;
-
-@Mixins( ProjectionService.Mixin.class )
-public interface ProjectionService
-        extends ServiceComposite, ServiceActivation {
-
-    void test() throws Exception;
-    double[] transform(String csNameSrc, String csNameDest, double[] pointSource) throws IllegalCoordinateException, CRSException;
-    Set<String> getSupportedSRID(String registryName) throws RegistryException;
-
-
-    public abstract class Mixin implements ProjectionService
-    {
-
-        protected static CRSFactory cRSFactory;
-
-        // private static SpatialRefRegistry srr = new SpatialRefRegistry();
-
-        public void test() throws Exception
-        {
-
-            // getSupportedCodes
-            // Set<String> codes =  cRSFactory.getSupportedCodes("EPSG");
-
-            // System.out.println(codes);
-
-            // CoordinateReferenceSystem crs = cRSFactory .createFromPrj(prj);
-            System.out.println(cRSFactory.getCRS("EPSG:4326").getAuthorityKey()); //  getAuthorityName());
-
-            // String csNameSrc = "EPSG:4326"; //Input EPSG
-            String csNameSrc = "4326"; //Input EPSG
-
-            String csNameDest = "EPSG:27582";  //Target EPSG lambert 2 etendu france
-
-            CoordinateReferenceSystem inputCRS = cRSFactory.getCRS(csNameSrc);
-            System.out.println(inputCRS.toWKT());
-            CoordinateReferenceSystem outputCRS = cRSFactory.getCRS(csNameDest);
-
-        }
-
-        public Set<String> getSupportedSRID(String registryName) throws RegistryException
-        {
-            // cRSFactory.
-            return cRSFactory.getSupportedCodes(registryName);
-        }
-
-        public double[] transform(String csNameSrc, String csNameDest, double[] pointSource) throws IllegalCoordinateException, CRSException {
-
-            CoordinateReferenceSystem inputCRS = cRSFactory.getCRS(csNameSrc);
-            CoordinateReferenceSystem outputCRS = cRSFactory.getCRS(csNameDest);
-
-            return transform((GeodeticCRS) inputCRS, (GeodeticCRS) outputCRS, pointSource);
-        }
-
-
-        public double[] transform(GeodeticCRS sourceCRS, GeodeticCRS targetCRS, double[] pointSource) throws IllegalCoordinateException {
-
-            if (sourceCRS.equals(targetCRS))
-                return pointSource;
-
-            List<CoordinateOperation> ops;
-            ops = CoordinateOperationFactory.createCoordinateOperations(sourceCRS, targetCRS);
-            if (!ops.isEmpty()) {
-               // if (verbose) {
-                    System.out.println(ops.get(0));
-               // }
-                return ops.get(0).transform(new double[]{pointSource[0], pointSource[1], pointSource[2]});
-            } else {
-                return new double[]{0.0d, 0.0d, 0.0d};
-            }
-        }
-
-
-        @Structure
-        Module module;
-
-        public void activateService()
-                throws Exception
-        {
-
-            cRSFactory = new CRSFactory();
-            RegistryManager registryManager = cRSFactory.getRegistryManager();
-            registryManager.addRegistry(new IGNFRegistry());
-            registryManager.addRegistry(new EPSGRegistry());
-            registryManager.addRegistry(new ESRIRegistry());
-            registryManager.addRegistry(new Nad27Registry());
-            registryManager.addRegistry(new Nad83Registry());
-            registryManager.addRegistry(new worldRegistry());
-
-        }
-
-        // END SNIPPET: realm-service
-        public void passivateService()
-                throws Exception
-        {
-        }
-
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/d305f9da/libraries/spatial/src/main/java/org/qi4j/library/spatial/projections/Projections.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/projections/Projections.java b/libraries/spatial/src/main/java/org/qi4j/library/spatial/projections/Projections.java
deleted file mode 100644
index 35a5a61..0000000
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/projections/Projections.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.qi4j.library.spatial.projections;
-
-/**
- * Created by jakes on 2/20/14.
- */
-public interface Projections {
-
-    String EPSG_1102110 = "PROJCS[\"RGF93_Lambert_93\",GEOGCS[\"GCS_RGF_1993\","
-            + "DATUM[\"D_RGF_1993\",SPHEROID[\"GRS_1980\",6378137.0,298.257222101]],"
-            + "PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],"
-            + "PROJECTION[\"Lambert_Conformal_Conic\"],PARAMETER[\"False_Easting\",700000.0],"
-            + "PARAMETER[\"False_Northing\",6600000.0],PARAMETER[\"Central_Meridian\",3.0],"
-            + "PARAMETER[\"Standard_Parallel_1\",44.0],PARAMETER[\"Standard_Parallel_2\",49.0],"
-            + "PARAMETER[\"Latitude_Of_Origin\",46.5],UNIT[\"Meter\",1.0]]";
-
-
-    String EPSG_27561= "PROJCS[\" NTF (Paris) / Lambert zone II \",GEOGCS[\" NTF (Paris) \","
-            + "DATUM[\" Nouvelle_Triangulation_Francaise_Paris \","
-            + "SPHEROID[\" Clarke 1880 (IGN) \", 6378249.2 , 293.4660212936269 ,"
-            + "AUTHORITY[\" EPSG \" , \" 7011 \"]],TOWGS84[ -168 , -60 , 320 , 0 , 0 , 0 , 0 ],"
-            + "AUTHORITY[\" EPSG \" , \" 6807 \"]],PRIMEM[\" Paris \", 2.33722917 ,"
-            + "AUTHORITY[\" EPSG \" , \" 8903 \"]],UNIT[\" grad \", 0.01570796326794897 ,"
-            + "AUTHORITY[\" EPSG \" , \" 9105 \"]],AUTHORITY[\" EPSG \",\" 4807 \"]],UNIT[\" metre \" , 1 , "
-            + "AUTHORITY[\" EPSG \" , \" 9001 \"]],PROJECTION[\" Lambert_Conformal_Conic_1SP \"],"
-            + "PARAMETER[\" latitude_of_origin \" , 52 ],PARAMETER[\" central_meridian \" , 0 ],"
-            + "PARAMETER[\" scale_factor \" , 0.99987742 ],PARAMETER[\" false_easting \" , 600000 ],"
-            + "PARAMETER[\" false_northing \" , 2200000 ],"
-            + "AUTHORITY[\" EPSG \" , \" 27572 \"],AXIS[\" X \" , EAST ],AXIS[\" Y \" , NORTH ]] ";
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/d305f9da/libraries/spatial/src/main/java/org/qi4j/library/spatial/projections/ProjectionsTransformation.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/projections/ProjectionsTransformation.java b/libraries/spatial/src/main/java/org/qi4j/library/spatial/projections/ProjectionsTransformation.java
deleted file mode 100644
index 118e83a..0000000
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/projections/ProjectionsTransformation.java
+++ /dev/null
@@ -1,133 +0,0 @@
-package org.qi4j.library.spatial.projections;
-
-import org.cts.IllegalCoordinateException;
-import org.cts.crs.CoordinateReferenceSystem;
-import org.cts.crs.GeodeticCRS;
-import org.cts.op.CoordinateOperation;
-import org.cts.op.CoordinateOperationFactory;
-import org.qi4j.api.geometry.internal.TGeometry;
-import org.qi4j.api.geometry.TPoint;
-import org.qi4j.library.spatial.v2.projections.ProjectionsRegistry;
-
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * Created by jj on 17.11.14.
- */
-public class ProjectionsTransformation {
-
-    public  TGeometry transform(TGeometry geometry, CoordinateReferenceSystem targetCRS) throws IllegalCoordinateException, Exception
-    {
-        /**
-        System.out.println("Transforming");
-
-        CoordinateReferenceSystem sourceCRS = new ProjectionsRegistry().getCRS(geometry.getSRIDWkt());
-
-        System.out.println(sourceCRS);
-
-        TPoint point = (TPoint)geometry;
-
-        double[] pointSource = transform((GeodeticCRS) sourceCRS, (GeodeticCRS) targetCRS, point.source());
-
-        System.out.println("transformed points : " + Arrays.toString(pointSource));
-
-        // TPoint point = TPOINT(module).x(1d).y(2d).z(3d).geometry();
-
-        point.x(pointSource[0]).y(pointSource[1]);
-
-
-        // point.X(pointSource[0]);
-        // point.Y(pointSource[1]);
-        point.setSRID(targetCRS.getAuthorityName(), Integer.parseInt(targetCRS.getAuthorityKey()));
-
-
-
-        // CoordinateReferenceSystem sourceCRS = SpatialRefSysManager.getCRS(point.getSRIDWkt());
-
-      //  point.coordinates().
-
-        return point;
-         */
-        return null;
-    }
-
-// http://code.google.com/p/cloning
-    public  TPoint transform(TPoint point, CoordinateReferenceSystem targetCRS) throws IllegalCoordinateException, Exception
-    {
-        /**
-        System.out.println("Transforming");
-
-        CoordinateReferenceSystem sourceCRS = new ProjectionsRegistry().getCRS(point.getSRIDWkt());
-
-        System.out.println(sourceCRS);
-
-
-
-        double[] pointSource = transform((GeodeticCRS) sourceCRS, (GeodeticCRS) targetCRS, point.source());
-
-        System.out.println("transformed points : " + Arrays.toString(pointSource));
-
-        point.x(pointSource[0]).y(pointSource[1]);
-
-        // point.X(pointSource[0]);
-        // point.Y(pointSource[1]);
-
-
-        // CoordinateReferenceSystem sourceCRS = SpatialRefSysManager.getCRS(point.getSRIDWkt());
-
-        //  point.coordinates().
-
-        return point;
-         */
-        return null;
-    }
-
-//    public TGeometry transform(TGeometry geometry, CoordinateReferenceSystem targetCRS) throws IllegalCoordinateException {
-/**
-        if (sourceCRS.equals(targetCRS))
-            return geometry;
-
-        List<CoordinateOperation> ops;
-        ops = CoordinateOperationFactory.createCoordinateOperations(sourceCRS, targetCRS);
-        if (!ops.isEmpty()) {
-            // if (verbose) {
-            System.out.println(ops.get(0));
-            // }
-            // return ops.get(0).transform(new double[]{pointSource[0], pointSource[1], pointSource[2]});
-            return null;
-        } else {
-            // return new double[]{0.0d, 0.0d, 0.0d};
-            return null;
-        }
- */
-  //      return null;
-  //  }
-
-    public double[] transform(GeodeticCRS sourceCRS, GeodeticCRS targetCRS, double[] pointSource) throws IllegalCoordinateException {
-
-        if (sourceCRS.equals(targetCRS))
-            return pointSource;
-
-        List<CoordinateOperation> ops;
-        ops = CoordinateOperationFactory.createCoordinateOperations(sourceCRS, targetCRS);
-        if (!ops.isEmpty()) {
-            if (true) {
-            System.out.println(ops.get(0));
-             }
-            return ops.get(0).transform(new double[]{pointSource[0], pointSource[1], pointSource[2]});
-        } else {
-            return new double[]{0.0d, 0.0d, 0.0d};
-        }
-    }
-
-/**
-    public double[] transform(String csNameSrc, String csNameDest, double[] pointSource) throws IllegalCoordinateException, CRSException {
-
-        CoordinateReferenceSystem inputCRS = cRSFactory.getCRS(csNameSrc);
-        CoordinateReferenceSystem outputCRS = cRSFactory.getCRS(csNameDest);
-
-        return transform((GeodeticCRS) inputCRS, (GeodeticCRS) outputCRS, pointSource);
-    }
-   */
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/d305f9da/libraries/spatial/src/main/java/org/qi4j/library/spatial/transformations/GeoJsonTransformator.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/transformations/GeoJsonTransformator.java b/libraries/spatial/src/main/java/org/qi4j/library/spatial/transformations/GeoJsonTransformator.java
deleted file mode 100644
index 47e094b..0000000
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/transformations/GeoJsonTransformator.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.qi4j.library.spatial.transformations;
-
-
-import java.util.*;
-
-/**
- * Created by jakes on 2/23/14.
- */
-public class GeoJsonTransformator {
-
-    private static GeoJsonTransformator  self;
-
-
-
-
-
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/d305f9da/libraries/spatial/src/main/java/org/qi4j/library/spatial/transformations/geojson/GeoJSONParserV2.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/transformations/geojson/GeoJSONParserV2.java b/libraries/spatial/src/main/java/org/qi4j/library/spatial/transformations/geojson/GeoJSONParserV2.java
deleted file mode 100644
index 86f2310..0000000
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/transformations/geojson/GeoJSONParserV2.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.qi4j.library.spatial.transformations.geojson;
-
-import org.qi4j.api.structure.Module;
-import org.qi4j.library.spatial.transformations.geojson.internal.ParserBuilder;
-import org.qi4j.library.spatial.transformations.geojson.internal.TransformationBuilder;
-
-import java.io.InputStream;
-
-/**
- * Created by jj on 28.11.14.
- */
-public class GeoJSONParserV2 {
-
-    public static final ParserBuilder source(InputStream source)
-    {
-        return new ParserBuilder(source);
-    }
-
-    public static final TransformationBuilder transform(Module module)
-    {
-        return new TransformationBuilder(module);
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/d305f9da/libraries/spatial/src/main/java/org/qi4j/library/spatial/transformations/geojson/internal/ParserBuilder.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/transformations/geojson/internal/ParserBuilder.java b/libraries/spatial/src/main/java/org/qi4j/library/spatial/transformations/geojson/internal/ParserBuilder.java
deleted file mode 100644
index aaf5da4..0000000
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/transformations/geojson/internal/ParserBuilder.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.qi4j.library.spatial.transformations.geojson.internal;
-
-import com.fasterxml.jackson.core.JsonFactory;
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.geojson.Feature;
-import org.geojson.FeatureCollection;
-
-import java.io.File;
-import java.io.InputStream;
-import java.util.Iterator;
-import java.util.List;
-
-public class ParserBuilder
-{
-
-    private InputStream source;
-    private FeatureCollection featureCollection;
-    private Iterator<Feature> features;
-
-    public ParserBuilder(InputStream source)
-    {
-        this.source = source;
-    }
-
-/**
-    public void parse( Class valueType) throws Exception
-    {
-        FeatureCollection featureCollection =
-                new ObjectMapper().readValue(source, FeatureCollection);
-    }
-*/
-
-    public ParserBuilder parse() throws Exception
-    {
-        // parse(FeatureCollection.class);
-        // FeatureCollection featureCollection =
-
-
-
-        this.featureCollection = new ObjectMapper().readValue(source, FeatureCollection.class);
-
-        this.features = featureCollection.getFeatures().iterator();
-
-        return this;
-    }
-
-    public JsonParser  build() throws Exception
-    {
-        ObjectMapper mapper = new ObjectMapper();
-        JsonFactory jsonFactory = mapper.getJsonFactory();
-        JsonParser jp = jsonFactory.createJsonParser(source);
-
-        return jp;
-        /**
-        JsonFactory f = new JsonFactory();
-        JsonParser jp  = f.createParser(source);
-        // JsonParser jp = f.createJsonParser(new File("user.json"));
-
-        return jp;
-        */
-
-    }
-
-
-
-    public List<Feature>  getValues()
-    {
-        return this.featureCollection.getFeatures();
-    }
-
-
-
-
-
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/d305f9da/libraries/spatial/src/main/java/org/qi4j/library/spatial/transformations/geojson/internal/TransformationBuilder.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/transformations/geojson/internal/TransformationBuilder.java b/libraries/spatial/src/main/java/org/qi4j/library/spatial/transformations/geojson/internal/TransformationBuilder.java
deleted file mode 100644
index ab7f559..0000000
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/transformations/geojson/internal/TransformationBuilder.java
+++ /dev/null
@@ -1,140 +0,0 @@
-package org.qi4j.library.spatial.transformations.geojson.internal;
-
-import org.geojson.*;
-import org.qi4j.api.geometry.TLineString;
-import org.qi4j.api.geometry.TPolygon;
-import org.qi4j.api.geometry.internal.TGeometry;
-import org.qi4j.api.geometry.internal.TLinearRing;
-import org.qi4j.api.structure.Module;
-
-import java.util.List;
-import java.util.ListIterator;
-
-import static org.qi4j.api.geometry.TGeometryFactory.*;
-
-/**
- * Created by jj on 28.11.14.
- */
-public class TransformationBuilder {
-
-    Module module;
-
-    private GeoJsonObject geojson;
-
-   public TransformationBuilder(Module module)
-    {
-        this.module = module;
-    }
-
-    public TransformationBuilder from(GeoJsonObject geojson )
-    {
-        this.geojson = geojson;
-        return this;
-    }
-
-    public TGeometry transform()
-    {
-
-        if (geojson instanceof Feature)
-        {
-            Feature feature = (Feature)geojson;
-            return TFeature(module).of(new TransformationBuilder(module).from(feature.getGeometry()).transform()).geometry();
-        }
-
-        else if (geojson instanceof Point)
-        {
-            Point point = (Point)geojson;
-
-            return TPoint(module)
-                    .x(point.getCoordinates().getLatitude())
-                    .y(point.getCoordinates().getLongitude())
-                    .z(point.getCoordinates().getAltitude())
-                    .geometry();
-
-
-
-        } else if (geojson  instanceof LineString)
-        {
-            // tFeature = Geometry.asFeature(
-            //        Geometry.asLinearString(toPoints(((LineString)feature.getGeometry()).getCoordinates()).toArray(new TPoint[0]))
-            //);
-
-            LineString lineString = (LineString)geojson;
-
-            TLineString tLineString = TLineString(module).of().geometry();
-            for (LngLatAlt xyz : lineString.getCoordinates() ) {
-                tLineString = TLineString(module).of(
-                        TPoint(module)
-                                .x(xyz.getLatitude())
-                                .y(xyz.getLongitude())
-                                .z(xyz.getAltitude())
-                                .geometry()
-                ).geometry();
-            }
-
-            return tLineString;
-
-        }
-        else if (geojson instanceof Polygon)
-        {
-
-            TPolygon tPolygon = null;
-
-            TLinearRing ring = getRing(((Polygon) geojson).getExteriorRing());
-
-            if (ring.isValid())
-                tPolygon = TPolygon(module).shell(ring).geometry();
-            else
-             throw  new RuntimeException("Polygon shell not valid");
-
-            for (int i = 0; i < ((Polygon)geojson).getInteriorRings().size(); i++)
-            {
-                tPolygon.withHoles(getRing(((Polygon) geojson).getInteriorRings().get(i)));
-            }
-
-            return tPolygon;
-
-        }
-        else if (geojson instanceof MultiPolygon)
-        {
-            //  ((MultiPolygon)feature.getGeometry()).g getCoordinates()
-            ListIterator<List<List<LngLatAlt>>> a = ((MultiPolygon)geojson).getCoordinates().listIterator();
-
-            while(a.hasNext()) {
-                //
-                a.next();
-            }
-        }
-        else {
-            System.out.println(geojson.getClass() + " missing");
-        }
-/**
-        if (tFeature != null) {
-            tFeature.id().set(feature.getId());
-            tFeature.properties().set(feature.getProperties());
-
-            //  System.out.println(count);
-
-            // System.out.println(tFeature.toString());
-        }
-   */
-        return null;
-
-    }
-
-    private TLinearRing getRing(List<LngLatAlt> coordinates)
-    {
-
-        TLinearRing tLinearRing = TLinearRing(module).of().geometry();
-        for (LngLatAlt xyz :coordinates ) {
-            tLinearRing.yx(xyz.getLatitude(), xyz.getLongitude());
-        }
-
-        if (!tLinearRing.isClosed())
-        {
-            tLinearRing.of(tLinearRing.getStartPoint()); // hack here - we are closing the ring
-        }
-
-        return tLinearRing;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/d305f9da/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/assembly/TGeometryAssembler.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/assembly/TGeometryAssembler.java b/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/assembly/TGeometryAssembler.java
deleted file mode 100644
index f427128..0000000
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/assembly/TGeometryAssembler.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package org.qi4j.library.spatial.v2.assembly;
-
-import org.cts.crs.CRSException;
-import org.cts.crs.CoordinateReferenceSystem;
-import org.qi4j.api.geometry.*;
-import org.qi4j.api.geometry.internal.Coordinate;
-import org.qi4j.api.geometry.internal.TCircle;
-import org.qi4j.api.geometry.internal.TGeometry;
-import org.qi4j.api.geometry.internal.TLinearRing;
-import org.qi4j.api.value.ValueSerialization;
-import org.qi4j.bootstrap.Assemblers;
-import org.qi4j.bootstrap.AssemblyException;
-import org.qi4j.bootstrap.ModuleAssembly;
-import org.qi4j.bootstrap.ServiceDeclaration;
-import org.qi4j.entitystore.memory.MemoryEntityStoreService;
-import org.qi4j.library.spatial.v2.projections.ProjectionsRegistry;
-import org.qi4j.spi.uuid.UuidIdentityGeneratorService;
-import org.qi4j.valueserialization.orgjson.OrgJsonValueSerializationService;
-
-/**
- * Created by jj on 21.12.14.
- */
-public class TGeometryAssembler
-        extends Assemblers.VisibilityIdentity<TGeometryAssembler>
-{
-    private static final String CRS_EPSG_4326   = "EPSG:4326";
-    private static String DEFAULT_CRS           = CRS_EPSG_4326;
-
-
-    @Override
-    public void assemble( ModuleAssembly module )
-            throws AssemblyException
-    {
-        // internal values
-        module.values(Coordinate.class, TLinearRing.class, TCircle.class, TGeometry.class);
-        // API values
-        module.values(
-                TCRS.class,
-                TPoint.class,
-                TMultiPoint.class,
-                TLineString.class,
-                TMultiLineString.class,
-                TPolygon.class,
-                TMultiPolygon.class,
-                TFeature.class,
-                TFeatureCollection.class);
-
-        TGeometry tGeometry = module.forMixin(TGeometry.class).declareDefaults();
-        tGeometry.CRS().set(DEFAULT_CRS);
-    }
-
-    public TGeometryAssembler withCRS(String crs) throws AssemblyException
-    {
-        try
-        {
-            CoordinateReferenceSystem ref = new ProjectionsRegistry().getReferenceSystem(crs);
-            if (ref == null || ref.getCoordinateSystem() == null)
-            {
-                throw new AssemblyException("Projection CRS " + crs + " invalid.");
-            }
-
-        } catch(CRSException _ex)
-        {
-            throw new AssemblyException("Projection CRS " + crs + " invalid.", _ex);
-        }
-
-        DEFAULT_CRS = crs;
-        return this;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/d305f9da/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/TConversions.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/TConversions.java b/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/TConversions.java
deleted file mode 100644
index ee29554..0000000
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/TConversions.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.qi4j.library.spatial.v2.conversions;
-
-import org.qi4j.api.geometry.internal.TGeometry;
-import org.qi4j.api.structure.Module;
-import org.qi4j.library.spatial.v2.conversions.from.FromHelper;
-
-/**
- * Created by jj on 04.12.14.
- */
-public class TConversions {
-
-    public static FromHelper Convert(Module module)
-    {
-        return new FromHelper(module);
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/d305f9da/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/from/FromHelper.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/from/FromHelper.java b/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/from/FromHelper.java
deleted file mode 100644
index 04ecba8..0000000
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/from/FromHelper.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.qi4j.library.spatial.v2.conversions.from;
-
-import org.geojson.GeoJsonObject;
-import org.qi4j.api.geometry.internal.TGeometry;
-import org.qi4j.api.structure.Module;
-import org.qi4j.library.spatial.v2.conversions.to.ToHelper;
-
-/**
- * Created by jj on 04.12.14.
- */
-public class FromHelper {
-
-    private Module module;
-
-    public FromHelper(Module module)
-    {
-        this.module = module;
-    }
-
-    public ToHelper from(TGeometry tGeometry)
-    {
-        return new ToHelper(module, new TGeometryFromConverter(module).convert(tGeometry));
-    }
-
-    public ToHelper from(GeoJsonObject geoJsonObject)
-    {
-        return new ToHelper(module, new GeoJsonFromConverter(module).convert(geoJsonObject));
-
-    }
-
-    public ToHelper from(String wkt) throws Exception
-    {
-        return new ToHelper(module, new WKTFromConverter(module).convert(wkt, null));
-    }
-
-    public ToHelper from(String wkt, String crs) throws Exception
-    {
-        return new ToHelper(module, new WKTFromConverter(module).convert(wkt, crs));
-    }
-
-    private FromHelper() {}
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/d305f9da/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/from/GeoJsonFromConverter.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/from/GeoJsonFromConverter.java b/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/from/GeoJsonFromConverter.java
deleted file mode 100644
index 217d80e..0000000
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/from/GeoJsonFromConverter.java
+++ /dev/null
@@ -1,159 +0,0 @@
-package org.qi4j.library.spatial.v2.conversions.from;
-
-import org.geojson.*;
-import org.qi4j.api.geometry.TLineString;
-import org.qi4j.api.geometry.TPolygon;
-import org.qi4j.api.geometry.internal.TGeometry;
-import org.qi4j.api.geometry.internal.TLinearRing;
-import org.qi4j.api.structure.Module;
-
-import java.util.List;
-import java.util.ListIterator;
-
-import static org.qi4j.api.geometry.TGeometryFactory.*;
-import static org.qi4j.api.geometry.TGeometryFactory.TLinearRing;
-
-/**
- * Created by jj on 04.12.14.
- */
-public class GeoJsonFromConverter {
-
-    private Module module;
-
-    public GeoJsonFromConverter(Module module)
-    {
-        this.module = module;
-    }
-
-    public TGeometry convert(GeoJsonObject geojson)
-
-    {
-        return transform(geojson);
-    }
-
-
-    private TGeometry transform(GeoJsonObject geojson)
-    {
-
-        if (geojson instanceof Feature)
-        {
-            Feature feature = (Feature)geojson;
-            return TFeature(module).of(new GeoJsonFromConverter(module).transform(feature.getGeometry())).geometry();
-        }
-
-        else if (geojson instanceof Point) {
-            Point point = (Point) geojson;
-
-            return TPoint(module)
-                    .x(point.getCoordinates().getLatitude())
-                    .y(point.getCoordinates().getLongitude())
-                    .z(point.getCoordinates().getAltitude())
-                    .geometry();
-        }
-     else if (geojson  instanceof LineString)
-        {
-            // tFeature = Geometry.asFeature(
-            //        Geometry.asLinearString(toPoints(((LineString)feature.getGeometry()).getCoordinates()).toArray(new TPoint[0]))
-            //);
-
-            LineString lineString = (LineString)geojson;
-
-            TLineString tLineString = TLineString(module).of().geometry();
-
-            for (LngLatAlt xyz : lineString.getCoordinates() ) {
-                tLineString.of(
-                        TPoint(module)
-                                .x(xyz.getLatitude())
-                                .y(xyz.getLongitude())
-                                .z(xyz.getAltitude())
-                                .geometry()
-                );
-            }
-
-            return tLineString;
-
-        }
-        /**
-        else if (geojson instanceof MultiPoint)
-        {
-            MultiPoint multiPoint = (MultiPoint)geojson;
-            TMultiPoint tMultiPoint = TMULTIPOINT(module).of().geometry();
-
-            for (LngLatAlt xyz : multiPoint.getCoordinates() ) {
-                tMultiPoint.of(
-                        TPOINT(module)
-                                .x(xyz.getLatitude())
-                                .y(xyz.getLongitude())
-                                .z(xyz.getAltitude())
-                                .geometry()
-                );
-
-            }
-
-            return tMultiPoint;
-
-        }
-         */
-        else if (geojson instanceof Polygon)
-        {
-
-            TPolygon tPolygon = null;
-
-            TLinearRing ring = getRing(((Polygon) geojson).getExteriorRing());
-
-            if (ring.isValid())
-                tPolygon = TPolygon(module).shell(ring).geometry();
-            else
-                throw  new RuntimeException("Polygon shell not valid");
-
-            for (int i = 0; i < ((Polygon)geojson).getInteriorRings().size(); i++)
-            {
-                tPolygon.withHoles(getRing(((Polygon) geojson).getInteriorRings().get(i)));
-            }
-
-            return tPolygon;
-
-        }
-        else if (geojson instanceof MultiPolygon)
-        {
-            //  ((MultiPolygon)feature.getGeometry()).g getCoordinates()
-            ListIterator<List<List<LngLatAlt>>> a = ((MultiPolygon)geojson).getCoordinates().listIterator();
-
-            while(a.hasNext()) {
-                //
-                a.next();
-            }
-        }
-        else {
-            System.out.println(geojson.getClass() + " missing");
-        }
-/**
- if (tFeature != null) {
- tFeature.id().set(feature.getId());
- tFeature.properties().set(feature.getProperties());
-
- //  System.out.println(count);
-
- // System.out.println(tFeature.toString());
- }
- */
-        return null;
-
-    }
-
-    private TLinearRing getRing(List<LngLatAlt> coordinates)
-    {
-
-        TLinearRing tLinearRing = TLinearRing(module).of().geometry();
-        for (LngLatAlt xyz :coordinates ) {
-            tLinearRing.yx(xyz.getLatitude(), xyz.getLongitude());
-        }
-
-        if (!tLinearRing.isClosed())
-        {
-            tLinearRing.of(tLinearRing.getStartPoint()); // hack here - we are closing the ring
-        }
-
-        return tLinearRing;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/d305f9da/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/from/TGeometryFromConverter.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/from/TGeometryFromConverter.java b/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/from/TGeometryFromConverter.java
deleted file mode 100644
index 0f603d9..0000000
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/from/TGeometryFromConverter.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.qi4j.library.spatial.v2.conversions.from;
-
-import org.qi4j.api.geometry.internal.TGeometry;
-import org.qi4j.api.structure.Module;
-
-/**
- * Created by jj on 04.12.14.
- */
-public class TGeometryFromConverter {
-
-    private Module module;
-
-    public TGeometryFromConverter(Module module)
-    {
-        this.module = module;
-    }
-
-    public TGeometry convert(TGeometry tGeometry)
-    {
-        return tGeometry;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/d305f9da/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/from/WKTFromConverter.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/from/WKTFromConverter.java b/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/from/WKTFromConverter.java
deleted file mode 100644
index 4de8e1c..0000000
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/from/WKTFromConverter.java
+++ /dev/null
@@ -1,210 +0,0 @@
-package org.qi4j.library.spatial.v2.conversions.from;
-
-import com.spatial4j.core.context.SpatialContext;
-import com.spatial4j.core.context.jts.JtsSpatialContextFactory;
-import com.spatial4j.core.io.jts.JtsWKTReaderShapeParser;
-import com.spatial4j.core.io.jts.JtsWktShapeParser;
-import com.spatial4j.core.shape.Circle;
-import com.spatial4j.core.shape.Point;
-import com.spatial4j.core.shape.Shape;
-import com.spatial4j.core.shape.jts.JtsGeometry;
-import com.spatial4j.core.shape.jts.JtsPoint;
-import com.vividsolutions.jts.geom.Geometry;
-import com.vividsolutions.jts.geom.LineString;
-import com.vividsolutions.jts.geom.MultiPolygon;
-import com.vividsolutions.jts.geom.Polygon;
-import org.qi4j.api.geometry.TPoint;
-import org.qi4j.api.geometry.TPolygon;
-import org.qi4j.api.geometry.internal.TGeometry;
-import org.qi4j.api.geometry.internal.TLinearRing;
-import org.qi4j.api.structure.Module;
-import org.qi4j.api.value.ValueBuilder;
-
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.qi4j.api.geometry.TGeometryFactory.TPoint;
-
-/**
- * Created by jj on 04.12.14.
- */
-public class WKTFromConverter {
-
-
-    final SpatialContext ctx;
-    {
-        JtsSpatialContextFactory factory = new JtsSpatialContextFactory();
-        factory.srid = 4326;
-        factory.datelineRule = JtsWktShapeParser.DatelineRule.ccwRect;
-        factory.wktShapeParserClass = JtsWKTReaderShapeParser.class;
-        ctx = factory.newSpatialContext();
-    }
-
-
-
-    private Module module;
-
-    public WKTFromConverter(Module module)
-    {
-        this.module = module;
-    }
-
-    public TGeometry convert(String wkt, String crs) throws ParseException
-    {
-
-        Shape sNoDL = ctx.readShapeFromWkt(wkt);
-
-
-    if (!sNoDL.hasArea()) {
-        System.out.println("Its a JtsGeometry " + ((JtsPoint) sNoDL).getGeom().getGeometryType());
-        return buildPoint(module,sNoDL);
-    } else {
-        System.out.println("Its a JtsGeometry " + ((JtsGeometry) sNoDL).getGeom().getGeometryType());
-
-        Geometry jtsGeometry = ((JtsGeometry) sNoDL).getGeom();
-
-        if (jtsGeometry instanceof Polygon) {
-            System.out.println("Polygon");
-            return buildPolygon(module,sNoDL);
-        }
-        else if (jtsGeometry instanceof MultiPolygon) {
-            System.out.println("MultiPolygon");
-        }
-        else if (jtsGeometry instanceof LineString) {
-            System.out.println("LineString");
-        }
-
-
-
-
-    }
-
-
-
-    if (sNoDL instanceof Point)
-    {
-
-        // ctx.makeCircle(0,0,0).getBoundingBox().
-        // System.out.println("Shape is point ");
-
-        ValueBuilder<TPoint> builder = module.newValueBuilder(TPoint.class);
-
-        builder.prototype().x(((Point) sNoDL).getX()).y(((Point) sNoDL).getY());
-/**
- builder.prototype().of
- (
- module.newValueBuilder(Coordinate.class).prototype().of(((Point) sNoDL).getX()),  //x
- module.newValueBuilder(Coordinate.class).prototype().of(((Point) sNoDL).getY())   //y
- );
- */
-        return builder.newInstance();
-
-
-//          ValueBuilder<TGeomPoint> builder = module.newValueBuilder( TGeomPoint.class );
-//          TGeomPoint proto = builder.prototype();
-//          List<Double> coordinates = new ArrayList<Double>();
-////
-//          Double lat =  3.138722;  // 3.138722;// Double.parseDouble(query.nextToken());
-//          Double lon =  101.386849; // Double.parseDouble(query.nextToken());
-////
-////
-//          coordinates.add(3.138722);
-//          coordinates.add(101.386849);
-//          proto.coordinates().set(coordinates);
-//
-//          return builder.newInstance();
-
-    } else
-
-            if (sNoDL instanceof Circle) {
-
-    } else
-    {
-        System.out.println("Its a shape");
-        if (sNoDL.hasArea() ) System.out.println("Shape With area..");
-
-        if (sNoDL instanceof JtsGeometry) {
-
-            System.out.println("Its a JtsGeometry " + ((JtsGeometry) sNoDL).getGeom().getGeometryType());
-            // ((JtsGeometry) sNoDL).getGeom()
-        }
-
-    }
-
-    System.out.println("sNoDL " + sNoDL);
-
-    return null;
-}
-
-
-    private TPoint buildPoint(Module module, Shape sNoDL) {
-        ValueBuilder<TPoint> builder = module.newValueBuilder(TPoint.class);
-
-
-        builder.prototype().x(((Point) sNoDL).getX()).y(((Point) sNoDL).getY());
-        /**
-         builder.prototype().of
-         (
-         module.newValueBuilder(Coordinate.class).prototype().of(((Point) sNoDL).getX()),  //x
-         module.newValueBuilder(Coordinate.class).prototype().of(((Point) sNoDL).getY())   //y
-         );
-         */
-
-        return builder.newInstance();
-    }
-
-    private TPolygon buildPolygon(Module module, Shape sNoDL) {
-
-        Geometry jtsGeometry = ((JtsGeometry) sNoDL).getGeom();
-        Polygon jtsPolygon = (Polygon)jtsGeometry;
-
-        // Polygon jtsPolygon = ((JtsGeometry) sNoDL).getGeom();
-
-        // Polygon jtsPolygon = (Polygon)sNoDL;
-
-        System.out.println("Get Coordinates " + jtsPolygon.getExteriorRing().getCoordinates() );
-
-        com.vividsolutions.jts.geom.Coordinate[] coordinates = jtsPolygon.getExteriorRing().getCoordinates();
-
-        ValueBuilder<TPolygon> polygonBuilder = module.newValueBuilder(TPolygon.class);
-        ValueBuilder<TLinearRing> tLinearRingBuilder  = module.newValueBuilder(TLinearRing.class);
-
-        List<TPoint> points = new ArrayList<>();
-        for (int i = 0; i < coordinates.length; i++) {
-/**
- TPoint point = module.newValueBuilder(TPoint.class).prototype().of
- (
- module.newValueBuilder(Coordinate.class).prototype().of( coordinates[i].x),  //x
- module.newValueBuilder(Coordinate.class).prototype().of( coordinates[i].y)   //y
- );*/
-            points.add
-                    (
-                            TPoint(module)
-
-                                    .x(coordinates[i].x)
-                                    .y(coordinates[i].y).geometry()
-                    );
-        }
-        tLinearRingBuilder.prototype().of(points);
-
-        // tLinearRingBuilder.prototype().of(points);
-        // tLinearRingBuilder.prototype().type()
-
-        // TLinearRing tLinearRing = tLinearRingBuilder.newInstance();
-        // System.out.println("tLinearRing .." + tLinearRing);
-
-
-        ValueBuilder<TPolygon> builder = module.newValueBuilder(TPolygon.class);
-
-        builder.prototype().of
-                (
-                        // tLinearRingBuilder.newInstance().of(points)
-                        tLinearRingBuilder.newInstance()
-                );
-
-        return builder.newInstance();
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/d305f9da/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/to/GeoJsonToConverter.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/to/GeoJsonToConverter.java b/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/to/GeoJsonToConverter.java
deleted file mode 100644
index dce34a9..0000000
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/to/GeoJsonToConverter.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.qi4j.library.spatial.v2.conversions.to;
-
-import org.geojson.GeoJsonObject;
-import org.geojson.Point;
-import org.qi4j.api.geometry.TPoint;
-import org.qi4j.api.geometry.internal.TGeometry;
-import org.qi4j.api.structure.Module;
-
-/**
- * Created by jj on 04.12.14.
- */
-public class GeoJsonToConverter<T> {
-
-
-    private Module module;
-
-    public GeoJsonToConverter(Module module)
-    {
-        this.module = module;
-    }
-
-    public GeoJsonObject convert(TGeometry intemediate)
-    {
-        return transform(intemediate);
-    }
-
-    private GeoJsonObject transform(TGeometry intemediate)
-    {
-
-        switch(intemediate.getType())
-        {
-            case POINT              : return buildPoint((TPoint)intemediate);
-            case MULTIPOINT         : return null;
-            case LINESTRING         : return null;
-            case MULTILINESTRING    : return null;
-            case POLYGON            : return null;
-            case MULTIPOLYGON       : return null;
-            case FEATURE            : return null;
-            case FEATURECOLLECTION  : return null;
-            default : throw new RuntimeException("Unknown TGeometry Type.");
-        }
-
-    }
-
-    private Point buildPoint(TPoint point)
-    {
-        System.out.println("point.x() " + point.x());
-        System.out.println("point.y() " + point.y());
-        return new Point(point.x(), point.y());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/d305f9da/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/to/Spatial4JToConverter.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/to/Spatial4JToConverter.java b/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/to/Spatial4JToConverter.java
deleted file mode 100644
index d550638..0000000
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/to/Spatial4JToConverter.java
+++ /dev/null
@@ -1,101 +0,0 @@
-package org.qi4j.library.spatial.v2.conversions.to;
-
-import com.spatial4j.core.context.SpatialContext;
-import com.spatial4j.core.context.jts.JtsSpatialContext;
-import com.spatial4j.core.context.jts.JtsSpatialContextFactory;
-import com.spatial4j.core.io.jts.JtsWKTReaderShapeParser;
-import com.spatial4j.core.io.jts.JtsWktShapeParser;
-import com.spatial4j.core.shape.Circle;
-import com.spatial4j.core.shape.Shape;
-import com.vividsolutions.jts.geom.GeometryFactory;
-import com.vividsolutions.jts.util.GeometricShapeFactory;
-import org.geojson.GeoJsonObject;
-import org.geojson.Point;
-import org.qi4j.api.geometry.TPoint;
-import org.qi4j.api.geometry.internal.TCircle;
-import org.qi4j.api.geometry.internal.TGeometry;
-import org.qi4j.api.structure.Module;
-
-/**
- * Created by jj on 04.12.14.
- */
-public class Spatial4JToConverter<T> {
-
-    // http://code.google.com/p/shape-metrics/source/browse/trunk/src/main/java/edu/psu/geovista/ian/utils/Circle.java?r=2
-
-    final SpatialContext ctx;
-    {
-        JtsSpatialContextFactory factory = new JtsSpatialContextFactory();
-        factory.srid = 4326;
-        factory.datelineRule = JtsWktShapeParser.DatelineRule.ccwRect;
-        factory.wktShapeParserClass = JtsWKTReaderShapeParser.class;
-        ctx = factory.newSpatialContext();
-    }
-
-    public static final double DATELINE = 180;
-    public static final JtsSpatialContext SPATIAL_CONTEXT = JtsSpatialContext.GEO;
-    public static final GeometryFactory FACTORY = SPATIAL_CONTEXT.getGeometryFactory();
-    public static final GeometricShapeFactory SHAPE_FACTORY = new GeometricShapeFactory();
-
-    protected final boolean multiPolygonMayOverlap = false;
-    protected final boolean autoValidateJtsGeometry = true;
-    protected final boolean autoIndexJtsGeometry = true;
-
-    protected final boolean wrapdateline = SPATIAL_CONTEXT.isGeo();
-
-
-    private Module module;
-
-    public Spatial4JToConverter(Module module)
-    {
-        this.module = module;
-    }
-
-    public GeoJsonObject convert(TGeometry intemediate)
-    {
-        // return transform(intemediate);
-        return null;
-    }
-
-    private Shape transform(TGeometry intermediate)
-    {
-
-        switch(intermediate.getType())
-        {
-            case POINT              : return null; // return newPoint((TPoint) intemediate);
-            case MULTIPOINT         : return null;
-            case LINESTRING         : return null;
-            case MULTILINESTRING    : return null;
-            case POLYGON            : return null;
-            case MULTIPOLYGON       : return null;
-            case FEATURE            : return null;
-            case FEATURECOLLECTION  : return null;
-        }
-
-        if (intermediate instanceof TCircle)
-        {
-            return newCircle((TCircle)intermediate);
-        }
-        else
-            return null;
-
-
-    }
-
-    private Point newPoint(TPoint point)
-    {
-        // SPATIAL_CONTEXT.makeCircle(0,0,0).
-
-        // SHAPE_FACTORY.set
-
-        System.out.println("point.x() " + point.x());
-        System.out.println("point.y() " + point.y());
-        return new Point(point.x(), point.y());
-    }
-
-    private Circle newCircle(TCircle circle)
-    {
-        return ctx.makeCircle(circle.getCentre().x(), circle.getCentre().y(), circle.radius().get());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/d305f9da/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/to/TGeometryToConverter.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/to/TGeometryToConverter.java b/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/to/TGeometryToConverter.java
deleted file mode 100644
index d1e4fd1..0000000
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/to/TGeometryToConverter.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.qi4j.library.spatial.v2.conversions.to;
-
-import org.qi4j.api.geometry.internal.TGeometry;
-import org.qi4j.api.structure.Module;
-
-/**
- * Created by jj on 04.12.14.
- */
-public class TGeometryToConverter<T extends TGeometry> {
-
-    private Module module;
-
-    public TGeometryToConverter(Module module)
-    {
-        this.module = module;
-    }
-
-    public TGeometry convert (TGeometry tGeometry, String CRS)
-    {
-        return tGeometry;
-    }
-
-    public TGeometry convert(TGeometry tGeometry)
-    {
-        return convert(tGeometry, tGeometry.getCRS());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/d305f9da/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/to/ToHelper.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/to/ToHelper.java b/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/to/ToHelper.java
deleted file mode 100644
index 66b7987..0000000
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/conversions/to/ToHelper.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.qi4j.library.spatial.v2.conversions.to;
-
-import org.geojson.GeoJsonObject;
-import org.qi4j.api.geometry.internal.TGeometry;
-import org.qi4j.api.structure.Module;
-
-import static org.qi4j.library.spatial.v2.transformations.TTransformations.Transform;
-
-/**
- * Created by jj on 04.12.14.
- */
-public class ToHelper<T extends TGeometry> {
-
-    private Module module;
-    private TGeometry intermediate;
-
-    public ToHelper(Module module, TGeometry intermediate)
-    {
-        this.module = module;
-        this.intermediate = intermediate;
-    }
-
-    public TGeometry toTGeometry()
-    {
-        return new TGeometryToConverter(module).convert(intermediate);
-    }
-
-    public TGeometry toTGeometry(String CRS) throws Exception
-    {
-        if (!intermediate.getCRS().equalsIgnoreCase(CRS))
-                Transform(module).from(intermediate).to(CRS) ;
-
-        return new TGeometryToConverter(module).convert(intermediate, CRS);
-    }
-
-
-
-    public GeoJsonObject toGeoJson()
-    {
-        return new GeoJsonToConverter(module).convert(intermediate);
-    }
-
-    private ToHelper() {}
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/d305f9da/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/projections/ProjectionsRegistry.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/projections/ProjectionsRegistry.java b/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/projections/ProjectionsRegistry.java
deleted file mode 100644
index ccce79f..0000000
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/projections/ProjectionsRegistry.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.qi4j.library.spatial.v2.projections;
-
-import org.cts.CRSFactory;
-import org.cts.crs.CRSException;
-import org.cts.crs.CoordinateReferenceSystem;
-import org.cts.registry.*;
-
-import java.util.Set;
-
-/**
- * Created by jj on 17.11.14.
- */
-public class ProjectionsRegistry {
-
-    protected static CRSFactory cRSFactory = new CRSFactory();
-
-
-    static {
-        RegistryManager registryManager = cRSFactory.getRegistryManager();
-        registryManager.addRegistry(new IGNFRegistry());
-        registryManager.addRegistry(new EPSGRegistry());
-        registryManager.addRegistry(new ESRIRegistry());
-        registryManager.addRegistry(new Nad27Registry());
-        registryManager.addRegistry(new Nad83Registry());
-        registryManager.addRegistry(new worldRegistry());
-    }
-
-
-    public Set<String> getSupportedSRID(String registryName) throws RegistryException
-    {
-        // cRSFactory.
-
-        return cRSFactory.getSupportedCodes(registryName);
-    }
-
-    // EPSG, IGNF, ESRI
-    public Set<String> getSupportedRegistryCodes(String registryName) throws RegistryException {
-        return cRSFactory.getRegistryManager().getRegistry(registryName).getSupportedCodes();
-    }
-
-    public String[] dumpRegistries() {
-        return cRSFactory.getRegistryManager().getRegistryNames();
-    }
-
-    public CoordinateReferenceSystem getCRS(String wkt)  {
-        try {
-            return cRSFactory.getCRS(wkt);
-        } catch(CRSException _ex)
-        {
-            _ex.printStackTrace();
-            return null;
-        }
-    }
-
-
-        public CoordinateReferenceSystem getReferenceSystem(String csName) throws CRSException
-    {
-        return cRSFactory.getCRS(csName);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/d305f9da/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/projections/SpatialRefSysManager.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/projections/SpatialRefSysManager.java b/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/projections/SpatialRefSysManager.java
deleted file mode 100644
index 203a353..0000000
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/projections/SpatialRefSysManager.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.qi4j.library.spatial.v2.projections;
-
-// https://joinup.ec.europa.eu/svn/gearscape/versions/0.1/platform/gdms/src/test/java/org/gdms/source/crs/TransformTest.java
-
-import org.cts.crs.CRSException;
-import org.cts.crs.CoordinateReferenceSystem;
-import org.qi4j.api.geometry.internal.TGeometry;
-import org.qi4j.library.spatial.projections.ProjectionsTransformation;
-
-/**
- * Created by jakes on 2/20/14.
- */
-public class SpatialRefSysManager {
-
-    // getWKT(srid)
-
-
-    static public CoordinateReferenceSystem getCRS(String wkt) throws CRSException
-    {
-       return new ProjectionsRegistry().getCRS(wkt);
-    }
-
-    public void getTransformation(int sourceSRID, int targetSRID) throws Exception
-    {
-
-    }
-
-    public void getTransformation(String sourceSRCodeAndAuthority, String targetSRAuthorityAndCode) throws Exception
-    {
-
-    }
-
-    static public TGeometry transform(TGeometry geometry, String targetSRAuthorityAndCode) throws Exception
-    {
-       return new ProjectionsTransformation().transform(geometry, getCRS(targetSRAuthorityAndCode));
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/d305f9da/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/transformations/FromHelper.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/transformations/FromHelper.java b/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/transformations/FromHelper.java
deleted file mode 100644
index cb9bafb..0000000
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/transformations/FromHelper.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.qi4j.library.spatial.v2.transformations;
-
-import org.qi4j.api.geometry.internal.TGeometry;
-import org.qi4j.api.structure.Module;
-import org.qi4j.library.spatial.v2.conversions.from.TGeometryFromConverter;
-
-/**
- * Created by jj on 04.12.14.
- */
-public class FromHelper {
-
-    private Module module;
-
-    public FromHelper(Module module)
-    {
-        this.module = module;
-    }
-
-    private FromHelper() {}
-
-    public ToHelper from(TGeometry tGeometry)
-    {
-        return new ToHelper(module, new TGeometryFromConverter(module).convert(tGeometry));
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/d305f9da/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/transformations/TTransformations.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/transformations/TTransformations.java b/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/transformations/TTransformations.java
deleted file mode 100644
index a8106fd..0000000
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/transformations/TTransformations.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.qi4j.library.spatial.v2.transformations;
-
-import org.qi4j.api.structure.Module;
-
-/**
- * Created by jj on 04.12.14.
- */
-public class TTransformations {
-
-    public static FromHelper Transform(Module module)
-    {
-        return new FromHelper(module);
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/d305f9da/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/transformations/ToHelper.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/transformations/ToHelper.java b/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/transformations/ToHelper.java
deleted file mode 100644
index eab8834..0000000
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/v2/transformations/ToHelper.java
+++ /dev/null
@@ -1,168 +0,0 @@
-package org.qi4j.library.spatial.v2.transformations;
-
-import org.cts.IllegalCoordinateException;
-import org.cts.crs.GeodeticCRS;
-import org.cts.op.CoordinateOperation;
-import org.cts.op.CoordinateOperationFactory;
-import org.qi4j.api.geometry.*;
-import org.qi4j.api.geometry.internal.Coordinate;
-import org.qi4j.api.geometry.internal.TGeometry;
-import org.qi4j.api.structure.Module;
-import org.qi4j.library.spatial.v2.projections.SpatialRefSysManager;
-
-import java.util.List;
-
-/**
- * Created by jj on 04.12.14.
- */
-public class ToHelper {
-
-    private Module module;
-    private TGeometry intermediate;
-    private double maxPrecisionMeanConversionError = Double.MAX_VALUE;
-
-    public ToHelper(Module module, TGeometry intermediate)
-    {
-        this.module = module;
-        this.intermediate = intermediate;
-    }
-
-    private ToHelper() {}
-
-
-    public  void to(String CRS, double maxPrecisionMeanConversionError) throws RuntimeException
-    {
-        this.maxPrecisionMeanConversionError = maxPrecisionMeanConversionError;
-        to(CRS);
-    }
-
-    public  void to(String CRS) throws RuntimeException
-    {
-    try {
-        GeodeticCRS sourceCRS = (GeodeticCRS) SpatialRefSysManager.getCRS(intermediate.getCRS());
-        GeodeticCRS targetCRS = (GeodeticCRS) SpatialRefSysManager.getCRS(CRS);
-
-        if (sourceCRS.equals(targetCRS)) {
-            return;
-        }
-        switch (intermediate.getType()) {
-            case POINT:
-                transform(sourceCRS, targetCRS, new Coordinate[]{((TPoint) intermediate).getCoordinate()});
-                break;
-            case MULTIPOINT:
-                transform(sourceCRS, targetCRS, ((TMultiPoint) intermediate).getCoordinates());
-                break;
-            case LINESTRING:
-                transform(sourceCRS, targetCRS, ((TLineString) intermediate).getCoordinates());
-                break;
-            // case MULTILINESTRING    : transform(sourceCRS, targetCRS, (() intermediate).getCoordinates()); break; break;
-            case POLYGON:
-                transform(sourceCRS, targetCRS, ((TPolygon) intermediate).getCoordinates());
-                break;
-            case MULTIPOLYGON:
-                transform(sourceCRS, targetCRS, ((TMultiPolygon) intermediate).getCoordinates());
-                break;
-            case FEATURE:
-                transform(sourceCRS, targetCRS, ((TFeature) intermediate).getCoordinates());
-                break;
-            case FEATURECOLLECTION:
-                transform(sourceCRS, targetCRS, ((TFeatureCollection) intermediate).getCoordinates());
-                break;
-        }
-
-        // JJ TODO - Set nested TGeometries CRSs as well
-        intermediate.setCRS(targetCRS.getCode());
-    } catch(Exception _ex)
-    {
-        throw new RuntimeException(_ex);
-    }
-    }
-
-
-
-    private void transformTPoint(GeodeticCRS sourceCRS, GeodeticCRS targetCRS, TPoint tPoint ) throws Exception
-    {
-        transform(sourceCRS, targetCRS, new Coordinate[] { tPoint.getCoordinate() });
-        tPoint.setCRS(targetCRS.getCode());
-    }
-
-    private void transformTMultiPoint(GeodeticCRS sourceCRS, GeodeticCRS targetCRS, TMultiPoint tMultiPoint ) throws Exception
-    {
-        transform(sourceCRS, targetCRS, tMultiPoint.getCoordinates());
-        tMultiPoint.setCRS(targetCRS.getCode());
-        // tMultiPoint.
-    }
-
-    private void transformTLineString(GeodeticCRS sourceCRS, GeodeticCRS targetCRS, TLineString tLineString ) throws Exception
-    {
-
-        transform(sourceCRS, targetCRS, tLineString.getCoordinates());
-        tLineString.setCRS(targetCRS.getCode());
-        // tMultiPoint.
-    }
-
-
-    private void transform(GeodeticCRS sourceCRS, GeodeticCRS targetCRS, Coordinate... coordinates) throws IllegalCoordinateException
-    {
-        List<CoordinateOperation> ops;
-        ops = CoordinateOperationFactory.createCoordinateOperations(sourceCRS, targetCRS);
-
-        if (!ops.isEmpty()) {
-            if (true) {
-                 System.out.println("Number of Operations " + ops.size());
-                 System.out.println("Precision " + ops.get(0).getPrecision() + " m.");
-                 System.out.println(ops.get(0));
-            }
-
-            if (maxPrecisionMeanConversionError < Double.MAX_VALUE && maxPrecisionMeanConversionError < ops.get(0).getPrecision())
-                throw new RuntimeException("Transformation from " + sourceCRS.getCode() + " to " + targetCRS.getCode() +
-                        " can not be done with the requested precision of " + maxPrecisionMeanConversionError + " meters." +
-                        " Current precision mean conversion error is " + ops.get(0).getPrecision() + " meters.");
-
-            for (Coordinate coordinate : coordinates)
-            {
-                double[] c = ops.get(0).transform(new double[]{coordinate.x(), coordinate.y() /** z */} );
-                coordinate.x(c[0]).y(c[1]);
-            }
-
-//        } else {
-//            coordinate.x(0d).y(0d);
-
-        }
-    }
-
-
-
-/**
-    private double[] transform(GeodeticCRS sourceCRS, GeodeticCRS targetCRS, double[] pointSource) throws IllegalCoordinateException {
-
-        if (sourceCRS.equals(targetCRS))
-            return pointSource;
-
-        List<CoordinateOperation> ops;
-        ops = CoordinateOperationFactory.createCoordinateOperations(sourceCRS, targetCRS);
-        if (!ops.isEmpty()) {
-            if (true) {
-                System.out.println(ops.get(0));
-            }
-            return ops.get(0).transform(new double[]{pointSource[0], pointSource[1], pointSource[2]});
-        } else {
-            return new double[]{0.0d, 0.0d, 0.0d};
-        }
-    }
-*/
-
-
-
-/**
- public double[] transform(String csNameSrc, String csNameDest, double[] pointSource) throws IllegalCoordinateException, CRSException {
-
- CoordinateReferenceSystem inputCRS = cRSFactory.getCRS(csNameSrc);
- CoordinateReferenceSystem outputCRS = cRSFactory.getCRS(csNameDest);
-
- return transform((GeodeticCRS) inputCRS, (GeodeticCRS) outputCRS, pointSource);
- }
-
- */
-
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/d305f9da/libraries/spatial/src/test/java/org/qi4j/library/spatial/SpatialRefSysManagerTest.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/test/java/org/qi4j/library/spatial/SpatialRefSysManagerTest.java b/libraries/spatial/src/test/java/org/qi4j/library/spatial/SpatialRefSysManagerTest.java
deleted file mode 100644
index 851d281..0000000
--- a/libraries/spatial/src/test/java/org/qi4j/library/spatial/SpatialRefSysManagerTest.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package org.qi4j.library.spatial;
-
-import org.junit.Test;
-import org.qi4j.api.geometry.TLineString;
-import org.qi4j.api.geometry.TPoint;
-import org.qi4j.api.geometry.TPolygon;
-import org.qi4j.api.geometry.internal.Coordinate;
-import org.qi4j.api.geometry.internal.TLinearRing;
-import org.qi4j.api.value.ValueBuilder;
-import org.qi4j.bootstrap.AssemblyException;
-import org.qi4j.bootstrap.ModuleAssembly;
-import org.qi4j.library.spatial.v2.projections.ProjectionsRegistry;
-import org.qi4j.library.spatial.v2.projections.SpatialRefSysManager;
-import org.qi4j.test.AbstractQi4jTest;
-
-import java.util.Arrays;
-
-import static org.junit.Assert.*;
-import static org.qi4j.api.geometry.TGeometryFactory.TPoint;
-
-/**
- * Created by jj on 18.11.14.
- */
-public class SpatialRefSysManagerTest extends AbstractQi4jTest {
-
-    @Override
-    public void assemble( ModuleAssembly module )
-            throws AssemblyException
-    {
-        // Internal Types
-        module.values(
-                Coordinate.class,
-                TLinearRing.class);
-
-        // API values
-        module.values(TPoint.class,TLineString.class, TPolygon.class);
-        // module.services(GeometryFactory.class);
-
-
-        // module.forMixin( SomeType.class ).declareDefaults().someValue().set( "&lt;unknown&gt;" );
-    }
-
-    @Test
-    public void whenValidSRID() throws Exception
-    {
-        assertNotNull(SpatialRefSysManager.getCRS("EPSG:4326"));
-        System.out.println(SpatialRefSysManager.getCRS("EPSG:4326").toWKT());
-    }
-
-    @Test
-    public void whenTransformation() throws Exception
-    {
-
-        ValueBuilder<TPoint> builder = module.newValueBuilder(TPoint.class);
-
-        // TPoint pointAs_EPSG_4326_1 = builder.prototype().X(10.712809).Y(49.550881);
-
-        // TPoint pointAs_EPSG_4326_1 = module.newValueBuilder(TPoint.class).prototype().X(10.712809).Y(49.550881);
-
-        TPoint pointAs_EPSG_4326_1 = TPoint(module).x(10.712809).y(49.550881).geometry();
-
-/**
-        TPoint point = builder.prototype().of
-            (
-                    module.newValueBuilder(Coordinate.class).prototype().of(10.712809),  //x
-                    module.newValueBuilder(Coordinate.class).prototype().of(49.550881)   //y
-            );
-*/
-
-       //  System.out.println(" Array " + Arrays.toString(pointAs_EPSG_4326_1.source()));
-
-       //  SpatialRefSysManager.transform(point, "EPSG:4326");
-
-       TPoint pointAs_EPSG_27572 = (TPoint)SpatialRefSysManager.transform(pointAs_EPSG_4326_1, "EPSG:27572");
-
-        System.out.println(pointAs_EPSG_27572);
-
-        TPoint pointAs_EPSG_4326_2 = (TPoint)SpatialRefSysManager.transform(pointAs_EPSG_27572, "EPSG:4326");
-
-        System.out.println(pointAs_EPSG_4326_2);
-
-        // SpatialRefSysManager.transform(point, "EPSG:26736");
-
-    }
-
-    @Test
-    public void dumpRegistries() throws Exception {
-        System.out.println(Arrays.toString(new ProjectionsRegistry().dumpRegistries()));
-
-        System.out.println(new ProjectionsRegistry().getSupportedRegistryCodes("epsg"));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/d305f9da/libraries/spatial/src/test/java/org/qi4j/library/spatial/conversions/ConversionsFromWktTest.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/test/java/org/qi4j/library/spatial/conversions/ConversionsFromWktTest.java b/libraries/spatial/src/test/java/org/qi4j/library/spatial/conversions/ConversionsFromWktTest.java
new file mode 100644
index 0000000..82f7455
--- /dev/null
+++ b/libraries/spatial/src/test/java/org/qi4j/library/spatial/conversions/ConversionsFromWktTest.java
@@ -0,0 +1,33 @@
+package org.qi4j.library.spatial.conversions;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.Test;
+import org.qi4j.api.geometry.TPoint;
+import org.qi4j.bootstrap.AssemblyException;
+import org.qi4j.bootstrap.ModuleAssembly;
+import org.qi4j.library.spatial.assembly.TGeometryAssembler;
+import org.qi4j.test.AbstractQi4jTest;
+
+
+/**
+ * Created by jj on 04.12.14.
+ */
+public class ConversionsFromWktTest extends AbstractQi4jTest {
+
+    private final String CRS_EPSG_4326 = "EPSG:4326";
+    private final String CRS_EPSG_27572 = "EPSG:27572";
+    private ObjectMapper GeoJsonMapper = new ObjectMapper();
+
+    @Override
+    public void assemble(ModuleAssembly module)
+            throws AssemblyException {
+        new TGeometryAssembler().assemble(module);
+    }
+
+    @Test
+    public void WhenConvertFromWktToTGeometry() throws Exception {
+        TPoint tPoint = (TPoint) TConversions.Convert(module).from("POINT(11.57958981111 48.13905780941111 )", CRS_EPSG_27572).toTGeometry();
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/d305f9da/libraries/spatial/src/test/java/org/qi4j/library/spatial/conversions/ConversionsWithProjectionsTest.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/test/java/org/qi4j/library/spatial/conversions/ConversionsWithProjectionsTest.java b/libraries/spatial/src/test/java/org/qi4j/library/spatial/conversions/ConversionsWithProjectionsTest.java
new file mode 100644
index 0000000..ddcde72
--- /dev/null
+++ b/libraries/spatial/src/test/java/org/qi4j/library/spatial/conversions/ConversionsWithProjectionsTest.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2014 Jiri Jetmar.
+ *
+ * Licensed  under the  Apache License,  Version 2.0  (the "License");
+ * you may not use  this file  except in  compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed  under the  License is distributed on an "AS IS" BASIS,
+ * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.qi4j.library.spatial.conversions;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.geojson.FeatureCollection;
+import org.junit.Test;
+import org.qi4j.api.geometry.TFeatureCollection;
+import org.qi4j.api.geometry.TPoint;
+import org.qi4j.bootstrap.AssemblyException;
+import org.qi4j.bootstrap.ModuleAssembly;
+import org.qi4j.library.spatial.assembly.TGeometryAssembler;
+import org.qi4j.library.spatial.topo.GeoJSONSwissLakes2013;
+import org.qi4j.library.spatial.projection.transformations.TTransformations;
+import org.qi4j.test.AbstractQi4jTest;
+
+import static org.junit.Assert.assertTrue;
+import static org.qi4j.api.geometry.TGeometryFactory.TPoint;
+import static org.qi4j.library.spatial.conversions.TConversions.Convert;
+
+
+public class ConversionsWithProjectionsTest extends AbstractQi4jTest {
+
+    private final String CRS1 = "EPSG:4326";
+    private ObjectMapper geoJsonMapper = new ObjectMapper();
+
+
+    @Override
+    public void assemble(ModuleAssembly module)
+            throws AssemblyException {
+        new TGeometryAssembler().assemble(module);
+    }
+
+    @Test
+    public void whenConvertFromTGeometryToTGeometryConvertProjections() throws Exception {
+        TPoint tPoint1 = TPoint(module).x(11.57958981111).y(48.13905780941111).geometry();
+        TPoint tPoint2 = (TPoint) Convert(module).from(tPoint1).toTGeometry(CRS1);
+        assertTrue(tPoint1.compareTo(tPoint2) == 0);
+    }
+
+
+    @Test
+    public void whenConvertSwissLakesTranslateProjection() throws Exception
+    {
+        // convert from CH1903 (EPSG:21781) to EPSG:4326
+//        TFeatureCollection swisslakes =  (TFeatureCollection)Convert(module).from(geoJsonMapper.readValue(GeoJSONSwissLakes2013.SWISS_LAKES, FeatureCollection.class))
+//         .toTGeometry("EPSG:21781");
+
+        FeatureCollection featureCollection = geoJsonMapper.readValue(GeoJSONSwissLakes2013.SWISS_LAKES, FeatureCollection.class);
+        TFeatureCollection tFeatureCollection = (TFeatureCollection)Convert(module).from(featureCollection).toTGeometry();
+        tFeatureCollection.setCRS("EPSG:21781");
+        System.out.println(tFeatureCollection.getCoordinates().length);
+        System.out.println(tFeatureCollection.getNumPoints());
+
+        TTransformations.Transform(module).from(tFeatureCollection).to("EPSG:4326");
+
+        System.out.println("tFeatureCollection " + tFeatureCollection);
+
+        // tFeatureCollection.getCoordinates();
+
+
+ /**
+        TFeatureCollection tFeatureCollection = (TFeatureCollection)Convert(module).from(featureCollection).toTGeometry("EPSG:21781");
+        System.out.println(tFeatureCollection);
+        TTransformations.Transform(module).from(tFeatureCollection).to("EPSG:4326");
+        System.out.println(tFeatureCollection);
+  */
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/d305f9da/libraries/spatial/src/test/java/org/qi4j/library/spatial/conversions/ConvertFromGeoJsonToTGeometryTest.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/test/java/org/qi4j/library/spatial/conversions/ConvertFromGeoJsonToTGeometryTest.java b/libraries/spatial/src/test/java/org/qi4j/library/spatial/conversions/ConvertFromGeoJsonToTGeometryTest.java
new file mode 100644
index 0000000..377eebc
--- /dev/null
+++ b/libraries/spatial/src/test/java/org/qi4j/library/spatial/conversions/ConvertFromGeoJsonToTGeometryTest.java
@@ -0,0 +1,179 @@
+/*
+ * Copyright 2014 Jiri Jetmar.
+ *
+ * Licensed  under the  Apache License,  Version 2.0  (the "License");
+ * you may not use  this file  except in  compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed  under the  License is distributed on an "AS IS" BASIS,
+ * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.qi4j.library.spatial.conversions;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.geojson.*;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.qi4j.api.geometry.*;
+import org.qi4j.bootstrap.AssemblyException;
+import org.qi4j.bootstrap.ModuleAssembly;
+import org.qi4j.library.spatial.assembly.TGeometryAssembler;
+import org.qi4j.test.AbstractQi4jTest;
+
+import java.util.Arrays;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.qi4j.api.geometry.TGeometryFactory.*;
+
+
+public class ConvertFromGeoJsonToTGeometryTest extends AbstractQi4jTest {
+
+    private final String CRS_EPSG_4326_ = "EPSG:4326";
+    private final String CRS_EPSG_27572 = "EPSG:27572";
+    private ObjectMapper geoJsonMapper = new ObjectMapper();
+
+    @Override
+    public void assemble(ModuleAssembly module)
+            throws AssemblyException {
+        new TGeometryAssembler().assemble(module);
+    }
+
+    @Ignore("Benchmarking is not in scope for this test.")
+    @Test
+    public void whenConvertFromTGeometryToTGeometry() throws Exception {
+        TPoint tPoint1 = TPoint(module).x(11.57958981111).y(48.13905780941111).geometry();
+        for (int i = 0; i < 1000000; i++) {
+            TPoint tPoint2 = (TPoint) TConversions.Convert(module).from(tPoint1).toTGeometry(CRS_EPSG_27572);
+            TPoint tPoint3 = (TPoint) TConversions.Convert(module).from(tPoint1).toTGeometry(CRS_EPSG_4326_);
+
+        }
+    }
+
+    @Test
+    public void whenConvertPointFromGeoJsonToTGeometry() {
+        TPoint tPoint = TPoint(module).y(100).x(0).geometry();
+        Point gPoint = new Point(100, 0);
+        TPoint convTPoint = (TPoint) TConversions.Convert(module).from(gPoint).toTGeometry();
+        assertTrue(tPoint.compareTo(convTPoint) == 0);
+    }
+
+    @Test
+    public void whenConvertMultiPointFromGeoJsonToTGeometry() {
+        TMultiPoint tMultiPoint = TMultiPoint(module).of
+                (
+                        TPoint(module).y(1).x(1).geometry(),
+                        TPoint(module).y(2).x(2).geometry()
+                ).geometry();
+        MultiPoint multiPoint = new MultiPoint(new LngLatAlt(1, 1), new LngLatAlt(2, 2));
+        TMultiPoint convTMultiPoint = (TMultiPoint) TConversions.Convert(module).from(multiPoint).toTGeometry();
+        assertTrue(((TPoint) tMultiPoint.getGeometryN(0)).compareTo(convTMultiPoint.getGeometryN(0)) == 0);
+    }
+
+
+    @Test
+    public void whenConvertLineStringFromGeoJsonToTGeometry() throws Exception {
+        LineString lineString = geoJsonMapper.readValue("{\"type\":\"LineString\",\"coordinates\":[[100.0,0.0],[101.0,1.0]]}",
+                LineString.class);
+        TLineString convTLineString = (TLineString) TConversions.Convert(module).from(lineString).toTGeometry();
+        assertTrue(TLineString(module).points(new double[][]{{100, 0}, {101, 1}}).geometry().compareTo(convTLineString) == 0);
+    }
+
+    @Test
+    public void whenConvertMultiLineStringFromGeoJsonToTGeometry() throws Exception {
+        MultiLineString multiLineString = new MultiLineString();
+        multiLineString.add(Arrays.asList(new LngLatAlt(100, 0), new LngLatAlt(101, 1)));
+        TMultiLineString convTMultiLineString = (TMultiLineString) TConversions.Convert(module).from(multiLineString).toTGeometry();
+        TMultiLineString compTMultiLineString = TMultiLineString(module).of
+                (
+                        TLineString(module).points(new double[][]
+                                {
+                                        {0, 100},
+                                        {1, 101}
+                                }).geometry()
+                ).geometry();
+        assertTrue(((TLineString) compTMultiLineString.getGeometryN(0)).compareTo((TLineString) convTMultiLineString.getGeometryN(0)) == 0);
+    }
+
+    @Test
+    public void whenConvertPolygonFromGeoJsonToTGeometry() throws Exception {
+        Polygon polygon = geoJsonMapper.readValue("{\"type\":\"Polygon\",\"coordinates\":"
+                + "[[[100.0,0.0],[101.0,0.0],[101.0,1.0],[100.0,1.0],[100.0,0.0]],"
+                + "[[100.2,0.2],[100.8,0.2],[100.8,0.8],[100.2,0.8],[100.2,0.2]]]}", Polygon.class);
+        TPolygon convTPolygon = (TPolygon) TConversions.Convert(module).from(polygon).toTGeometry();
+
+        TPolygon compTPolygon = TPolygon(module)
+                .shell
+                        (
+                                TLinearRing(module).ring(new double[][]
+                                        {
+                                                {0, 100},
+                                                {0, 101},
+                                                {1, 101},
+                                                {1, 100},
+                                                {0, 100}
+                                        }).geometry()
+                        )
+                .withHoles
+                        (
+                                TLinearRing(module).ring(new double[][]
+                                        {
+                                                {0.2, 100.2},
+                                                {0.2, 100.8},
+                                                {0.8, 100.8},
+                                                {0.8, 100.2},
+                                                {0.2, 100.2}
+                                        }).geometry()
+                        )
+                .geometry();
+
+        assertEquals(compTPolygon.getNumPoints(), convTPolygon.getNumPoints());
+        assertTrue(compTPolygon.shell().get().compareTo(convTPolygon.shell().get()) == 0);
+    }
+
+    @Test
+    public void whenConvertMultiPolygonFromGeoJsonToTGeometry() throws Exception {
+        MultiPolygon multiPolygon = geoJsonMapper.readValue("{\"type\":\"MultiPolygon\",\"coordinates\":[[[[102.0,2.0],[103.0,2.0],[103.0,3.0],[102.0,3.0],[102.0,2.0]]],"
+                + "[[[100.0,0.0],[101.0,0.0],[101.0,1.0],[100.0,1.0],[100.0,0.0]],"
+                + "[[100.2,0.2],[100.8,0.2],[100.8,0.8],[100.2,0.8],[100.2,0.2]]]]}", MultiPolygon.class);
+        TMultiPolygon convTMultiPolygon = (TMultiPolygon) TConversions.Convert(module).from(multiPolygon).toTGeometry();
+        assertEquals(15, convTMultiPolygon.getNumPoints());
+    }
+
+    @Test
+    public void whenConvertFeatureFromGeoJsonToTGeometry() throws Exception {
+        Feature feature = new Feature();
+        feature.setGeometry(new Point(100, 0));
+        TFeature convTFeature = (TFeature) TConversions.Convert(module).from(feature).toTGeometry();
+        TFeature compTFeature = TFeature(module).of(TPoint(module).y(100).x(0).geometry()).geometry();
+        assertTrue(convTFeature.getNumPoints() == compTFeature.getNumPoints());
+    }
+
+    @Test
+    public void whenConvertFeatureCollectionFromGeoJsonToTGeometry() throws Exception {
+        Feature f1 = new Feature();
+        f1.setGeometry(geoJsonMapper.readValue("{\"type\":\"MultiPolygon\",\"coordinates\":[[[[102.0,2.0],[103.0,2.0],[103.0,3.0],[102.0,3.0],[102.0,2.0]]],"
+                + "[[[100.0,0.0],[101.0,0.0],[101.0,1.0],[100.0,1.0],[100.0,0.0]],"
+                + "[[100.2,0.2],[100.8,0.2],[100.8,0.8],[100.2,0.8],[100.2,0.2]]]]}", MultiPolygon.class));
+
+        Feature f2 = new Feature();
+        f2.setGeometry(geoJsonMapper.readValue("{\"type\":\"LineString\",\"coordinates\":[[100.0,0.0],[101.0,1.0]]}",
+                LineString.class));
+
+        FeatureCollection featureCollection = new FeatureCollection();
+        featureCollection.add(f1);
+        featureCollection.add(f2);
+
+        TFeatureCollection convTFeatureCollection = (TFeatureCollection) TConversions.Convert(module).from(featureCollection).toTGeometry();
+        System.out.println(convTFeatureCollection);
+    }
+
+}


Mime
View raw message