|
From: Oleksandr H. <guz...@gm...> - 2012-06-23 22:32:01
|
Hey Dmitry, here is the small example I wrote for you, though I am not sure if CRS code you gave corresponds to UTM 12N ( please see this site for the codes http://www.epsg-registry.org/ ). import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.GeometryFactory; import com.vividsolutions.jts.geom.Point; import org.geotools.geometry.jts.JTS; import org.geotools.referencing.CRS; import org.geotools.referencing.crs.DefaultGeographicCRS; import org.opengis.referencing.FactoryException; import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.opengis.referencing.operation.MathTransform; import org.opengis.referencing.operation.TransformException; /** * User: san * Date: 23/06/12 * Time: 6:09 PM */ public class TestReproject { public static void main(String[] args) throws FactoryException, TransformException { GeometryFactory gf = new GeometryFactory(); Coordinate c = new Coordinate(175784.99999999997, 5842215.0); Point p = gf.createPoint(c); CoordinateReferenceSystem utmCrs = CRS.decode("EPSG:3785"); MathTransform mathTransform = CRS.findMathTransform(utmCrs, DefaultGeographicCRS.WGS84, false); Point p1 = (Point) JTS.transform(p, mathTransform); System.out.println(p1.getCoordinate()); } } Cheers -- Oleksandr (Sasha) Huziy 2012/6/23 Dmitry Dementiev <dem...@gm...> > To be more exact I have: > NAME: WGS 84 / UTM zone 12N > CODE: 32612 > > 2012/6/24 Dmitry Dementiev <dem...@gm...> > >> Could you please point me out how can I make coordinate convertation from >> wgs84 to Google Map coordinate system(EPSG 3785), and vise versa. If it is >> possible, pls, give me some code examples. >> >> For example, I have coordinate : [175784.99999999997, 5842215.0] - it >> should be in Canada. I`d like to have this coordinate in EPSG 3785. >> >> Thank you. >> > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > GeoTools-GT2-Users mailing list > Geo...@li... > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > > |