Here's another link for you: http://econym.org.uk/gmap/customflat.htm
It uses version 2 of the API so not entirely useful to you, but it does show the theory of creating a cartesian projection. Note that a cartesian projection will draw your cartesian coordinates exactly where they should be, using the API's built in Mercator projection could cause problems as it will assume your game's surface is a sphere and make appropriate corrections. Martin. On May 29, 5:48 am, Martin™ <[email protected]> wrote: > Have you seen this page: > > http://code.google.com/apis/maps/documentation/javascript/maptypes.ht... > > You say that you have many (cartesian?) coordinates already - what is > the range of these coordinates? > Could you normalise all your coordinates so X and Y values range from > 0 to 256? > If you could do that then your coordinates would essentially be what > Google call 'World Coordinates'. > With world coordinates you can then use built in API methods to > convert world coordinates to and from both pixel coordinates and > geographical (lat, lng) coordinates. > > Your google.maps.Map object has a getProjection() method: > > http://code.google.com/apis/maps/documentation/javascript/reference.h... > > That returns the map's projection, the projection has two methods: > fromLatLngToPoint() and fromPointToLatLng() that will do these > conversions for you: > > http://code.google.com/apis/maps/documentation/javascript/reference.h... > > If your knowledge of javascript is advanced you might even consider > writing your own 'cartesian projection'. > The cartesian projection would work directly with cartesian (x, y) > coordinates with no need to convert to geographical (lat, lng) > coordinates: > > https://groups.google.com/group/google-maps-js-api-v3/search?hl=en&gr... > > Martin. > > On May 29, 12:26 am, Jason Kaczmarsky <[email protected]> wrote: > > > > > > > > > I think I'm on the right track. In the getTile function it creates all > > the tiles for the map and returns each of them. Obviously each tile is > > placed accordingly on the page. My idea was to fetch this position in > > the getTile function and when I view a tile DIV it does show the > > position on the page. However, the div does not get created in getTile > > so it has no position yet, it returns it to another function so I > > cannot access the position. What does getTile return to? I think if I > > try to access the position from there, I can get it all working. > > > On May 28, 7:00 pm, Jason Kaczmarsky <[email protected]> wrote: > > > > Alright I got something figured out. I found out how to calculate the > > > tile at which a certain point it located based on the zoom level. I > > > still don't understand how I can translate the tile/point position to > > > workable coordinates. > > > > I believe if I can get a particular tile's position relative to the > > > window position, I can then get the difference and draw a marker based > > > on that. > > > > Don't know if it's obvious, but I'm working in JavaScript and I would > > > like to draw a div at each point. If I can get the relative position > > > of a tile to the window, I can absolutely position a div relative to > > > the tile's X/Y values in the window. > > > > On May 28, 6:05 am, John Coryat <[email protected]> wrote: > > > > > You can convert a pixel coordinate into a latitude and longitude fairly > > > > easy. One thing you need to consider. All pixel coordinates are based > > > > on a > > > > particular zoom level. If all your pixel coordinates are assuming one > > > > static > > > > layer, you'll have to figure out what corresponding zoom that > > > > represents and > > > > calculate latitude and longitude based on that. > > > > > Here's a Perl module with the tile math. > > > > >http://www.usnaviguide.com/google-tiles.htm > > > > > Hope that helps. > > > > > -John Coryat > > > > >http://maps.huge.info > > > > >http://www.usnaviguide.com > > > > >http://www.zipmaps.net -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
