Ditu.google.com is the Chinese version of Google Maps, Google maps is a great product however in China, there is no detailed map, all we can play around is the satellite images. Google China released Ditu which is the answer, however due to China’s local law google is not allowed to put it together with the satellite image.

I wrote a small bookmarklet to allow you siwtch between Ditu and Google Maps automatically, locate to a position either in Google Maps or Ditu, click the bookmarlet, the page will automatically switch to the same location of the other site.

Drag this link to your Firefox address bar:

Ditu/Maps Switcher

The source code is here:

<a href="javascript:url = ''+document.getElementById('link'); if ((url.search(/http:\/\/maps.goog/i) ==-1) && (url.search(/http:\/\/ditu.goog/i)==-1)) { alert('Do not click this links, drag it too your address bar. \nThis bookmarklet only works on maps.google.com or ditu.google.com.\nCheck update on http://dev.robertmao.com/category/google-maps for latest updates or other google maps hack.'); } else { if (url.search(/ditu/i)==-1) { url=url.replace(/maps./i, 'ditu.'); } else {url=url.replace(/ditu./i, 'maps.'); if (url.search(/&t=k/i) ==-1) url += '&t=k'; } window.location=url;}">Ditu/Maps Switcher</a>

You can also copy the part “javascript:….url;}” and paste in your address input box and hit return to make a switch. However I think drag the link as a bookbarklet is a better idea.

I didn’t test under IE, so not sure if it work. Try at your own risk.

I am thinking writing a hack to overlap the image files of Ditu and Google Maps, it gonna be cooler, but this is still just an idea. One issue is, during I play arround, I found Ditu’s position is not exactly match the satellites images, maybe it’s also because google need to follow some local policy.

Popularity: 14% [?]



4 Comments to “Google Maps / Ditu switcher bookmarklet”

  1. 我blog故我在 » Blog Archive » Google Map和谷歌地图的切换小工具 | July 18th, 2007 at 5:41 am

    […] 只是编来玩和自用的,没有测试在Firefox以外的浏览器上是否正确。需要了解更多的在这里(英文的)。 […]

  2. 程序人生 : 藝海浮台 » Blog Archive » 通过谷歌ditu查找中国地标经纬度信息 | July 22nd, 2007 at 6:04 pm

    […] 只是编来玩和自用的,没有测试在Firefox以外的浏览器上是否正确。需要了解更多的在这里(英文的)。 […]

  3. 程序人生 : 藝海浮台 » Blog Archive » Google Map和谷歌地图的切换小工具(转自我的中文blog) | July 22nd, 2007 at 6:06 pm

    […] 只是编来玩和自用的,没有测试在Firefox以外的浏览器上是否正确。需要了解更多的在这里(英文的) […]

  4. Inmates Are Running Asylum » Blog Archive » Google Maps + Google Ditu Mashup | July 22nd, 2007 at 8:15 pm

    […] days ago I wrote a small bookmarklet to switch between Google Maps and Google Ditu, now I have a simple maskup which add google ditu as a customized layer in Google […]

Leave a Comment

Close
E-mail It
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License.