Jump to content

General Geo-Coding Question


Recommended Posts

This isn't a php question necessarily but I will be using php so I'll put it here for the lack of anything else.


I've got a google map class that prints javascript that displays a google map. I need to add a ground overlay and pins over relative to the size of the ground overlay (so they will need to be overlays as well). I've written a utility that lets you place that map in javascript and place the pins on the static image separately (the interactive pin-image can exist without the map- the map is an add on). My problem is that I don't know how to convert the pixel position of the pins relative to the image to lat/lng coordinates in php. I think it would probably be easier to consider the x, y coordinates as percentages so you don't need to convert the lat/lng back to pixels and then back again to lat/lng.


I drew and image of what I need. Excuse my lack of basic geography knowledge.




If this isn't the right place to ask this question please move it.

Link to comment
Share on other sites

If you know the position and size of the window in degrees then you can use that to map a point inside it. If the left side of the window starts at 30 degrees, and the top starts at 60 degrees, and the window is 20 degrees long by 15 degrees high, then you can figure out a point inside if you know the percentage. Multiply the percentage by the size of the window and add or subtract from the left or top.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...