I'm trying to display an image (tiles) on top of Google maps. It works fine except the image is not well aligned to Google maps.
Before I generated the image, I first calculated the image size width, height by converting from latitude and longitude to pixel location for certain zoom (example 19) using the SphericalMercator. as shown in Google example https://developers.google.com/maps/documentation/javascript/examples/map-coordinates
For Example:
Left Corner Lat,Lng = 23.635069377090115 ,58.09107364729487
Pixel projection using SphericalMercator for zoom 19 , x= 88766786 , y=58035976
bottom, right Lat,Lng = 23.598520856653636, 58.14957298218598
Pixel projection using SphericalMercator for zoom 19 , x= 88788596 , y=58050848
Once, I got the pixel values for top, left corner and bottom, right comers. I calculated the x delta and y delta which I used as width, height for the generated image
for example:
x2-x1= 21810
y2-y1= 14872
I used a tool to convert an autocad plan to image with the above image width, height.
Than, I cut the image into tiles using imageMagic:
convert -crop 256x256 test4.png tile%d.png
and than I display these tiles.
Tiles displayed but it's not well aligned. Did I missed anything?