Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

3D Earth globe on google maps API JS

Short question:

Is there a way to represent the 3D earth globe with google maps web API?


On google maps, we can now visualize the earth as a globe in 3D.

Here is an example:

consult https://www.google.fr/maps/@18.4980181,7.5767451,3z


I am developing an HTML project with google maps API and I would like to use this earth representation on my website.

However, I do not find any topic about this subject.

Is there a way to represent the 3D earth globe with google maps API as on the google maps web site3D?


Here is an example of my map (it is of course an extract of my code to clarify the question):

var map;
      function initMap() {
        map = new google.maps.Map(document.getElementById('map'), {
          center: {lat: -34.397, lng: 150.644},
          zoom: 8
        });
      }
      /* Always set the map height explicitly to define the size of the div
       * element that contains the map. */
      #map {
        height: 100%;
      }
      /* Optional: Makes the sample page fill the window. */
      html, body {
        height: 100%;
        margin: 0;
        padding: 0;
      }
    <meta name="viewport" content="initial-scale=1.0">
    <meta charset="utf-8">
    <div id="map"></div>

    <script src="https://maps.googleapis.com/maps/api/js?callback=initMap"
    async defer></script>

Here is a picture of my map on my website:

enter image description here

This map only represents the earth as a planisphere. How may I have the same result as on the google maps web site?


Notice: I found this post in twitter witch introduces the feature on the google maps web site.

like image 615
SphynxTech Avatar asked Oct 14 '18 17:10

SphynxTech


People also ask

Is there an API for Google Earth?

The Earth Engine API is available in Python and JavaScript, making it easy to harness the power of Google's cloud for your own geospatial analysis.

Is JavaScript Google Maps API free?

The Maps JavaScript API uses a pay-as-you-go pricing model. Maps JavaScript API requests generate calls to two different SKUs depending on the type of request: map loads or panoramas.


1 Answers

I believe this feature is not available in the API yet.

I can see a feature request in Google issue tracker that looks like your question:

https://issuetracker.google.com/issues/111576221

I would suggest staring the feature request to add your vote and subscribe to further notifications. Hopefully one day Google will implement this feature in the API.

like image 157
xomena Avatar answered Sep 20 '22 09:09

xomena