Hello All,

I'm having an issue with a point transformation.

I'm using 8.0-M1 to preform a transformation from WGS84 to a Cartesian system 
suitable for plotting points on a 2d graph.  I know the 
DefaultGeocentricCRS.CARTESIAN uses a 3D system. What type of geometry should I 
be transforming this into? I will want to use this to plot on an x,y graph. 
Right now the last line of code produces the error.

Thanks
Mike 

Code:

Coordinate coord = new Coordinate(longitude, latitude );
Point geoPoint = geometryFactory.createPoint( coord );

CoordinateReferenceSystem sourceCRS = DefaultGeographicCRS.WGS84;
CoordinateReferenceSystem targetCRS =  DefaultGeocentricCRS.CARTESIAN;

MathTransform transform = CRS.findMathTransform(sourceCRS, targetCRS, false);
Point targetGeometry = (Point) JTS.transform(geoPoint, transform);


Error:

Exception: java.lang.IllegalArgumentException
Message: dimension must be <= 3
Stack trace:

  
com.vividsolutions.jts.geom.impl.CoordinateArraySequenceFactory.create(CoordinateArraySequenceFactory.java:90)
  
org.geotools.geometry.jts.DefaultCoordinateSequenceTransformer.transform(DefaultCoordinateSequenceTransformer.java:92)
  
org.geotools.geometry.jts.GeometryCoordinateSequenceTransformer.projectCoordinateSequence(GeometryCoordinateSequenceTransformer.java:185)
  
org.geotools.geometry.jts.GeometryCoordinateSequenceTransformer.transformPoint(GeometryCoordinateSequenceTransformer.java:172)
  
org.geotools.geometry.jts.GeometryCoordinateSequenceTransformer.transform(GeometryCoordinateSequenceTransformer.java:87)
  org.geotools.geometry.jts.JTS.transform(JTS.java:240)
  
edu.agrid.sensorbar.CalcSensorLatLonExtension.convertCRS(CalcSensorLatLonExtension.java:242)
  
edu.agrid.sensorbar.CalcSensorLatLonExtension.doWork(CalcSensorLatLonExtension.java:166)
  com.rapidminer.operator.Operator.execute(Operator.java:829)
  
com.rapidminer.operator.execution.SimpleUnitExecutor.execute(SimpleUnitExecutor.java:51)
  com.rapidminer.operator.ExecutionUnit.execute(ExecutionUnit.java:709)
  com.rapidminer.operator.OperatorChain.doWork(OperatorChain.java:376)
  com.rapidminer.operator.Operator.execute(Operator.java:829)
  com.rapidminer.Process.run(Process.java:899)
  com.rapidminer.Process.run(Process.java:795)
  com.rapidminer.Process.run(Process.java:790)
  com.rapidminer.Process.run(Process.java:780)
  com.rapidminer.gui.ProcessThread.run(ProcessThread.java:75)
------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to