views:

569

answers:

2

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

+1  A: 

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.

trashgod
Not seen the Globe Applet before - very nice.
geographika
+1  A: 

Another option is to use the OpenSource GIS Java library GeoTools:

http://geotools.org/

Details on the projection classes here:

http://geotools.org/javadocs/org/geotools/referencing/operation/projection/MapProjection.html

Projection definitions in many different formats for all projections can be downloaded from:

http://www.spatialreference.org/

E.g. http://www.spatialreference.org/ref/epsg/4326/

geographika
Geotools is complicated but very, very powerful - we use it at my job for coordinate and projection conversions, among other things.
Chamelaeon