Added by jgarnett, last edited by jgarnett on Feb 04, 2008

Labels

 
(None)

Google maps uses a bit of a shortcut, they make the assumption of a perfect sphere in order to be just that much faster (after all they want a pretty picture nothing more). This page goes over how you can integrate your real data with the projection used by google maps.

This page was formally part of the page 11 Referencing FAQ.

How to project my my Map for Google Maps

The GeoServer project has defined the class Mercator1SPGoogle (google uses a very simple sphere so they can be fast).

They have made this available as an invented EPSG code:

// Google == 9009l3 in leet!
CoordianteReferneceSystem googleCRS = CRS.decode("EPSG:900913");

Getting the Code from GeoServer

The class is here:
Mercator1SPGoogle.java

And it must be accompained by this file (placed in META-INF/services)

Once you have these two in your project the following wkt works:

PROJCS["WGS84 / Simple Mercator", GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS_1984", 6378137.0, 298.257223563]], PRIMEM["Greenwich", 0.0], UNIT["degree", 0.017453292519943295], AXIS["Longitude", EAST], AXIS["Latitude", NORTH]], PROJECTION["Mercator_1SP_Google"], PARAMETER["latitude_of_origin", 0.0], PARAMETER["central_meridian", 0.0], PARAMETER["scale_factor", 1.0], PARAMETER["false_easting", 0.0], PARAMETER["false_northing", 0.0], UNIT["m", 1.0], AXIS["x", EAST], AXIS["y", NORTH], AUTHORITY["EPSG","900913"]]

Testing the Fix in GeoTools

We would like to take the above code back into geotools, there is a bug report here:

Martin thinks he has done the work but we need a volunteer to check to see if it actually works as expected!

I though that it was already implemented in Geotools and no special class were
needed anymore? There is the idea: usually a ProjectedCRS is declared in WKT as
below (trimmed):

PROJCS["WGS 84 / World Mercator",
GEOGCS["WGS 84", DATUM[...
SPHEROID["WGS 84", 6378137.0, 298.257223563], ...
PROJECTION["Mercator (1SP)", AUTHORITY["EPSG","9804"]],
PARAMETER["latitude_of_origin", 0.0],
...

In normal WKT there is no PARAMETER[...] for "semi-major" and "semi-minor" axis
length because there are inferred from the enclosed SPHEROID element. However
for the special case of Google projection, we just need to add explicit axis
length definition, which override the SPHEROID definition.

It seems to me that I updated GeoTools in order to allow the above behavior. But
we may need a volunter for trying it. No special class needed. Just write down
the WKT and add explicit:

PARAMETER["semi-major", ...],
PARAMETER["semi-minor", ...]

elements with the same axis length (I don't remember what the value is). Parse
that WKT and it should work. If it really works, maybe we should add a line for
900913 in the "unnamed.properties" file in plugin/epsg-extension.