ps:the complete codes in v2 as follow
>> <html> > > <head> > > <meta http-equiv="content-type" content="text/html; charset=utf-8" /> > > <script > > src=" >> http://ditu.google.com/maps?file=api&v=2&key=ABQIAAAAzr2EBOXUKnm_jVnk0OJI7xSosDVG8KKPE1-m51RBrvYughuyMxQ-i1QfUnH94QxWIa6N4U6MouMmBA&hl=zh-CN >> " > > type="text/javascript"></script> > > >> >> <script type="text/javascript"> > > //设置城市中心坐标 > > var centerPoint = new GLatLng(30.752642372196863, 120.75493812561035); > > var normalProj = G_NORMAL_MAP.getProjection(); > > //设置城市的投影偏移 > > var xOffset= -0.002452; > > var yOffset= 0.004244; > > function initialize() { > > if (GBrowserIsCompatible()) { > > var map = new GMap2(document.getElementById("mapDiv")); > > map.setCenter(centerPoint, 15); > > map.enableScrollWheelZoom(); > > map.addControl(new GScaleControl()); > > map.addControl(new GLargeMapControl()); > > map.addControl(new GMapTypeControl()); > > > > //定义特定的投影 > > function dituProjection(xOffset,yOffset){ > > this.xOffset = xOffset; > > this.yOffset = yOffset; > > } > > > > dituProjection.prototype = new GProjection(); > > > > dituProjection.prototype.fromLatLngToPixel = function(latlng, zoom){ > > return (G_NORMAL_MAP.getProjection()).fromLatLngToPixel(new >> GLatLng(latlng.lat()+this.xOffset,latlng.lng()+this.yOffset),zoom); > > }; > > > > dituProjection.prototype.fromPixelToLatLng = function(pixel,zoom,unbounded) > > { > > var latlng = >> (G_NORMAL_MAP.getProjection()).fromPixelToLatLng(pixel,zoom,unbounded); > > return new >> GLatLng(latlng.lat()-this.xOffset,latlng.lng()-this.yOffset); > > } > > > > dituProjection.prototype.tileCheckRange = function(tile, zoom, tilesize) > > { > > return >> (G_NORMAL_MAP.getProjection()).tileCheckRange(tile,zoom,tilesize); > > } > > dituProjection.prototype.getWrapWidth = function(zoom) > > { > > return (G_NORMAL_MAP.getProjection()).getWrapWidth(zoom); > > } > > var newMap = new GMapType(G_NORMAL_MAP.getTileLayers(), new >> dituProjection(xOffset,yOffset), '地图(校正后)'); > > map.addMapType(newMap); > > map.removeMapType(G_HYBRID_MAP); > > map.removeMapType(G_SATELLITE_MAP); > > map.removeMapType(G_NORMAL_MAP); > > //G_SATELLITE_MAP.getName = function(){ return '卫星(无校正)';}; > > //G_NORMAL_MAP.getName = function(){ return '地图(校正前)';}; > > var polyline1_1 = new GPolyline.fromEncoded({ > > color: "#0000ff", > > weight: 4, > > opacity: 0.8, > > points: "yowzdqy}_v?cw...@b@m...@iem?ml@gnkplb?z...@^u?epcn@DBR >> @tjx?rbddda...@w|@w...@ned@ET@|@g...@dvlgfvcjaanll?dmfcvah@SRA^HADBA\\FFMAE@ >> _...@dudidebcqafc@aee...@fm@?...@chldp?g@?blwacihb\...@naakjm@ha...@sagdi >> ^itmr?tirafe\\?laufgvi...@tg@@aobossskeq?w...@wossoiq@AHLb@ >> \\...@jjftanbtlnjfrxf?lclkfadbdalsl]eskm@MC >> @r[qq?gbf?aoseqimaodob...@enizh?wfpb?jhp@g^lhhbhmhtcfddhfb...@i >> ?ajcg?[egca...@cn?tdbhc?@mcesaygy?...@xc@@?cdcj?...@bkdb@a...@bhlgedxelb >> \...@aidk?codye@iahacbi?gqhgnale?pllgncppnf^b...@meiaqce?oe]siaa@?MGg@ >> ?SEUCeAE_@@kfoaebafw?od[?...@^cz@r...@cq@b...@ajdb@@d...@cb@k...@aebcf >> ?klgxb\\?f...@ybkg[@[c]...@seqiaeji@@yd...@fmpejwaidi?mbia{@f...@?_@Ly@ >> @e...@tw@fix...@dq@dsach...@ly@b...@qdif]?klo@h...@jyjk@d...@bw\\bhdhafqls@Ne >> @h...@rg@hkk...@fnv@xl...@jafeja@c]...@{bcoimcqi@ggsa...@iqi?qli@F_@@c...@rk >> @?...@kjg`@?...@b@idej...@bwrcjgbamd@y...@hjb@_...@hq@ge...@ckc?q_@g...@eew[y@bArB >> ~@|BvAzEt@|d...@tgrzgi`hm~cubeef@cbf[qzhkj...@?c@jCYdKYrEk >> @hbgaza_b`akb\\iba{c]...@id[aa?ebq?c@g...@gdabyga@}a?f[ogaj...@ictccds >> @j...@ggb@mblebvibpwaxu...@]d_@oqf[mehohy...@?u@f...@jqgse@CJECHDJ >> @^atsfvcigr...@qm", > > levels: "p??d?b...@a?ba@@E?A??@@?...@ab????caab?ab@?@@B@@@?...@?@?A@ >> @A?@@?C@@C@@?...@bc@ac?a?...@??@@b...@?e?a?b??ba?@?...@?@b...@?b??@e...@??b?c@ >> @@BB@@?...@??@c?b??...@?bab?aba??a@b...@c?@C@@a?a??da??c...@??@@a...@a@A >> ?...@d??b@b?a??ac...@a?bab@g...@??@?...@?a?????d????@?...@c?@c...@?d??@da...@a@?B??D@ >> ?...@?d??@B@@B???@@?...@?@fa?ac??a?a????...@?a??c??c??@a?aeac...@??fa???e@ >> @a...@b@?A?DA@@F@@?...@?c??ab?b@e...@?@a...@i@adab...@?ab@@@AADCAIBDB@ >> @a...@fabb@F@@c...@a@@b...@?fc@a...@e?@c...@d?@ACAA?CAP", > > zoomFactor: 2, > > numLevels: 18 > > }); > > map.addOverlay(polyline1_1); > > } > > } > > </script> > > >> </head> > > <body onload="initialize()"> > > <!-- 地图画板 --> > > <div id="mapDiv" style="width: 700px; height: 500px"></div> > > </body> > > </html> > > > 2010/9/2 YeeFung Man <[email protected]> > hi,everybody! > i have a problerm about use "Projection object specification" in v3. > in v2,i wrote it the codes as follow. > > //------------------------------------------------------------------------------------------------------------------------------------------------------------- > var map = new GMap2(document.getElementById("mapDiv")); > map.setCenter(centerPoint, 15); > > ////the Specified projection > > start-------------------------------------------------------------------------------------------- > function dituProjection(0.002,0.003){ > this.xOffset = 0.002; > this.yOffset = 0.003; > } > dituProjection.prototype = new > GProjection(); > dituProjection.prototype.fromLatLngToPixel = > function(latlng, > zoom){ > return > (G_NORMAL_MAP.getProjection()).fromLatLngToPixel(new > GLatLng(latlng.lat()+0.002,latlng.lng()+0.003),zoom); > }; > dituProjection.prototype.fromPixelToLatLng = > function(pixel,zoom,unbounded) > { > var latlng = > (G_NORMAL_MAP.getProjection()).fromPixelToLatLng(pixel,zoom,unbounded); > return new > GLatLng(latlng.lat()-0.002,latlng.lng()-0.003); > } > dituProjection.prototype.tileCheckRange = > function(tile, zoom, > tilesize) > { > return > (G_NORMAL_MAP.getProjection()).tileCheckRange(tile,zoom,tilesize); > } > dituProjection.prototype.getWrapWidth = > function(zoom) > { > return > (G_NORMAL_MAP.getProjection()).getWrapWidth(zoom); > } > ////the Specified projection > end----------------------------------------------------- > > var newMap = new > GMapType(G_NORMAL_MAP.getTileLayers(), new > dituProjection(0.002,0.003), 'the map is ok'); > > //------------------------------------------------------------------------------------------------------------------------------------------------------------- > > how i write the codes in v3? > how to use the > > "GMapType","GProjection","G_NORMAL_MAP.getProjection()","G_NORMAL_MAP.getTileLayers()" > in v3? > please explained in detail,thank you!! > > -- > 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%[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.
