4

Is Google maps' elevation API suitable to obtain the high resolution elevation data for areas that have 3D building such as Manhattan? Would the API for example yield a significant different value on the street next to One WTC than on the roof? This is a prerequisite before I invest time in learning Javascript and how to use the API.

Edit: SRTM DEM is a far cry from the resolution/ quality of the 3d buildings map of Manhattan for example.

enter image description here

I am really interested in the elevation of these 3d shapes. Google should have this dataset and maybe it is available.

  • 3
    Why not just use the Opendata like 1 foot Digital Elevation Model (DEM) for NYC? data.cityofnewyork.us/City-Government/… – Mapperz Apr 28 '15 at 14:30
  • thanks for the suggestion but we would preferably scale this method up and make it available in multiple cities (for which 3d buildings are available in Google Maps) – RutgerH Apr 29 '15 at 14:52
  • 4
    You can use Google Maps Elevation API with Google Service but not interdependently on it's own - The Elevation API may only be used in conjunction with displaying results on a Google map; using elevation data without displaying a map for which elevation data was requested is prohibited. developers.google.com/maps/documentation/elevation/index#Limits – Mapperz Apr 29 '15 at 15:32
  • You can download LiDAR data and generate a very accurate DEM. LiDAR data is available for free for most of the US (I'm assuming you are looking for US-based urban data sets). – user52700 May 26 '15 at 22:24
5
+25

Alternatively, a DEM with global coverage that might suit you is the SRTM 1 second DEM. This was recently released and has a resolution of about 30 metres. Read about it at http://www2.jpl.nasa.gov/srtm/ and download load it (free) at http://earthexplorer.usgs.gov/.

5

The Google Elevation API is not accurate enough at a Building level.

You can test it out by using going to http://www.daftlogic.com/sandbox-google-maps-find-altitude.htm

Just search for 1 World Trade Center, New York, NY 10007 and then click around, and you'll see that the heights that you get aren't really for the top of a building

  • 2
    Thanks for this very useful site. Too bad the 3d building elevation is not superimposed on this dataset. Does somebody know where to find the dimensions of these official Google 3d buildings? (API/WMS/download all fine) – RutgerH May 7 '15 at 10:01
1

Another source for google may be Zonum. Here you can generate points with elevation data and then generate interpolated surface.

For USA you may try National Map Viewer

If you want to develop google api app yourself just modify the following file with your Google Map Api Key see image --where to change API and save the file as html and open in browser that's all.

    <!DOCTYPE html>
    <html>
        <head>
            <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
            <style type="text/css">
                  html { height: 100% }
                  body { height: 100%; margin: 5; }
                  #mapDiv { width: 800px; height: 500px; }
            </style>
            <!-- Include Google Maps JS API -->
            <script type="text/javascript"
              src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAyghysBuB6YUYtcxn8hVKyeNJkoC5geSQ&libraries=drawing&sensor=false">
            </script>

      <!-- Map creation is here -->
            <script type="text/javascript">
                  //Defining map as a global variable to access from other functions
                  var map;

                  //define global elevator object
                  var elevator;

                  //define global marker popup variable
                  var popup;

                  function initMap() {
                        //initialize the elevation service
                        elevator = new google.maps.ElevationService();

                        //initialize info popup window
                        popup = new google.maps.InfoWindow();

                        //Enabling new cartography and themes
                        google.maps.visualRefresh = true;

                        //Setting starting options of map
                        var mapOptions = {
                              center: new google.maps.LatLng(39.9078, 32.8252),
                              zoom: 10,
                              mapTypeId: google.maps.MapTypeId.ROADMAP
                        };

                        //Getting map DOM element
                        var mapElement = document.getElementById("mapDiv");

                        //Creating a map with DOM element which is just obtained
                        map = new google.maps.Map(mapElement, mapOptions);

                        //creating drawingManager
                        var drawingManager = new google.maps.drawing.DrawingManager({
                            //initial drawing tool to be enabled
                            drawingMode:null,
                            //enable the drawingControl to be seen in the UI
                            drawingControl:true,
                            //select which drawing modes to be seen in the drawingControl and position them
                            drawingControlOptions: {
                                //select a position in the UI
                                position: google.maps.ControlPosition.TOP_CENTER,
                                //selected drawing modes to be seen in the control
                                drawingModes: [
                                    google.maps.drawing.OverlayType.MARKER                          ]
                            }
                        });

                        //enable drawing functionality
                        drawingManager.setMap(map);

                        //add event listener for completion of your marker
                        google.maps.event.addListener(drawingManager, 'markercomplete', function(marker) {

                            //get the LatLng object of the marker, it is necessary for the elevation service
                            var markerPosition = marker.getPosition();
                            //embed the marker position in an array
                            var markerPositions = [markerPosition];

                            //send the elevation request
                            elevator.getElevationForLocations({'locations': markerPositions}, function(results, status) {
                                //if the service is working properly...
                                if (status == google.maps.ElevationStatus.OK) {
                                    //Array of results will return if everything is OK
                                    if (results) {
                                        //infowindow stuff
                                        showElevationOfResult(results[0],marker);
                                    }
                                } 
                                //if the service is not working, deal with it
                                else {
                                    alert("Elevation request failed because: " + status);
                                }
                            }); 
                        });

                        //function for displaying the elevation on the infowindow
                        function showElevationOfResult(result, marker) {
                            map.setCenter(marker.getPosition());
                            map.setZoom(13);

                            var popupContent = '<b>Elevation: </b> ' + result.elevation;
                            popup.setContent(popupContent);
                            popup.open(map, marker);

                        }
                  }  
            </script>
        </head>
        <body onload="initMap()">
            <b>Finding Elevation on Map Click</b><br/>
            <div id="mapDiv"/>
        </body>
    </html>

N.B. There is limitation of using API and accuracy too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.