Make 2-D map into 3-D map?

22 views
Skip to first unread message

sally_latitude

unread,
Aug 16, 2008, 1:15:53 PM8/16/08
to KML Developer Support - Google Earth Browser Plugin
I think what I am asking is relatively easy to do, but I can't find
info on how to do it.

I have created a Google map on a web page (code below) and all I want
to do is make this map 3-D. What do I need to add to the below code to
get it to work?


<head>
<title>Map example</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>

<body>
<iframe width="425" height="350" frameborder="0" scrolling="no"
marginheight="0" marginwidth="0" src="http://maps.google.com/maps/ms?
hl=en&amp;ie=UTF8&amp;msa=0&amp;msid=107105856478146793593.000444b9bff11d00923af&amp;ll=44.724245,-122.871773&amp;spn=1.796393,1.186198&amp;output=embed&amp;s=AARTsJom0-
RtCsjTuLp7jefziviircKNVg"></iframe><br /><small><a href="http://
maps.google.com/maps/ms?
hl=en&amp;ie=UTF8&amp;msa=0&amp;msid=107105856478146793593.000444b9bff11d00923af&amp;ll=44.724245,-122.871773&amp;spn=1.796393,1.186198&amp;source=embed"
style="color:#0000FF;text-align:left">View Larger Map</a></small>
</body>
</html>

barryhunter [KML Guru]

unread,
Aug 16, 2008, 1:22:51 PM8/16/08
to KML Developer Support - Google Earth Browser Plugin
Its not that easy to convert that directly to a 3D map, you will need
some javascript knowledge, and I dont mean to sound rude but that
doesnt sound like someting you want to get involved with.

However there is this:
http://www.takitwithme.com/geembed.html
which is a easy way to embed a 3D map in a page. Not exactly the same
but possibly close enough.

When viewing you 'My Map' just right click the 'View in Google earth'
URL, copy the link the clipboard and the paste the url into the above
page.

sally_latitude

unread,
Aug 16, 2008, 1:36:30 PM8/16/08
to KML Developer Support - Google Earth Browser Plugin
I was looking for an easy way out without having to code :) but I have
another option. If I have a kml file, and all I want to do is to
display this kml file in the browser, what's the easiest way to do
that? I have the code that was given to me when I created the key but
I don't know where to insert my kml link and I'm not sure what would
go in the map.setCenter function. I simply want to display the map as
it is in my kml file.

<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/
>
<title>Google Maps JavaScript API Example</title>
<script src="http://maps.google.com/maps?
file=api&amp;v=2&amp;key=ABQIAAAAn2B6HPD0o-
E4L3MciIfY0xSbKo3LndDMr0p4YoX_Y6MrPXQz-xSovOXWk4amiQdWfADt103XX6L1eQ"
type="text/javascript"></script>
<script type="text/javascript">

//<![CDATA[

function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(37.4419, -122.1419), 13);
}
}

//]]>
</script>
</head>
<body onload="load()" onunload="GUnload()">
<div id="map" style="width: 500px; height: 300px"></div>
</body>
</html>

barryhunter [KML Guru]

unread,
Aug 16, 2008, 6:38:02 PM8/16/08
to KML Developer Support - Google Earth Browser Plugin
Did you try the takitwithme site? That requires almost zeror coding.
(again just copy pasting HTML)

I beleive there are even other GE embedding utilities, try
gearthblog.com


It is possible to just modify the Google Maps API code to do what you
want, but it get it working nicly its a no trivial modification. If
still stuck can probably dig out some examples somewhere (there are
probably some in Googles examples if go looking)

sally_latitude

unread,
Aug 16, 2008, 8:14:46 PM8/16/08
to KML Developer Support - Google Earth Browser Plugin
Yes, I've been to the gearthblog.com site and they also recommend
takitwithme. I've tried it out and I have to say that he made an
awesome tool that is extremely easy to use and I got it to work just
fine but my customer doesn't like the promotion at the bottom of the
map. :( Beggers can't be choosers! :)

I question if Google will build something like takitwithme for easy
converting?

Anyway, if you have time to pull up some examples, that would be
appreciated. Until then, I'll keep digging around and see what I can
find. Thank you so much.

Roman N

unread,
Aug 19, 2008, 7:03:12 PM8/19/08
to KML Developer Support - Google Earth Browser Plugin
Hi sally_latitude,

If you'd like to show *only* Earth:

Basic sample to get you started:
http://earth-api-samples.googlecode.com/svn/trunk/demos/helloearth/index.html
Loading KML: http://earth-api-samples.googlecode.com/svn/trunk/examples/kml-fetch-good.html

If you're looking to load the same KML in both Maps and Earth, the
current solution is to use both GGeoXml and fetchKml:

// first declare some more global variables
var KML_PATH = 'http://path/to/your.kml';
var map;

// use GGeoXml:
map.addOverlay(new GGeoXml(KML_PATH));

// use fetchKml to pop the KML into Earth
map.getEarthInstance(function(ge) {
google.earth.fetchKml(ge, KML_PATH,
function(kmlObject) {
ge.getFeatures().appendChild(kmlObject);
});
});

Note-- this will eventually be obsolete (you'll only need to use one
call to load KML into both Maps and Earth), and GGeoXml does not yet
support all KML features.

Hope that helps!

- Roman
Reply all
Reply to author
Forward
0 new messages