I too am interested in this functionality for my custom maps. I would
love to build a custom projection for my custom maps that is just 1:1,
but I could live with the LatLng system. My only problem with that
system is that, using the mercator projection, the world wraps and I
need to find a way for my polygons, polylines, markers and infoboxes
to not appear in empty space when zoomed out. I'm assuming that a 1:1
could be a solution to this, but all I can do is guess at this point.

I tried fiddling with your example code using it as a basis and I
couldn't get it into a state that Google Maps could make any sense of.
Without any documentation on how the projections are supposed to be
formulated I'm sort of at a loss.

Alternatively, can you think of any way to simply disable tiling and
subsequently drawing the overlays outside of the "home tile" (tile 0,0
at zoom level 0)?. I also have a "Center Map" Control button that is
supposed to center the map, but it's expecting a wrapping world too
and will center on a non-existent adjacent tile if the map is scooted
too far left or right.

evilC: Did you ever get your projection to work? How is your map
system coming along?

On Jan 25, 6:08 pm, Ben Appleton <[email protected]> wrote:
> On Tue, Jan 26, 2010 at 9:15 AM, evilC <[email protected]> wrote:
> > I have a reasonable amount of experience with the Google Maps API, but
> > none so far with custom map types and I have been asked to help to
> > make a map of an online game world (http://navemap.com).
>
> > Now from my research, it seems that the smart move would be to
> > properly integrate the game's coordinate system into the map so that
> > things are all accurate. AFAIK, the game world is in effect flat. I am
> > not yet sure on wrapping, there may be e/w wrapping (So it may in
> > effect be a cylinder). I think the origin is in the centre of the map,
> > with negative values for west and north of the origin.
>
> OK.  The Maps API uses latitude/longitude coordinates, which are
> cylindrical.  That is, there is e/w wrapping but no n/s wrapping.  If your
> game coordinates do not wrap e/w, then you can either:
> 1 - Avoid the +/- 180 longitude line by placing your game map from -90 to
> +90 longitude.  No-one is likely to pan so far offscreen that they notice
> the world wraps.
> 2 - Or, listen for Map event "center_changed" and if the map pans outside
> -90 to +90 longitude just setCenter() to the nearest point back inside these
> bounds.
>
> So from reading the API documentation, it seems to me that I do not
>
> > want to use a projection? Or if the map insists on one, a plain 1:1
> > conversion from world coordinates to map coordinates?
>
> Yes, a plain 1:1 conversion would do.  So I suggest using
> ImageMapType<http://code.google.com/apis/maps/documentation/v3/reference.html#Imag...>
> to
> download your map tiles, and attach a .projection object like:
>
> var myMapType = new ImageMapType(...);
>
> var myProjection = {};
> myProjection.fromLatLngToPoint = function(latLng) {
>   return new Point(latLng.lng(), latLng.lat());};
>
> myProjection.fromPointToLatLng = function(point) {
>   return new LatLng(point.y, point.x);
>
> };
>
> // Set the projection for custom map type:
> myMapType.projection = new MyProjection;
>
> Now this is a bit oversimplified: you'll have to tweak the projection so
> that eg. markers are placed in the right positions on your tiles, otherwise
> all your overlays will be misaligned.
>
>
>
> > Either that, or will it work properly if I just map game world
> > coordinates to lat and lng? I am worried about the effects of the
> > mercator projection on a world which is not spherical.
>
> > Please advise.
>
> > --
> > 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]<google-maps-js-api-v3%2b­[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-maps-js-api-v3?hl=en.

-- 
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.

Reply via email to