Point extraction from Google Maps

Sometimes, the precise coordinates of some markers from a Google Maps layer are to be obtained. One way is to look them up in the source code of the map generation. But the information should also be in the map after construction, right? For example, all the marker items on the map contain this information. The following brief script extracts the coordinates and the title of the markers and writes them into a plain text file in a new browser window.

  var out = '';
  var i   = 0;
  while ( x = document.getElementById( 'mtgt_unnamed_' + i ) )
    out += ( [x.__marker__.C.x, x.__marker__.C.y, x.__marker__.ca.title] ).join( ', ' ) + "\n";
    i ++;
  window.open( 'data:text/plain;charset=UTF-8,' + encodeURIComponent( out ) );

For ease of use, the whole script can be put into a bookmark. By clicking it, it will be executed on the currently shown page. So if interested, bookmark this link: GMaps point extractor.

If more information, such as content of popup windows, is needed, a script more specific to the implementation of the map generation has to be used.