Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am a Java Developer and I was given this coordinates from a database

verbat_sistema_coordenadas  verbatim_SRS    datum   verbat_longitud verbat_latitud
UTM                         WGS84           WGS84   9947921          815887

And I tried the examples here, but I get something like this when I try to use the MercatorTransform showed there

LatVerb           LonVerb               LatEPSG                        LonEPSG
815612.0         9948458.0           7.3267672551129115        66.40190209729147

I tried the formulas shown there and I get differnt result with each formula and none are close to what I need. Then someone I am working with gave me an excel sheet with some formulas but the have a million variables and constants

Fi' Ni  a   A1  A2  J2  J4  J6  Alfa    Beta    Gamma   B(fi)   b   Zeta    Xi  Eta Sen h Xi    Delta Lambda    Tau

And they depend on the Timezone(meridian, maybe I am translating this wrong?), and the hemisphere, and they seem to work. They gave me -0.4544682953,-78.1736736245, which is the correct answer.

This is the excel sheet

I tried using geotools, but it was way off too

share|improve this question
What is your question? – whuber Jun 6 '13 at 4:23
Sorry, I am looking for a formula to transform from WGS84 to EPSG 3785, but none of them give me the same results, what is the correct way to do this. – Juan Diego Jun 6 '13 at 5:07

UTM has nothing to do with EPSG 3785 and Google maps, apart from the WGS84 ellipsoid and datum. And WGS84 in degrees is yet another coordinate system.

If your desired point of the earth has negative lat/lon in degrees, the Google mercator coordinates are negative as well.

If you have UTM coordinates, they are always positive, but you need the UTM zone they are laying in. For the southern hemisphere, positive y counts from the south pole, for the northern hemisphere from the equator.

You can find formulas for UTM here:

Your zone might be UTM 30S.

share|improve this answer

Based on the latitude-longitude values you gave as correct (-0.4544682953,-78.1736736245), that the input coordinate values are labeled misleadingly.

 verbat_longitud verbat_latitud
   9947921          815887

The first number is the northing value and the 2nd one is the easting. Also based on the latitude-longitude values, the zone should be 17 South (data is in/near Quito).

So you have two conversions to do: UTM to latitude,longitude and latitude,longitude to EPSG:3857 (EPSG:3785 has been deprecated and replaced with 3857). UTM is based on tranverse Mercator and knowing the UTM zone allows you to figure out the parameter values. To convert to EPSG:3857, you will need the sphere-based equations for Mercator.

share|improve this answer

You can use Geotools

 //create reference system WGS84 Web Mercator
 CoordinateReferenceSystem wgs84Web = CRS.decode("EPSG:3857", true);
 //create reference system WGS84
 CoordinateReferenceSystem wgs84 = CRS.decode("EPSG:4326", true);

 //Create transformation from WS84 Web Mercator to WGS84
 MathTransform wgs84WebToWgs84 = CRS.findMathTransform(wgs84Web, wgs84);

 GeometryFactory jtsGf = JTSFactoryFinder.getGeometryFactory();

 //create a point
 Geometry pointInWgs84Web = jtsGf.createPoint(new Coordinate(-3.678393944400995, 40.43664108222252);
//transform point from WGS84 Web Mercator to WGS84 
Geometry pointInWgs84 = JTS.transform(pointInWgs84Web, wgs84WebToWgs84);
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.