Should I create an issue ticket in the official bug tracker? http://code.google.com/p/gmaps-api-issues/
On Mar 10, 6:46 pm, Ben Appleton <[email protected]> wrote: > Thanks, that's very helpful. This certainly looks like an API bug; we'll > look into it. > > > > On Thu, Mar 11, 2010 at 3:34 AM, Brak <[email protected]> wrote: > > I've got my simple example ready and here's what it does. The map > > initializes and sets the default map type to "Tile #s" (CoordMapType) > > which uses the Euclidean projection, specified earlier, yet draws > > using the Mercator projection. When you switch to Satellite or Map > > type, then back to "Tile #s" (CoordMaptType) the projection is drawn > > properly. > > >http://library.ucf.edu/testing/Systems/Library_Maps_Google/Projection... > > > Does this look like a my-code problem or a more general API issue? > > Dun dun dunnnnn! > > > On Mar 10, 8:02 am, Brak <[email protected]> wrote: > > > Thanks Ben. I think I'm starting to think with Portals finally. I > > > reread the whole discussion along with your new post and am now > > > understanding the whole issue along with my options. What would you > > > suggest as a good upscale ratio? Right now, the flat map's coordinates > > > range from -180 west to 180 east and 90 north to -90 south. Maybe > > > scale it up to -10 west to 10 east and 10 north to -10 south? What > > > would make most sense? > > > > Sadly I don't presently have a simplified version available at the > > > moment, but that doesn't mean I can't build one soon. My Maps.js file > > > really only looks enormous because of all the abandoned commented-out > > > code. When developing I usually leave old code in for a while, and > > > delete it when I'm more satisfied with the final product. I'll pull > > > together a simple(r) version with the custom map, the custom > > > projection, some example lines, and a built-in alternate map. > > > > On Mar 10, 2:59 am, Ben Appleton <[email protected]> wrote: > > > > > Wrapping is fundamental to the Maps API, since afterall the world > > wraps. > > > > But you can hide that wrapping by using a small longitudinal range and > > > > zooming in, so that the wrapping is hidden way offscreen to the > > left/right. > > > > > But I see the issue you describe: your custom projection does not seem > > to > > > > take effect until the map type changes away and back again. Do you > > have a > > > > simpler example page that demonstrates this issue? > > > > > On Wed, Mar 10, 2010 at 9:17 AM, Brak <[email protected]> wrote: > > > > > After spending a week and a half scratching my head with various > > > > > examples I scrapped it and found a new one to work from. > > > > > Coincidentally it was written by this board's very own Ben Appleton! > > > > > > It properly maps the original 256x256 starting tile to top letf: > > > > > 90,-180 by bottom right: -90,180 lat/lng coordinates. It also > > provides > > > > > a way to alter the scale if you so desire. Thanks so much Mr. > > > > > Appleton! Code included below. > > > > > > So now I've got a new problem, now that all my coordinates are mapped > > > > > and all is good in the projection world. My map ( > > >http://library.ucf.edu/Administration/Maps/Default_unpublished.asp?de... > > > > > ) initializes with one of my custom map types, which has been setup > > to > > > > > use the custom projection. However, when the map draws for the first > > > > > time it's still using the default mercator projection. Switching from > > > > > and back to one of the custom map types invokes the new Euclidean > > > > > projection, as well as any subsequent time, the way it's supposed to. > > > > > (Maps JS file:http://library.ucf.edu/Web/Js/Maps.js) > > > > > It feels like I need to move some of my code around so the map knows > > > > > to use the new projection instead of the default, but I'm not sure > > > > > which code needs to move. I've tried moving the relevant code, but it > > > > > didn't seem to have any effect. (Relevant code being anything that > > > > > refers to a LatLng() coordinate on the custom maps.) > > > > > > I feel like I'm so close to getting it right. I just need a little > > > > > guidance in the right direction. > > > > > > In a separate issue, I don't really understand how to tell the > > > > > polygons and markers to not wrap, and just stay on the original map > > > > > region. > > > > > > P.S. The computer status polygons on the floormaps have not been > > > > > remapped since the new flat projection was finished. > > > > > > function EuclideanProjection() { > > > > > var EUCLIDEAN_RANGE = 256; > > > > > this.pixelOrigin_ = new google.maps.Point(EUCLIDEAN_RANGE / 2, > > > > > EUCLIDEAN_RANGE / 2); > > > > > this.pixelsPerLonDegree_ = EUCLIDEAN_RANGE / 360; > > > > > this.pixelsPerLonRadian_ = EUCLIDEAN_RANGE / (2 * Math.PI); > > > > > this.scaleLat = 2; // Height - multiplication scale > > factor > > > > > this.scaleLng = 1; // Width - multiplication scale factor > > > > > this.offsetLat = 0; // Height - direct offset +/- > > > > > this.offsetLng = 0; // Width - direct offset +/- > > > > > }; > > > > > > EuclideanProjection.prototype.fromLatLngToPoint = function(latLng, > > > > > opt_point) { > > > > > var point = opt_point || new google.maps.Point(0, 0); > > > > > > var origin = this.pixelOrigin_; > > > > > point.x = (origin.x + (latLng.lng() + this.offsetLng ) * > > > > > this.scaleLng * this.pixelsPerLonDegree_); > > > > > // NOTE(appleton): Truncating to 0.9999 effectively limits > > latitude > > > > > to > > > > > // 89.189. This is about a third of a tile past the edge of > > the > > > > > world tile. > > > > > point.y = (origin.y + (-1 * latLng.lat() + this.offsetLat ) * > > > > > this.scaleLat * this.pixelsPerLonDegree_); > > > > > return point; > > > > > }; > > > > > > EuclideanProjection.prototype.fromPointToLatLng = function(point) { > > > > > var me = this; > > > > > > var origin = me.pixelOrigin_; > > > > > var lng = (((point.x - origin.x) / me.pixelsPerLonDegree_) / > > > > > this.scaleLng) - this.offsetLng; > > > > > var lat = ((-1 *( point.y - origin.y) / > > me.pixelsPerLonDegree_) / > > > > > this.scaleLat) - this.offsetLat; > > > > > return new google.maps.LatLng(lat , lng, true); > > > > > }; > > > > > > // Apply it with this > > > > > myCustomMapType.prototype.projection = new EuclideanProjection(); > > > > > > On Feb 23, 11:58 am, Brak <[email protected]> wrote: > > > > > > 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 > > ... > > read more » -- 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.
