ee.Geometry.LinearRing.length
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Renvoie la longueur des parties linéaires de la géométrie. Les parties polygonales sont ignorées. La longueur des géométries multiples correspond à la somme des longueurs de leurs composants.
Utilisation | Renvoie |
---|
LinearRing.length(maxError, proj) | Float |
Argument | Type | Détails |
---|
ceci : geometry | Géométrie | Géométrie d'entrée. |
maxError | ErrorMargin, valeur par défaut : null | Quantité maximale d'erreur tolérée lors de toute reprojection nécessaire. |
proj | Projection, valeur par défaut : null | Si cette propriété est spécifiée, le résultat sera exprimé dans les unités du système de coordonnées de cette projection. Sinon, elle sera exprimée en mètres. |
Exemples
Éditeur de code (JavaScript)
// Define a LinearRing object.
var linearRing = ee.Geometry.LinearRing(
[[-122.091, 37.420],
[-122.085, 37.422],
[-122.080, 37.430]]);
// Apply the length method to the LinearRing object.
var linearRingLength = linearRing.length();
// Print the result to the console.
print('linearRing.length(...) =', linearRingLength);
// Display relevant geometries on the map.
Map.setCenter(-122.085, 37.422, 15);
Map.addLayer(linearRing,
{'color': 'black'},
'Geometry [black]: linearRing');
Configuration de Python
Consultez la page
Environnement Python pour en savoir plus sur l'API Python et sur l'utilisation de geemap
pour le développement interactif.
import ee
import geemap.core as geemap
Colab (Python)
# Define a LinearRing object.
linearring = ee.Geometry.LinearRing(
[[-122.091, 37.420], [-122.085, 37.422], [-122.080, 37.430]]
)
# Apply the length method to the LinearRing object.
linearring_length = linearring.length()
# Print the result.
display('linearring.length(...) =', linearring_length)
# Display relevant geometries on the map.
m = geemap.Map()
m.set_center(-122.085, 37.422, 15)
m.add_layer(linearring, {'color': 'black'}, 'Geometry [black]: linearring')
m
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/07/26 (UTC).
[null,null,["Dernière mise à jour le 2025/07/26 (UTC)."],[[["\u003cp\u003eCalculates the total length of the linear segments within a geometry, excluding any polygonal areas.\u003c/p\u003e\n"],["\u003cp\u003eFor multi-geometries, the total length is the sum of the lengths of their individual components.\u003c/p\u003e\n"],["\u003cp\u003eThe length is returned in meters by default but can be calculated in the units of a specified projection using the \u003ccode\u003eproj\u003c/code\u003e argument.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003emaxError\u003c/code\u003e argument allows controlling the tolerance for error during reprojection if necessary.\u003c/p\u003e\n"]]],["The `length` method calculates the length of linear parts within a geometry, excluding polygonal sections. For multi-geometries, it sums the lengths of individual components. The method accepts an optional `maxError` argument to specify reprojection tolerance and a `proj` argument to define the output coordinate system. Without `proj`, the result is in meters. The method is demonstrated in both JavaScript and Python examples using `LinearRing` objects.\n"],null,["# ee.Geometry.LinearRing.length\n\nReturns the length of the linear parts of the geometry. Polygonal parts are ignored. The length of multi geometries is the sum of the lengths of their components.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|----------------------------------------------|---------|\n| LinearRing.length`(`*maxError* `, `*proj*`)` | Float |\n\n| Argument | Type | Details |\n|------------------|----------------------------|----------------------------------------------------------------------------------------------------------------------------|\n| this: `geometry` | Geometry | The input geometry. |\n| `maxError` | ErrorMargin, default: null | The maximum amount of error tolerated when performing any necessary reprojection. |\n| `proj` | Projection, default: null | If specified, the result will be in the units of the coordinate system of this projection. Otherwise it will be in meters. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// Define a LinearRing object.\nvar linearRing = ee.Geometry.LinearRing(\n [[-122.091, 37.420],\n [-122.085, 37.422],\n [-122.080, 37.430]]);\n\n// Apply the length method to the LinearRing object.\nvar linearRingLength = linearRing.length();\n\n// Print the result to the console.\nprint('linearRing.length(...) =', linearRingLength);\n\n// Display relevant geometries on the map.\nMap.setCenter(-122.085, 37.422, 15);\nMap.addLayer(linearRing,\n {'color': 'black'},\n 'Geometry [black]: linearRing');\n```\nPython setup\n\nSee the [Python Environment](/earth-engine/guides/python_install) page for information on the Python API and using\n`geemap` for interactive development. \n\n```python\nimport ee\nimport geemap.core as geemap\n```\n\n### Colab (Python)\n\n```python\n# Define a LinearRing object.\nlinearring = ee.Geometry.LinearRing(\n [[-122.091, 37.420], [-122.085, 37.422], [-122.080, 37.430]]\n)\n\n# Apply the length method to the LinearRing object.\nlinearring_length = linearring.length()\n\n# Print the result.\ndisplay('linearring.length(...) =', linearring_length)\n\n# Display relevant geometries on the map.\nm = geemap.Map()\nm.set_center(-122.085, 37.422, 15)\nm.add_layer(linearring, {'color': 'black'}, 'Geometry [black]: linearring')\nm\n```"]]