Create custom overlay image

68 views
Skip to first unread message

francesco mulassano

unread,
Jul 25, 2011, 9:39:35 AM7/25/11
to google-map...@googlegroups.com
Hello,I'm trying to create an overlay on a map. the problem is that I do not know how to create the image.

I tried to make a screenshot of the area that interests me, I changed with photoshop and then I tried to place it.

the problem is that I do not know the exact coordinates of which attach the overlay ...

what method you use to do this?

tnx

John Coryat

unread,
Jul 25, 2011, 1:55:50 PM7/25/11
to google-map...@googlegroups.com
In order to correctly place an overlay on the map you need to know three things:

1. Upper left corner coordinate 
2. Lower right coordinate
3. Projection of the image.

Projection is less important if the area is small, like in less than 200 miles on a side. If it's greater than that, then you'll need to take into account how the original image was made. If it's a satellite image, the slant angle is very important as high slant angles will skew the image quite a bit.

The projection that Google uses is called "World Mercator" which uses parallel latitude and longitude lines. As the latitude increases, the "stretching" of longitude increases to the point where it's impossible to depict the world in this projection (about 85 degrees north or south).

You can locate your corners by overlaying your image on the map and moving it around until you get a match on Google's map. That's not a trivial thing to do but if you don't know the coordinates of the corners, that's about the best method.

-John Coryat 

Christopher Watson

unread,
Jul 25, 2011, 5:46:56 PM7/25/11
to google-map...@googlegroups.com
yeah its tedious trying to align using corner co-ordinates. 

there ought to be a way to drag an overlay on to a map and then just resize and move it until it fits perfectly and then it tell you the lat lng of the top left bottom right. ideally.

also annoying, not knowing if the lat lng numbers increase or decrease when its resizing left / right or up / down of the overlay.

so i made a quick glance guide (attached) so i know. might help.

oh, you may know but use colour mode rgb not cmyk because some browsers dont display the overlay when cmyk.
gmaps lat lng guide.jpg

John Coryat

unread,
Jul 25, 2011, 6:22:16 PM7/25/11
to google-map...@googlegroups.com
There was an example like you describe in the v2 examples. Don't know the exact link but you could probably still find it.

-John Coryat

Rossko

unread,
Jul 25, 2011, 6:26:54 PM7/25/11
to Google Maps JavaScript API v3
> there ought to be a way to drag an overlay on to a map and then just resize
> and move it until it fits perfectly and then it tell you the lat lng of the
> top left bottom right. ideally.

Bit like this?
http://maps.huge.info/goverlay.htm

John Coryat

unread,
Jul 25, 2011, 6:44:31 PM7/25/11
to google-map...@googlegroups.com
There was one that Pamela made that allowed entering a URL of an image and maybe the starting coordinates. It was one of the regular examples. My one has some sort of issue. I think the server it's on no longer has the image it's trying to display so it doesn't work right. The code is good though, so that one could be the base for a new version. Someone should update it to v3 though.

-John Coryat

Christopher Watson

unread,
Jul 25, 2011, 8:50:07 PM7/25/11
to google-map...@googlegroups.com
yeah like that rossko, 

doesn't it allow you to upload an image? or can the code be taken off and hosted at your own server to choose your own image and just do the resizing?

is yours similar john? do you have link, just can host ourselves and choose a new image, i'll leave it up on my site if it lets people customise with their own image online?

Grok Lobster

unread,
Jul 25, 2011, 10:07:05 PM7/25/11
to Google Maps JavaScript API v3

John Coryat

unread,
Jul 26, 2011, 12:03:54 AM7/26/11
to google-map...@googlegroups.com
Christopher,

The link Rossko posted was to my demo. I suggest using Pamela's one instead, although if you feel like my one has any merit, please feel free to use that as well.

-John Coryat

Christopher Watson

unread,
Jul 26, 2011, 8:01:10 AM7/26/11
to google-map...@googlegroups.com
ah... didnt realise.

pams is good. lets me choose the path to an image. prob use this to get the SW NE lat lngs.

still either is going to save me a lot of time and guess work.

thanks
Reply all
Reply to author
Forward
0 new messages