Class ElevationSampler

ElevationSampler

किसी खास जगह की ऊंचाई के नमूने का इस्तेमाल करने की अनुमति देता है.
नीचे दिए गए उदाहरण में बताया गया है कि डेनवर से कोलोराडो के ग्रैंड जंक्शन तक के रास्ते की सबसे ऊंची जगह का पता लगाने के लिए, इस क्लास का इस्तेमाल कैसे किया जा सकता है. इसके बाद, इस क्लास को मैप में मैप करें, और मैप को Google Drive में सेव करें.

// Get directions from Denver to Grand Junction.
var directions = Maps.newDirectionFinder()
    .setOrigin('Denver, CO')
    .setDestination('Grand Junction, CO')
    .setMode(Maps.DirectionFinder.Mode.DRIVING)
    .getDirections();
var route = directions.routes[0];

// Get elevation samples along the route.
var numberOfSamples = 30;
var response = Maps.newElevationSampler()
    .samplePath(route.overview_polyline.points, numberOfSamples)

// Determine highest point.
var maxElevation = Number.MIN_VALUE;
var highestPoint = null;
for (var i = 0; i < response.results.length; i++) {
  var sample = response.results[i];
  if (sample.elevation > maxElevation) {
    maxElevation = sample.elevation;
    highestPoint = sample.location;
  }
}

// Add the path and marker to a map.
var map = Maps.newStaticMap()
    .addPath(route.overview_polyline.points)
    .addMarker(highestPoint.lat, highestPoint.lng);

// Save the map to your drive
DocsList.createFile(Utilities.newBlob(map.getMapImage(), 'image/png', 'map.png'));

इन्हें भी देखें

तरीके

तरीकारिटर्न टाइपसंक्षिप्त विवरण
sampleLocation(latitude, longitude)Objectएकल बिंदु (lat/lng) के लिए ऊंचाई डेटा देता है.
sampleLocations(points)Objectबिंदुओं की शृंखला (lat/lng) के लिए ऊंचाई डेटा दिखाता है.
sampleLocations(encodedPolyline)Objectकोड में बदली गई पॉलीलाइन में पॉइंट के लिए ऊंचाई का डेटा दिखाता है.
samplePath(points, numSamples)Objectबिंदुओं की सीरीज़ का इस्तेमाल करके तय की गई किसी लाइन के कई सैंपल की ऊंचाई का डेटा दिखाता है.
samplePath(encodedPolyline, numSamples)Objectकोड में बदली गई पॉलीलाइन का इस्तेमाल करके, किसी लाइन के साथ कई सैंपल के लिए ऊंचाई का डेटा दिखाता है.

ज़्यादा जानकारी के साथ दस्तावेज़

sampleLocation(latitude, longitude)

एकल बिंदु (lat/lng) के लिए ऊंचाई डेटा देता है.

// Gets the elevation of Times Square using a point.
var data = Maps.newElevationSampler().sampleLocation(40.759011, -73.984472);
Logger.log(data.results[0].elevation);

पैरामीटर

नामTypeब्यौरा
latitudeNumberनमूने के लिए बिंदु का अक्षांश
longitudeNumberनमूने के लिए बिंदु का देशांतर

रिटर्न

Object — यह एक JSON ऑब्जेक्ट है, जिसमें ऊंचाई की जानकारी वाला डेटा शामिल होता है. इसके बारे में यहां बताया गया है


sampleLocations(points)

बिंदुओं की शृंखला (lat/lng) के लिए ऊंचाई डेटा दिखाता है.

// Gets the elevation of Times Square and Central Park using points.
var data = Maps.newElevationSampler().sampleLocations([
    // Times Square
    40.759011, -73.984472,
    // Central Park
    40.777052, -73.975464
]);
Logger.log('Times Square: ' + data.results[0].elevation);
Logger.log('Central Park: ' + data.results[1].elevation);

पैरामीटर

नामTypeब्यौरा
pointsNumber[]अक्षांश/देशांतर जोड़े की कैटगरी

रिटर्न

Object — यह एक JSON ऑब्जेक्ट है, जिसमें ऊंचाई की जानकारी वाला डेटा शामिल होता है. इसके बारे में यहां बताया गया है


sampleLocations(encodedPolyline)

कोड में बदली गई पॉलीलाइन में पॉइंट के लिए ऊंचाई का डेटा दिखाता है.

// Gets the elevation of Times Square and Central Park using a polyline.
var data = Maps.newElevationSampler().sampleLocations('yvwwF|aqbMwoBiw@');
Logger.log('Times Square: ' + data.results[0].elevation);
Logger.log('Central Park: ' + data.results[1].elevation);

पैरामीटर

नामTypeब्यौरा
encodedPolylineStringसैंपल के लिए, पॉइंट की कोड में बदली गई पॉलीलाइन

रिटर्न

Object — यह एक JSON ऑब्जेक्ट है, जिसमें ऊंचाई की जानकारी वाला डेटा शामिल होता है. इसके बारे में यहां बताया गया है


samplePath(points, numSamples)

बिंदुओं की सीरीज़ का इस्तेमाल करके तय की गई किसी लाइन के कई सैंपल की ऊंचाई का डेटा दिखाता है.

// Gets the elevation of five points between Times Square and Central Park.
var data = Maps.newElevationSampler().samplePath([
    // Times Square
    40.759011, -73.984472,
    // Central Park
    40.777052, -73.975464
], 5);
for (var i = 0; i < data.results.length; i++) {
  Logger.log(data.results[i].elevation);
}

पैरामीटर

नामTypeब्यौरा
pointsNumber[]अक्षांश/देशांतर की जोड़ी की कैटगरी, जो नमूने के लिए पाथ तय करती हैं
numSamplesIntegerपॉइंट के पाथ पर सैंपल के लिए पॉइंट की संख्या

रिटर्न

Object — यह एक JSON ऑब्जेक्ट है, जिसमें ऊंचाई की जानकारी वाला डेटा शामिल होता है. इसके बारे में यहां बताया गया है


samplePath(encodedPolyline, numSamples)

कोड में बदली गई पॉलीलाइन का इस्तेमाल करके, किसी लाइन के साथ कई सैंपल के लिए ऊंचाई का डेटा दिखाता है.

// Gets the elevation of five points between Times Square and Central Park.
var data = Maps.newElevationSampler().samplePath('yvwwF|aqbMwoBiw@', 5);
for (var i = 0; i < data.results.length; i++) {
  Logger.log(data.results[i].elevation);
}

पैरामीटर

नामTypeब्यौरा
encodedPolylineStringपॉइंट की कोड में बदली गई पॉलीलाइन, जो नमूने के लिए पाथ तय करती है
numSamplesIntegerपॉइंट के पाथ पर सैंपल के लिए पॉइंट की संख्या

रिटर्न

Object — यह एक JSON ऑब्जेक्ट है, जिसमें ऊंचाई की जानकारी वाला डेटा शामिल होता है. इसके बारे में यहां बताया गया है