how can we WgsPoint'lonlat in epsg90013
but I need the epsg4326.
I can't find the convert API.
Anyone know that?
I have the follow data in my database
ESPG 900913
"POINT(-742990.597843593 7056832.45410695)"
"POINT(-742923.06030853 7058383.83956466)"
"POINT(-742900.250944863 7058167.17745916)"
"POINT(-742879.489859832 7057444.59612811)"
"POINT(-742861.912512237 7058406.77027894)"
but I need these
ESPG 4326
"POINT(-6.6743981 53.3973213)"
"POINT(-6.67379140000001 53.4056302)"
"POINT(-6.67358649999998 53.4044699)"
"POINT(-6.6734 53.4006)"
"POINT(-6.67324210000001 53.405753)"
I can Transform inside the database,but I want to transform them outside the data. I'm looking for a java API, or math function
You can transform them using library code, via pixel space. First make sure that active map is in EPSG 3785 (forget about 90913). E.g. just use default OSM map. Then convert your projected coordinates to pixels of some zoom using linear calculation, like they were map pixel coordinates. Note that with bigger zoom accuracy is better. Then use map service mapPosToWgs method. My code:
// some constants double xmax = 20037508.34; // ymax is same for EPSG:3785 int basezoom=20; // test coordinate conversion double x = -742990.597843593; // in projected double y = 7056832.45410695; // convert to pixels on some zoom double xpix=(1+(x/xmax)) * Float11.pow(2,basezoom-1)*256; double ypix=(1+(y/xmax)) * Float11.pow(2,basezoom-1)*256; // convert to WGS Point wp = map.getMap().mapPosToWgs(new MapPos((int) xpix,(int) ypix,basezoom)); System.out.println(wp);
I got result as: 53.39732S, 6.674398W which is quite close to your numbers.
Finally you can use the WGS point in library API to add points to map. This will convert it internally back to pixel coordinates, but this should not too much overhead.
Thank you for your comments
I create the new database with espg4326
What do you mean by "lonlat in epsg90013". Can you give a example coordinate?
For server-side conversion do you know about http://trac.osgeo.org/proj/ tools?
/JaakL