Apologies for the third thread on this topic, but again i need to clear the air and post a fix for the overlay accuracy issue. Paul raised the concern of overlay accuracy in his own script and so it was obvious i should post the solution.
It is a small fix and all that is required is to calculate a ratio of the min/max bounding box coordinates in order to caclulate the height, in pixels, of the image.
For everyone who has their own alternative script working, simply add the following calculation to your variables,
= 800; $ratio1 = ($coords - $coords); $ratio2 = abs($coords - $coords); $ratio = $ratio1 / $ratio2; $height = (int)($width / $ratio); ?>
Then all is needed is to reference these $height and $width vars when calling your WMS request, such as â€¦
 = "Cadastre"; $WMS = "http://your.server.com/servlet/wms?"; ?>
The problem with hardcoding these variables is that on occasion, the proportion of the returned WMS image does not match the proportions of the bounding box coordinates. In this situation google attempts to stretch the image to fit the given coordinates, and of course, distortion occurs â€¦ resulting in overlays which will not fit the base data. This will fix the problem.
Alternatively you can grab the entire example PHP source right here.
Any further questions id be glad to help.