java transform projection EPSG:900913 to EPSG:4326

user268129 picture user268129 · Feb 7, 2010 · Viewed 11.7k times · Source

in the openlayers we can simple transform EPSG:900913 to EPSG:4326
I'm look for a java lib can do that.
here I found this, http://www.jhlabs.com/java/maps/proj/index.html

but the document is in c++
I don't know how to use it.


If anyone konw that,
please post a simple code

Answer

trashgod picture trashgod · Feb 8, 2010

Jerry Huxtable's delightful Globe Applet on the page you cited is indeed written in Java, as seen in the download. The class com.jhlabs.map.proj.ProjectionFactory contains a method named fromPROJ4Specification(), which returns a com.jhlabs.map.proj.Projection. You can use the EPSG:900913 parameters specified on the OpenLayers site to create the desired projection.

900913:
+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0
+x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs

You should also look at OpenMap.