Ever wanted to be someone else? No, we're not offering a Being John Malkovich service, but we are offering Maps API developers the default look-and-feel of maps.google.com, all with one simple function call.
Now, you can get the standard UI elements you'd see on Google Maps (including the newer style "3D" map and zoom controls), along with other standard behaviour such as keyboard and mouse handling, just by adding one line of code.
// Create a map. var map = new GMap2(myMapDiv); // Give it the maps.google.com experience. map.setUIToDefault();
What's more, this function will ensure that if the UI of maps.google.com changes, these changes will also be reflected in your site without you having to update anything.
The function will automatically adjust what controls the map gets based on the size of the map. For maps larger than 300 x 400, the default controls are:
GLargeMapControl3D
GMapTypeControl
GScaleControl
For maps 300 x 400 or smaller, the default controls are:
GSmallZoomControl3D
GMenuMapTypeControl
Both will also enable scroll wheel zoom, double click zoom and add a GKeyboardHandler to the map.
GKeyboardHandler
You can also tweak the appearance to your liking. If you mostly want the standard behaviour, but, for example, don't want scroll wheel zoom enabled, you can get an instance of the default GMapUIOptions object, and adjust the fields to your liking.
// Get the default GMapUIOptions. var uiOptions = map.getDefaultUI(); // Disable scroll wheel zoom. uiOptions.zoom.scrollwheel = false; // Now set the map's UI with the tweaked options. map.setUI(uiOptions);
Along with this change, you can now also get direct access to the new 3D controls used on maps.google.com:
A full reference of the functions, the GMapUIOptions class and all the defaults are available on the Google Maps API Reference. As always, head over to the forum if you have any questions.
Sorry that puppeteering of John M is not included, but at least now your site can easily look and act like Google Maps!
One more thing: if you want to meet the Maps API team and hear about other exciting things we're working on, come to Google I/O in May.
March 5th, from 3-9pm, Google will be hosting a Google Geo APIs hackathon at our Manhattan offices, 111 8th Avenue at 15th street in Manhattan. Join us for some hacking around on Google Geo APIs. Work on our learning materials, or work on your own projects. There will presentations on new features in the APIs, and plenty of Geo Googlers around to help you with your technical questions. In particular, we will be helping people with the Google Maps API, the Google Earth API, and KML.
To register, click here. Space is limited, so you may want to register now.
Bom dia! добрый день!
During the past year, we've expanded translations of the Maps API documentation into more and more languages, making it easier for developers around the world to add Google Maps to their websites. Earlier in 2008, we provided Japanese and Simplified Chinese translations which we've recently updated.
Over the past few months, we've quietly released several more translations of the Maps API documentation, with Brazilian Portuguese and Russian being the latest to undergo a full translation. We previously added German and Spanish in September, 2008. Each of these translations can be found at the following URLs:
Additionally, you can change to translated documentation by selecting from the language selector in the top right portion of code.google.com's documentation pages. If a translation is available in that language, it will appear. (If no translation is available, default English will be shown.)
code.google.com
We've chosen these translations because they cover most of the non-English speaking readers of the Maps API documentation. We hope they will encourage a new group of developers to use the Google Maps APIs.
Note: although we will try to keep the translated documentation as up-to-date as possible, the English docs will often contain the latest information. (All developers should be sure to periodically check out the English Maps API Reference, which is updated every few weeks.)
Bom dia!
Ao longo do ano passado, nós expandimos os idiomas para os quais adocumentação da Maps API é traduzida, facilitando que desenvolvedoresao redor do mundo adicionem Google Maps aos seus websites. No iníciode 2008, nós disponibilizamos traduções em japonês e chinêssimplificado. Ambas as versões foram atualizadas recentemente.
Nos últimos meses, silenciosamente lançamos mais traduções completasda documentação da Maps API, com traduções para o alemão e o espanholem setembro de 2008 e português (brasileiro) e russo, recentemente.Estas traduções podem ser encontradas nas seguintes URLs:
Você pode escolher entre as traduções utilizando o selecionador deidioma no canto superior direito da página de documentação docode.google.com. Se uma tradução estiver disponível naquele idioma,ela irá aparecer (caso contrário, a versão em inglês será exibida).
Nós escolhemos estes idiomas porque eles cobrem a maioria dos usuáriosda documentação da Maps API que não fala inglês. Esperamos que estastraduções encorajem um novo grupo de desenvolvedores a usar a Maps APIda Google.
Nota: nós tentaremos manter as traduções tão atualizadas quantopossível. Porém, a versão em inglês irá, algumas vezes, conterinformações mais recentes. (Desenvolvedores devem verificarperiodicamente a documentação de referência da Maps API em inglês. Elaé atualizada há cada poucas semanas.)
Добрый день!
За последний год мы перевели документацию по API Карт на большое количество языков, и разработчикам по всему миру стало легче использовать Карты Google на своих сайтах. В начале 2008 года мы выпустили, а недавно обновили, переводы на японский и упрощённый китайский языки.
За несколько последних месяцев мы тихо и незаметно выпустили ещё несколько переводов документации по API карт. В сентябре появились немецкий и испанский переводы, а совсем недавно вышли переводы на бразильский, португальский и русский языки. Эти переводы можно найти здесь:
Вы можете переключиться на переведённую документацию, выбрав язык из выпадающего списка в правом верхнем углу страниц сайта code.google.com. Если перевод текста страницы для для выбранного языка существует, то он будет показан (если его нет, то будет показан текст на английском).
Мы выбрали именно эти языки, потому что большинство неанглоязычных читателей документации API Карт говорит именно на них. Надеемся, что переводы подтолкнут новых разработчиков к использованию API Карт Google.
Замечание: мы стараемся поддерживать переведённую документацию в актуальном состоянии, но часто англоязычная документация содержит наиболее свежую информацию. Всем разработчикам следует время от времени заглядывать в англоязычный справочник по API Карт, который обновляется раз в несколько недель.
Back in December, Julie posted on the Google LatLong blog about a new directions gadget that webmasters can embed on their websites to make it super easy for people to find them. Check out that post for information on embedding and the diverse ways the gadget can be used (with coordinates, addresses, zip codes, and more).
The gadget uses the Google Maps API and jQuery, and does nifty things like display a "Did you mean..." when they've entered an ambiguous address and then animates the selected address flying into the form. For those of you developers who like the functionality but want the it more integrated more into your site, the good news is that you can easily copy, paste, and modify the code from the gadget XML spec.
You've probably already read about this week's release of Google Earth 5.0 and its exciting new features, including Historical Imagery, Touring, Ocean, and Mars. As is usually the case for new features in Earth, we wanted to add representations for some of them to KML. In the past this was done by simply adding new elements to the KML specification. But that's no longer an option for us, since KML is no longer controlled by Google, having been released as an open standard by the Open Geospatial Consortium.
So what's an application provider to do? Fortunately, both Google and the OGC had the foresight to anticipate that innovation would continue to drive the standard forward, so OGC KML includes a standardized mechanism that enables any group to extend KML within their own XML namespace. Google Earth 5.0 uses this extension mechanism to add to KML in a standards-compliant way. We've also added some new documentation to guide you in understanding these new KML constructs:
For those who are interested in precise XML validation of the new elements, please see Google's new KML 2.2 extensions XSD, which is the formal standards-compliant description of their syntax.
As always, you can find out more information or ask questions in the KML Developer Forum.
Give us feedback in our Product Forums.