Wprowadzamy w Earth Engine
poziomy limitów niekomercyjnych, aby chronić współdzielone zasoby obliczeniowe i zapewnić niezawodną wydajność dla wszystkich. We wszystkich projektach niekomercyjnych trzeba będzie wybrać poziom limitu do
27 kwietnia 2026 r.. W przeciwnym razie zostanie im przydzielony poziom Społeczność. Limity poziomu zaczną obowiązywać we wszystkich projektach (niezależnie od daty wyboru poziomu) od
27 kwietnia 2026 r. Więcej informacji
ui.Map.getScale
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Zwraca przybliżoną skalę pikseli bieżącego widoku mapy w metrach.
| Wykorzystanie | Zwroty |
|---|
Map.getScale() | Liczba|Ciąg znaków |
| Argument | Typ | Szczegóły |
|---|
to: ui.map | ui.Map | Instancja ui.Map. |
Przykłady
Edytor kodu (JavaScript)
// The default map in the Code Editor is a built-in ui.Map object called "Map".
// Let's refer to it as "defaultMap" for clarity.
var defaultMap = Map;
// ui.Map objects can be constructed. Here, a new map is declared.
var newMap = ui.Map({
center: {lat: 0, lon: 0, zoom: 1},
style: {position: 'bottom-right', width: '400px'}
});
// Add the newMap to the defaultMap.
defaultMap.add(newMap);
// You can set the viewport of a ui.Map to be centered on an object.
// Here, the defaultMap is centered on a point with a selected zoom level.
var geom = ee.Geometry.Point(-122.0841, 37.4223);
defaultMap.centerObject(geom, 18);
defaultMap.addLayer(geom, {color: 'orange'}, 'Googleplex');
// Map extent can be fetched using the ui.Map.getBounds method.
print('defaultMap bounds as a list',
defaultMap.getBounds());
print('defaultMap bounds as a dictionary',
ee.Dictionary.fromLists(['w', 's', 'e', 'n'], defaultMap.getBounds()));
print('defaultMap bounds as GeoJSON',
defaultMap.getBounds({asGeoJSON: true}));
// Map center point can be fetched using the ui.Map.getCenter method.
print('defaultMap center as a Point geometry', defaultMap.getCenter());
// Map zoom level can be fetched using the ui.Map.getZoom method.
print('defaultMap zoom level', defaultMap.getZoom());
// Map scale can be fetched using the ui.Map.getScale method.
print('defaultMap approximate pixel scale', defaultMap.getScale());
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-26 UTC.
[null,null,["Ostatnia aktualizacja: 2025-07-26 UTC."],[],["The core content describes retrieving the approximate pixel scale of a map view using `Map.getScale()`, which returns a number or string. The code demonstrates using this method on a `ui.Map` instance, named \"defaultMap\". It also showcases other map functionalities like creating a new map, centering it on a point, adding a layer, and fetching bounds, center, and zoom level. `Map.getScale()` is used to print the pixel scale.\n"]]