Several map providers have functions to pan to a location, as opposed to the direct setCenter call. Panning animates the move from one point to another. To implement this in mapstraction, I created a panCenter function. I don''t know how to go about committing the change to svn, or who decides whether my naming convention is worthy, but I thought I''d share the function below. --Adam --- Adam DuVander I like simple: http://adamduvander.com /** * panCenter pans to a new central point of the map * @param {LatLonPoint} point The point at which to center the map */ Mapstraction.prototype.panCenter = function(point) { if(this.loaded[this.api] === false) { var me = this; this.onload[this.api].push( function() { me.panCenter(point); } ); return; } var map = this.maps[this.api]; switch (this.api) { case ''google'': case ''openstreetmap'': map.panTo(point.toGoogle()); break; case ''microsoft'': map.PanToLatLong(point.toMicrosoft()); break; case ''yahoo'': case ''openlayers'': case ''openspace'' : case ''multimap'': case ''mapquest'': case ''freeearth'': case ''map24'': case ''viamichelin'': this.setCenter(point); break; default: if(this.debug) { alert(this.api + '' not supported by Mapstraction.panCenter''); } } };
Nice! Panning is indeed a useful function. Regarding naming, is this perhaps better as a flag/option on setCenter? It''s the same effect, with just a difference on how that''s achieved. Andrew On Jan 20, 2009, at 10:16 PM, Adam DuVander wrote:> Several map providers have functions to pan to a location, as > opposed to the direct setCenter call. Panning animates the move from > one point to another. To implement this in mapstraction, I created a > panCenter function. > > I don''t know how to go about committing the change to svn, or who > decides whether my naming convention is worthy, but I thought I''d > share the function below. > > --Adam > --- > Adam DuVander > I like simple: http://adamduvander.com > > /** > * panCenter pans to a new central point of the map > * @param {LatLonPoint} point The point at which to center the map > */ > Mapstraction.prototype.panCenter = function(point) { > if(this.loaded[this.api] === false) { > var me = this; > this.onload[this.api].push( function() { > me.panCenter(point); > } ); > return; > } > > var map = this.maps[this.api]; > > switch (this.api) { > case ''google'': > case ''openstreetmap'': > map.panTo(point.toGoogle()); > break; > case ''microsoft'': > map.PanToLatLong(point.toMicrosoft()); > break; > case ''yahoo'': > case ''openlayers'': > case ''openspace'' : > case ''multimap'': > case ''mapquest'': > case ''freeearth'': > case ''map24'': > case ''viamichelin'': > this.setCenter(point); > break; > default: > if(this.debug) { > alert(this.api + '' not supported by > Mapstraction.panCenter''); > } > } > }; > > _______________________________________________ > Mapstraction mailing list > Mapstraction at lists.mapstraction.com > http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com-- Andrew Turner mobile: 248.982.3609 email: andrew at highearthorbit.com blog: http://highearthorbit.com -- Helping build the Geospatial Web -- http://geocommons.com --- http://mapufacture.com Introduction to Neogeography - http://oreilly.com/catalog/neogeography
Much cleaner as an option to setCenter. I''ve taken your advice. My new setCenter code is included below. --Ad --- Adam DuVander I like simple: http://adamduvander.com /** * setCenter sets the central point of the map * @param {LatLonPoint} point The point at which to center the map * @param {animate} (optional) set true to include pan animation to LatLonPoint */ Mapstraction.prototype.setCenter = function(point, animate) { if(this.loaded[this.api] === false) { var me = this; this.onload[this.api].push( function() { me.setCenter(point); } ); return; } if (animate === undefined) { animate = false; } var map = this.maps[this.api]; switch (this.api) { case ''openspace'' : map.setCenter(point.toOpenSpace()); break; case ''yahoo'': map.panToLatLon(point.toYahoo()); break; case ''google'': case ''openstreetmap'': if (animate) { map.panTo(point.toGoogle()); } else { map.setCenter(point.toGoogle()); } break; case ''openlayers'': map.setCenter(point.toOpenLayers()); break; case ''microsoft'': if (animate) { map.PanToLatLong(point.toMicrosoft()); } else { map.SetCenter(point.toMicrosoft()); } break; case ''multimap'': map.goToPosition(point.toMultiMap()); break; case ''mapquest'': map.setCenter(point.toMapQuest()); break; case ''freeearth'': if (this.freeEarthLoaded) { map.setTargetLatLng( point.toFreeEarth() ); } else { var me = this; this.freeEarthOnLoad.push( function(){ me.setCenterAndZoom(point); } ); } break; case ''map24'': // Since center changes the zoom level to default // we have to get the original metre width and pass it back in when // centering. var mv = map.MapClient[''Static''].getCurrentMapView(); var newSettings = {}; newSettings.MinimumWidth = lonToMetres (mv.LowerRight.Longitude - mv.TopLeft.Longitude, (mv.LowerRight.Latitude+mv.TopLeft.Latitude)/2); newSettings.Latitude = point.lat*60; newSettings.Longitude = point.lon*60; Map24.MapApplication.center(newSettings); break; case ''viamichelin'': map.panTo(point.toViaMichelin()); break; default: if(this.debug) { alert(this.api + '' not supported by Mapstraction.setCenter''); } } };
I''ve already pushed into SVN and updated. I didn''t call it "animated" but just using an options hash and {pan:true} would turn on panning. I hesitate using "animate" as the term itself since I think that may imply more than actually occurs (why aren''t my markers dancing and glowing?) :) While I''m thinking about it. Is it worth setting up a Wordpress install on Mapstraction.com for news and such? It would be great to start announcing new features, examples, users, tutorials, etc. On Wed, Jan 21, 2009 at 2:18 PM, Adam DuVander <mapstraction at duvander.com> wrote:> Much cleaner as an option to setCenter. I''ve taken your advice. My new > setCenter code is included below. > > --Ad > --- > Adam DuVander > I like simple: http://adamduvander.com > > /** > * setCenter sets the central point of the map > * @param {LatLonPoint} point The point at which to center the map > * @param {animate} (optional) set true to include pan animation to > LatLonPoint > */ > Mapstraction.prototype.setCenter = function(point, animate) { > if(this.loaded[this.api] === false) { > var me = this; > this.onload[this.api].push( function() { > me.setCenter(point); > } ); > return; > } > > if (animate === undefined) { > animate = false; > } > > var map = this.maps[this.api]; > > switch (this.api) { > case ''openspace'' : > map.setCenter(point.toOpenSpace()); > break; > case ''yahoo'': > map.panToLatLon(point.toYahoo()); > break; > case ''google'': > case ''openstreetmap'': > if (animate) { > map.panTo(point.toGoogle()); > } > else { > map.setCenter(point.toGoogle()); > } > break; > case ''openlayers'': > map.setCenter(point.toOpenLayers()); > break; > case ''microsoft'': > if (animate) { > map.PanToLatLong(point.toMicrosoft()); > } > else { > map.SetCenter(point.toMicrosoft()); > } > break; > case ''multimap'': > map.goToPosition(point.toMultiMap()); > break; > case ''mapquest'': > map.setCenter(point.toMapQuest()); > break; > case ''freeearth'': > if (this.freeEarthLoaded) { > map.setTargetLatLng( point.toFreeEarth() ); > } > else { > var me = this; > this.freeEarthOnLoad.push( function(){ > me.setCenterAndZoom(point); > } ); > } > break; > case ''map24'': > // Since center changes the zoom level to default > // we have to get the original metre width and pass it back in > when > // centering. > var mv = map.MapClient[''Static''].getCurrentMapView(); > var newSettings = {}; > newSettings.MinimumWidth = lonToMetres > (mv.LowerRight.Longitude - mv.TopLeft.Longitude, > (mv.LowerRight.Latitude+mv.TopLeft.Latitude)/2); > newSettings.Latitude = point.lat*60; > newSettings.Longitude = point.lon*60; > Map24.MapApplication.center(newSettings); > break; > case ''viamichelin'': > map.panTo(point.toViaMichelin()); > break; > default: > if(this.debug) { > alert(this.api + '' not supported by Mapstraction.setCenter''); > } > } > }; > >-- Andrew Turner mobile: 248.982.3609 andrew at fortiusone.com http://highearthorbit.com http://geocommons.com Helping build the Geospatial Web Introduction to Neogeography - http://oreilly.com/catalog/neogeography
Again, your solution is better. :) I also don''t like animate, but I got it from The Goog: http://code.google.com/apis/maps/documentation/examples/map-animate.html In the community work I do, a blog is always a good idea. The questions that rarely gets asked, but probably should: who is going to post, how often and what will they write? --Ad --- Adam DuVander I like simple: http://adamduvander.com On Jan 21, 2009, at 11:27 AM, Andrew Turner wrote:> I''ve already pushed into SVN and updated. I didn''t call it "animated" > but just using an options hash and {pan:true} would turn on panning. I > hesitate using "animate" as the term itself since I think that may > imply more than actually occurs (why aren''t my markers dancing and > glowing?) :) > > While I''m thinking about it. Is it worth setting up a Wordpress > install on Mapstraction.com for news and such? It would be great to > start announcing new features, examples, users, tutorials, etc. > > > > On Wed, Jan 21, 2009 at 2:18 PM, Adam DuVander > <mapstraction at duvander.com> wrote: >> Much cleaner as an option to setCenter. I''ve taken your advice. My >> new >> setCenter code is included below. >> >> --Ad >> --- >> Adam DuVander >> I like simple: http://adamduvander.com >> >> /** >> * setCenter sets the central point of the map >> * @param {LatLonPoint} point The point at which to center the map >> * @param {animate} (optional) set true to include pan animation to >> LatLonPoint >> */ >> Mapstraction.prototype.setCenter = function(point, animate) { >> if(this.loaded[this.api] === false) { >> var me = this; >> this.onload[this.api].push( function() { >> me.setCenter(point); >> } ); >> return; >> } >> >> if (animate === undefined) { >> animate = false; >> } >> >> var map = this.maps[this.api]; >> >> switch (this.api) { >> case ''openspace'' : >> map.setCenter(point.toOpenSpace()); >> break; >> case ''yahoo'': >> map.panToLatLon(point.toYahoo()); >> break; >> case ''google'': >> case ''openstreetmap'': >> if (animate) { >> map.panTo(point.toGoogle()); >> } >> else { >> map.setCenter(point.toGoogle()); >> } >> break; >> case ''openlayers'': >> map.setCenter(point.toOpenLayers()); >> break; >> case ''microsoft'': >> if (animate) { >> map.PanToLatLong(point.toMicrosoft()); >> } >> else { >> map.SetCenter(point.toMicrosoft()); >> } >> break; >> case ''multimap'': >> map.goToPosition(point.toMultiMap()); >> break; >> case ''mapquest'': >> map.setCenter(point.toMapQuest()); >> break; >> case ''freeearth'': >> if (this.freeEarthLoaded) { >> map.setTargetLatLng( point.toFreeEarth() ); >> } >> else { >> var me = this; >> this.freeEarthOnLoad.push( function(){ >> me.setCenterAndZoom(point); >> } ); >> } >> break; >> case ''map24'': >> // Since center changes the zoom level to default >> // we have to get the original metre width and pass it >> back in >> when >> // centering. >> var mv = map.MapClient[''Static''].getCurrentMapView(); >> var newSettings = {}; >> newSettings.MinimumWidth = lonToMetres >> (mv.LowerRight.Longitude - mv.TopLeft.Longitude, >> (mv.LowerRight.Latitude+mv.TopLeft.Latitude)/2); >> newSettings.Latitude = point.lat*60; >> newSettings.Longitude = point.lon*60; >> Map24.MapApplication.center(newSettings); >> break; >> case ''viamichelin'': >> map.panTo(point.toViaMichelin()); >> break; >> default: >> if(this.debug) { >> alert(this.api + '' not supported by >> Mapstraction.setCenter''); >> } >> } >> }; >> >> > > > > -- > Andrew Turner > mobile: 248.982.3609 > andrew at fortiusone.com > http://highearthorbit.com > > http://geocommons.com Helping build the Geospatial Web > Introduction to Neogeography - http://oreilly.com/catalog/neogeography
On Wed, Jan 21, 2009 at 2:46 PM, Adam DuVander <mapstraction at duvander.com> wrote:> Again, your solution is better. :) I also don''t like animate, but I got it > from The Goog: > http://code.google.com/apis/maps/documentation/examples/map-animate.htmlCompletely appreciate the patch - love new features.> > In the community work I do, a blog is always a good idea. The questions that > rarely gets asked, but probably should: who is going to post, how often and > what will they write?Posting by anyone that has submitted an accepted patch, or other qualified fans/users. It wouldn''t have to be continuously updated so much as a way to easily document resources/news.> > --Ad > --- > Adam DuVander > I like simple: http://adamduvander.com > > > On Jan 21, 2009, at 11:27 AM, Andrew Turner wrote: > >> I''ve already pushed into SVN and updated. I didn''t call it "animated" >> but just using an options hash and {pan:true} would turn on panning. I >> hesitate using "animate" as the term itself since I think that may >> imply more than actually occurs (why aren''t my markers dancing and >> glowing?) :) >> >> While I''m thinking about it. Is it worth setting up a Wordpress >> install on Mapstraction.com for news and such? It would be great to >> start announcing new features, examples, users, tutorials, etc. >> >> >> >> On Wed, Jan 21, 2009 at 2:18 PM, Adam DuVander >> <mapstraction at duvander.com> wrote: >>> >>> Much cleaner as an option to setCenter. I''ve taken your advice. My new >>> setCenter code is included below. >>> >>> --Ad >>> --- >>> Adam DuVander >>> I like simple: http://adamduvander.com >>> >>> /** >>> * setCenter sets the central point of the map >>> * @param {LatLonPoint} point The point at which to center the map >>> * @param {animate} (optional) set true to include pan animation to >>> LatLonPoint >>> */ >>> Mapstraction.prototype.setCenter = function(point, animate) { >>> if(this.loaded[this.api] === false) { >>> var me = this; >>> this.onload[this.api].push( function() { >>> me.setCenter(point); >>> } ); >>> return; >>> } >>> >>> if (animate === undefined) { >>> animate = false; >>> } >>> >>> var map = this.maps[this.api]; >>> >>> switch (this.api) { >>> case ''openspace'' : >>> map.setCenter(point.toOpenSpace()); >>> break; >>> case ''yahoo'': >>> map.panToLatLon(point.toYahoo()); >>> break; >>> case ''google'': >>> case ''openstreetmap'': >>> if (animate) { >>> map.panTo(point.toGoogle()); >>> } >>> else { >>> map.setCenter(point.toGoogle()); >>> } >>> break; >>> case ''openlayers'': >>> map.setCenter(point.toOpenLayers()); >>> break; >>> case ''microsoft'': >>> if (animate) { >>> map.PanToLatLong(point.toMicrosoft()); >>> } >>> else { >>> map.SetCenter(point.toMicrosoft()); >>> } >>> break; >>> case ''multimap'': >>> map.goToPosition(point.toMultiMap()); >>> break; >>> case ''mapquest'': >>> map.setCenter(point.toMapQuest()); >>> break; >>> case ''freeearth'': >>> if (this.freeEarthLoaded) { >>> map.setTargetLatLng( point.toFreeEarth() ); >>> } >>> else { >>> var me = this; >>> this.freeEarthOnLoad.push( function(){ >>> me.setCenterAndZoom(point); >>> } ); >>> } >>> break; >>> case ''map24'': >>> // Since center changes the zoom level to default >>> // we have to get the original metre width and pass it back in >>> when >>> // centering. >>> var mv = map.MapClient[''Static''].getCurrentMapView(); >>> var newSettings = {}; >>> newSettings.MinimumWidth = lonToMetres >>> (mv.LowerRight.Longitude - mv.TopLeft.Longitude, >>> (mv.LowerRight.Latitude+mv.TopLeft.Latitude)/2); >>> newSettings.Latitude = point.lat*60; >>> newSettings.Longitude = point.lon*60; >>> Map24.MapApplication.center(newSettings); >>> break; >>> case ''viamichelin'': >>> map.panTo(point.toViaMichelin()); >>> break; >>> default: >>> if(this.debug) { >>> alert(this.api + '' not supported by >>> Mapstraction.setCenter''); >>> } >>> } >>> }; >>> >>> >> >> >> >> -- >> Andrew Turner >> mobile: 248.982.3609 >> andrew at fortiusone.com >> http://highearthorbit.com >> >> http://geocommons.com Helping build the Geospatial Web >> Introduction to Neogeography - http://oreilly.com/catalog/neogeography > >-- Andrew Turner mobile: 248.982.3609 andrew at fortiusone.com http://highearthorbit.com http://geocommons.com Helping build the Geospatial Web Introduction to Neogeography - http://oreilly.com/catalog/neogeography
A mapstraction blog is a really good idea - I think folks would much rather subscribe to an RSS feed than sign their e-mail address up to a mailing list. As an aside I think we could do with a page on the Wiki or somewhere for collating what the state of play is with V2. Derek On Wed, Jan 21, 2009 at 7:50 PM, Andrew Turner <andrew at highearthorbit.com>wrote:> On Wed, Jan 21, 2009 at 2:46 PM, Adam DuVander > <mapstraction at duvander.com> wrote: > > Again, your solution is better. :) I also don''t like animate, but I got > it > > from The Goog: > > http://code.google.com/apis/maps/documentation/examples/map-animate.html > > Completely appreciate the patch - love new features. > > > > > In the community work I do, a blog is always a good idea. The questions > that > > rarely gets asked, but probably should: who is going to post, how often > and > > what will they write? > > Posting by anyone that has submitted an accepted patch, or other > qualified fans/users. It wouldn''t have to be continuously updated so > much as a way to easily document resources/news. > > > > > --Ad > > --- > > Adam DuVander > > I like simple: http://adamduvander.com > > > > > > On Jan 21, 2009, at 11:27 AM, Andrew Turner wrote: > > > >> I''ve already pushed into SVN and updated. I didn''t call it "animated" > >> but just using an options hash and {pan:true} would turn on panning. I > >> hesitate using "animate" as the term itself since I think that may > >> imply more than actually occurs (why aren''t my markers dancing and > >> glowing?) :) > >> > >> While I''m thinking about it. Is it worth setting up a Wordpress > >> install on Mapstraction.com for news and such? It would be great to > >> start announcing new features, examples, users, tutorials, etc. > >> > >> > >> > >> On Wed, Jan 21, 2009 at 2:18 PM, Adam DuVander > >> <mapstraction at duvander.com> wrote: > >>> > >>> Much cleaner as an option to setCenter. I''ve taken your advice. My new > >>> setCenter code is included below. > >>> > >>> --Ad > >>> --- > >>> Adam DuVander > >>> I like simple: http://adamduvander.com > >>> > >>> /** > >>> * setCenter sets the central point of the map > >>> * @param {LatLonPoint} point The point at which to center the map > >>> * @param {animate} (optional) set true to include pan animation to > >>> LatLonPoint > >>> */ > >>> Mapstraction.prototype.setCenter = function(point, animate) { > >>> if(this.loaded[this.api] === false) { > >>> var me = this; > >>> this.onload[this.api].push( function() { > >>> me.setCenter(point); > >>> } ); > >>> return; > >>> } > >>> > >>> if (animate === undefined) { > >>> animate = false; > >>> } > >>> > >>> var map = this.maps[this.api]; > >>> > >>> switch (this.api) { > >>> case ''openspace'' : > >>> map.setCenter(point.toOpenSpace()); > >>> break; > >>> case ''yahoo'': > >>> map.panToLatLon(point.toYahoo()); > >>> break; > >>> case ''google'': > >>> case ''openstreetmap'': > >>> if (animate) { > >>> map.panTo(point.toGoogle()); > >>> } > >>> else { > >>> map.setCenter(point.toGoogle()); > >>> } > >>> break; > >>> case ''openlayers'': > >>> map.setCenter(point.toOpenLayers()); > >>> break; > >>> case ''microsoft'': > >>> if (animate) { > >>> map.PanToLatLong(point.toMicrosoft()); > >>> } > >>> else { > >>> map.SetCenter(point.toMicrosoft()); > >>> } > >>> break; > >>> case ''multimap'': > >>> map.goToPosition(point.toMultiMap()); > >>> break; > >>> case ''mapquest'': > >>> map.setCenter(point.toMapQuest()); > >>> break; > >>> case ''freeearth'': > >>> if (this.freeEarthLoaded) { > >>> map.setTargetLatLng( point.toFreeEarth() ); > >>> } > >>> else { > >>> var me = this; > >>> this.freeEarthOnLoad.push( function(){ > >>> me.setCenterAndZoom(point); > >>> } ); > >>> } > >>> break; > >>> case ''map24'': > >>> // Since center changes the zoom level to default > >>> // we have to get the original metre width and pass it back in > >>> when > >>> // centering. > >>> var mv = map.MapClient[''Static''].getCurrentMapView(); > >>> var newSettings = {}; > >>> newSettings.MinimumWidth = lonToMetres > >>> (mv.LowerRight.Longitude - mv.TopLeft.Longitude, > >>> (mv.LowerRight.Latitude+mv.TopLeft.Latitude)/2); > >>> newSettings.Latitude = point.lat*60; > >>> newSettings.Longitude = point.lon*60; > >>> Map24.MapApplication.center(newSettings); > >>> break; > >>> case ''viamichelin'': > >>> map.panTo(point.toViaMichelin()); > >>> break; > >>> default: > >>> if(this.debug) { > >>> alert(this.api + '' not supported by > >>> Mapstraction.setCenter''); > >>> } > >>> } > >>> }; > >>> > >>> > >> > >> > >> > >> -- > >> Andrew Turner > >> mobile: 248.982.3609 > >> andrew at fortiusone.com > >> http://highearthorbit.com > >> > >> http://geocommons.com Helping build the Geospatial Web > >> Introduction to Neogeography - http://oreilly.com/catalog/neogeography > > > > > > > > -- > Andrew Turner > mobile: 248.982.3609 > andrew at fortiusone.com > http://highearthorbit.com > > http://geocommons.com Helping build the Geospatial Web > Introduction to Neogeography - http://oreilly.com/catalog/neogeography > _______________________________________________ > Mapstraction mailing list > Mapstraction at lists.mapstraction.com > http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com >-- Derek Fowler m. 07966 512 369 e. dezfowler at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20090124/4bc6e302/attachment.htm>
Blog Setup. I added Derek, Adam, and Rob for now. Let me know if someone else would like access. A couple of things we need to do: - bring in styling from Mapstraction page to a theme. - Any plugins? let me konw - An initial post about the news - bring in RSS as a sidebar on the front page Besides announcements & links - I''d like to try and use the blog as a way to get discussion going around features, etc. Maybe even a Page (instead of in Trac) about v2, with comments enabled? On Jan 24, 2009, at 6:50 AM, Derek Fowler wrote:> A mapstraction blog is a really good idea - I think folks would much > rather subscribe to an RSS feed than sign their e-mail address up to > a mailing list. > > As an aside I think we could do with a page on the Wiki or somewhere > for collating what the state of play is with V2. > > Derek > > On Wed, Jan 21, 2009 at 7:50 PM, Andrew Turner <andrew at highearthorbit.com > > wrote: > On Wed, Jan 21, 2009 at 2:46 PM, Adam DuVander > <mapstraction at duvander.com> wrote: > > Again, your solution is better. :) I also don''t like animate, but > I got it > > from The Goog: > > http://code.google.com/apis/maps/documentation/examples/map-animate.html > > Completely appreciate the patch - love new features. > > > > > In the community work I do, a blog is always a good idea. The > questions that > > rarely gets asked, but probably should: who is going to post, how > often and > > what will they write? > > Posting by anyone that has submitted an accepted patch, or other > qualified fans/users. It wouldn''t have to be continuously updated so > much as a way to easily document resources/news. > > > > > --Ad > > --- > > Adam DuVander > > I like simple: http://adamduvander.com > > > > > > On Jan 21, 2009, at 11:27 AM, Andrew Turner wrote: > > > >> I''ve already pushed into SVN and updated. I didn''t call it > "animated" > >> but just using an options hash and {pan:true} would turn on > panning. I > >> hesitate using "animate" as the term itself since I think that may > >> imply more than actually occurs (why aren''t my markers dancing and > >> glowing?) :) > >> > >> While I''m thinking about it. Is it worth setting up a Wordpress > >> install on Mapstraction.com for news and such? It would be great to > >> start announcing new features, examples, users, tutorials, etc. > >> > >> > >> > >> On Wed, Jan 21, 2009 at 2:18 PM, Adam DuVander > >> <mapstraction at duvander.com> wrote: > >>> > >>> Much cleaner as an option to setCenter. I''ve taken your advice. > My new > >>> setCenter code is included below. > >>> > >>> --Ad > >>> --- > >>> Adam DuVander > >>> I like simple: http://adamduvander.com > >>> > >>> /** > >>> * setCenter sets the central point of the map > >>> * @param {LatLonPoint} point The point at which to center the map > >>> * @param {animate} (optional) set true to include pan animation to > >>> LatLonPoint > >>> */ > >>> Mapstraction.prototype.setCenter = function(point, animate) { > >>> if(this.loaded[this.api] === false) { > >>> var me = this; > >>> this.onload[this.api].push( function() { > >>> me.setCenter(point); > >>> } ); > >>> return; > >>> } > >>> > >>> if (animate === undefined) { > >>> animate = false; > >>> } > >>> > >>> var map = this.maps[this.api]; > >>> > >>> switch (this.api) { > >>> case ''openspace'' : > >>> map.setCenter(point.toOpenSpace()); > >>> break; > >>> case ''yahoo'': > >>> map.panToLatLon(point.toYahoo()); > >>> break; > >>> case ''google'': > >>> case ''openstreetmap'': > >>> if (animate) { > >>> map.panTo(point.toGoogle()); > >>> } > >>> else { > >>> map.setCenter(point.toGoogle()); > >>> } > >>> break; > >>> case ''openlayers'': > >>> map.setCenter(point.toOpenLayers()); > >>> break; > >>> case ''microsoft'': > >>> if (animate) { > >>> map.PanToLatLong(point.toMicrosoft()); > >>> } > >>> else { > >>> map.SetCenter(point.toMicrosoft()); > >>> } > >>> break; > >>> case ''multimap'': > >>> map.goToPosition(point.toMultiMap()); > >>> break; > >>> case ''mapquest'': > >>> map.setCenter(point.toMapQuest()); > >>> break; > >>> case ''freeearth'': > >>> if (this.freeEarthLoaded) { > >>> map.setTargetLatLng( point.toFreeEarth() ); > >>> } > >>> else { > >>> var me = this; > >>> this.freeEarthOnLoad.push( function(){ > >>> me.setCenterAndZoom(point); > >>> } ); > >>> } > >>> break; > >>> case ''map24'': > >>> // Since center changes the zoom level to default > >>> // we have to get the original metre width and pass it > back in > >>> when > >>> // centering. > >>> var mv = map.MapClient[''Static''].getCurrentMapView(); > >>> var newSettings = {}; > >>> newSettings.MinimumWidth = lonToMetres > >>> (mv.LowerRight.Longitude - mv.TopLeft.Longitude, > >>> (mv.LowerRight.Latitude+mv.TopLeft.Latitude)/2); > >>> newSettings.Latitude = point.lat*60; > >>> newSettings.Longitude = point.lon*60; > >>> Map24.MapApplication.center(newSettings); > >>> break; > >>> case ''viamichelin'': > >>> map.panTo(point.toViaMichelin()); > >>> break; > >>> default: > >>> if(this.debug) { > >>> alert(this.api + '' not supported by > >>> Mapstraction.setCenter''); > >>> } > >>> } > >>> }; > >>> > >>> > >> > >> > >> > >> -- > >> Andrew Turner > >> mobile: 248.982.3609 > >> andrew at fortiusone.com > >> http://highearthorbit.com > >> > >> http://geocommons.com Helping build the Geospatial Web > >> Introduction to Neogeography - http://oreilly.com/catalog/neogeography > > > > > > > > -- > Andrew Turner > mobile: 248.982.3609 > andrew at fortiusone.com > http://highearthorbit.com > > http://geocommons.com Helping build the Geospatial Web > Introduction to Neogeography - http://oreilly.com/catalog/neogeography > _______________________________________________ > Mapstraction mailing list > Mapstraction at lists.mapstraction.com > http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com > > > > -- > Derek Fowler > m. 07966 512 369 > e. dezfowler at gmail.com-- Andrew Turner mobile: 248.982.3609 email: andrew at highearthorbit.com blog: http://highearthorbit.com -- Helping build the Geospatial Web -- http://geocommons.com --- http://mapufacture.com Introduction to Neogeography - http://oreilly.com/catalog/neogeography -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20090124/fad1e6f4/attachment-0001.htm>