[Proj] Problem overlaying georeferenced images in Google Maps
jorge.arevalo at gmail.com
Thu May 29 11:13:10 EDT 2008
First of all, sorry for the length of the message, but it's necessary to
explain the problem.
I've done a Java app that shows mobile coverage levels (codificated as
colours) in a zone using google maps api, but I have a problem that I
can't resolve. The app can be seen at
If you select a spanish province's name in the select box, you can see
the coverage level in this province, with three values codificated as
colours: very good coverage (strongest orange), good coverage (less
strong orange) and average (weakest orange). You can move the map, and
zoom, if you want.
Basically, the entries of my app are Mapinfo MIF/MID files, with
rectangles (MIF files) and associated coverage values, in dbM (MID
files), one pair per province. I tranform each pair of files in a single
raster file. Each byte of the raster is a coverage value.And I
georeference the raster with the northing and easting of the upper left
and lower right corners, based on the MIF file (yes, like using a World
File, not exactly the same, but it's ok).
As you can imagine, when the raster file is transformed into an image to
be overlaid on the map, I can not zoom. I need to "decimate" (for the
higher zoom levels), and to "interpolate" (for the lower zoom levels).
This is, I need to sample the raster with a different freq for each zoom
level. When I do this, I transform each sampled portion of the raster in
a PNG file, and I store it in a database, with the northing, easting,
lat and long (obtained easily from northing, easting and utm zone)
coords to put the image in the map.
So, the problems are two (you can check them in the map, for example,
selecting "Islas Baleares" in the select box):
- There is an error, because the image does not overlay the province
correctly. Projection problem (I will explain it...)
- When you move the map, the images move too. This has an explanaition:
I have the Google Maps' frame, I get the "more centered" image from the
database, and I put it on the map. I consider this image like "well
located". Then, I get the rest of the images that I have to put, and I
put them. If I move the map, maybe the "more centered" image is another.
This problem is due to the projection too.
So, really I only have a problem: the projection. The input data
(MIF/MID files) are obtained from a tool that represents the data in UTM
format, with ED50 datum (and I can't change this). Google Maps uses a
projection based on mercator, and a datum based on WGS84. I spend a lot
of time reading about this, in sites like
So, I thought "I need to reproject the raster". And I did it, using
gdalwarp. This is the order that I used:
-s_srs "+proj=utm +zone=31 +ellps=intl +units=m +no_defs"
-t_srs "+proj=merc +lat_ts=0.0 +lon_0=0.0 +k=1.0 +x_0=0.0 +y_0=0.0
+a=6378137.0 +b=6378137.0 +units=m +nadgrids=@null +no_defs"
<raster file name> <reprojected raster file name>
Then, I did the reprojection, but I still have the problem... better
look, but still remains... Bad overlaid images
I think that the proj.4 parameters are correct. I' ve read that since a
few days ago, there is an official EPSG code for the projection used by
Google Maps, the 3785, but I can't find the parameters :( Yes, there is
a EPSG code to the input projection too, the 23031, and I used it with
the same results... the problem remains
¿What am I doing bad? I need additional data manipulation or something?
Thanks in advance to everybody
More information about the Proj