إشعار: يجب
إثبات أهلية جميع المشاريع غير التجارية المسجّلة لاستخدام Earth Engine قبل
15 أبريل 2025 من أجل الحفاظ على إمكانية الوصول إلى Earth Engine.
ee.Geometry.Polygon
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
تنشئ هذه الدالة عنصر ee.Geometry يصف مضلّعًا.
لتسهيل الأمر، يمكن استخدام الوسيط المتغيّر عندما تكون جميع الوسيطات أرقامًا. يتيح ذلك إنشاء مضلّعات جيوديسية EPSG:4326 باستخدام LinearRing واحد مع عدد زوجي من الوسيطات، مثل ee.Geometry.Polygon(aLng, aLat, bLng, bLat, ..., aLng, aLat).
الاستخدام | المرتجعات |
---|
ee.Geometry.Polygon(coords, proj, geodesic, maxError, evenOdd) | Geometry.Polygon |
الوسيطة | النوع | التفاصيل |
---|
coords | List<Geometry>|List<List<List<Number>>>|List<Number> | قائمة بالحلقات التي تحدّد حدود المضلّع. يمكن أن تكون قائمة إحداثيات بتنسيق GeoJSON "مضلّع" أو قائمة عناصر ee.Geometry تصف LinearRing أو قائمة أرقام تحدّد حدود مضلّع واحد. |
proj | التوقّعات، اختيارية | إسقاط هذا الشكل الهندسي القيمة التلقائية هي إسقاط المدخلات، حيث يُفترض أنّ الأرقام هي EPSG:4326. |
geodesic | قيمة منطقية، اختيارية | إذا كانت القيمة false، تكون الحواف مستقيمة في العرض. إذا كانت القيمة هي true، تكون الحواف منحنية لتتّبع أقصر مسار على سطح الأرض. القيمة التلقائية هي الحالة الجيوديسية للمدخلات، أو "صحيح" إذا كانت المدخلات أرقامًا. |
maxError | ErrorMargin، اختياري | الحدّ الأقصى للخطأ عندما يجب إعادة عرض الشكل الهندسي للإدخال إلى عرض النتائج المطلوب بشكل صريح أو حالة خطوط الطول والعرض |
evenOdd | قيمة منطقية، اختيارية | إذا كانت القيمة صحيحة، سيتم تحديد الأجزاء الداخلية للمضلّع حسب قاعدة الزوجي/الفردي، حيث تكون النقطة داخل المضلّع إذا كانت تعبر عددًا فرديًا من الحواف للوصول إلى نقطة في اللانهاية. وفي الحالات الأخرى، تستخدم المضلّعات قاعدة "اليسار-الداخل"، حيث تكون الأجزاء الداخلية على الجانب الأيسر من حواف الشكل عند التنقّل بين الرؤوس بالترتيب المحدّد. إذا لم يتم تحديد هذه السمة، تكون القيمة التلقائية هي "صحيح". |
أمثلة
محرّر الرموز البرمجية (JavaScript)
// Construct a polygon from a list of GeoJSON 'Polygon' formatted coordinates.
var polygonGeoJSON = ee.Geometry.Polygon(
[
[ // exterior ring
[100.0, 0.0],
[103.0, 0.0],
[103.0, 3.0],
[100.0, 3.0],
[100.0, 0.0] // matching the first vertex is optional
],
[ // interior ring
[101.0, 1.0],
[102.0, 2.0],
[102.0, 1.0]
]
]
);
Map.addLayer(polygonGeoJSON, {}, 'polygonGeoJSON');
// Construct a polygon from an ee.Geometry.LinearRing.
var polygonLinearRing = ee.Geometry.Polygon(
[
ee.Geometry.LinearRing(
[
[105.0, 0.0],
[108.0, 0.0],
[108.0, 3.0]
]
)
]
);
Map.addLayer(polygonLinearRing, {}, 'polygonLinearRing');
// Construct a polygon from a list of x,y coordinate pairs defining a boundary.
var polygonCoordList = ee.Geometry.Polygon(
[110.0, 0.0, 113.0, 0.0, 110.0, 3.0]
);
Map.addLayer(polygonCoordList, {}, 'polygonCoordList');
Map.centerObject(polygonLinearRing);
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-07-25 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-07-25 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003e\u003ccode\u003eee.Geometry.Polygon\u003c/code\u003e constructs a polygon geometry in Earth Engine, accepting coordinates, projection, geodesic, max error, and even/odd parameters for customization.\u003c/p\u003e\n"],["\u003cp\u003eInput coordinates can be provided as GeoJSON 'Polygon' format, a list of \u003ccode\u003eee.Geometry.LinearRing\u003c/code\u003e objects, or a list of coordinate pairs for the boundary.\u003c/p\u003e\n"],["\u003cp\u003eBy default, the projection is derived from inputs (numbers assumed as EPSG:4326), edges are straight unless \u003ccode\u003egeodesic\u003c/code\u003e is true, and interiors are determined using the even/odd rule.\u003c/p\u003e\n"],["\u003cp\u003eOptional parameters allow for specifying projection, geodesic behavior, maximum error for reprojection, and even/odd rule for polygon interiors.\u003c/p\u003e\n"],["\u003cp\u003eConveniently, polygons can be created with a single LinearRing using varargs for providing coordinate pairs in EPSG:4326.\u003c/p\u003e\n"]]],["This describes the `ee.Geometry.Polygon` constructor, which creates a polygon geometry. Key actions include defining polygon boundaries using a list of rings (in GeoJSON format, as `ee.Geometry.LinearRing` objects, or coordinate pairs). The constructor accepts optional parameters: `proj` (projection), `geodesic` (edge curvature), `maxError` (reprojection error), and `evenOdd` (interior rule). Default values are provided if the parameters are omitted, and the input arguments dictate them.\n"],null,["# ee.Geometry.Polygon\n\n\u003cbr /\u003e\n\nConstructs an ee.Geometry describing a polygon.\n\n\u003cbr /\u003e\n\nFor convenience, varargs may be used when all arguments are numbers. This allows creating geodesic EPSG:4326 Polygons with a single LinearRing given an even number of arguments, e.g. ee.Geometry.Polygon(aLng, aLat, bLng, bLat, ..., aLng, aLat).\n\n| Usage | Returns |\n|-------------------------------------------------------------------------------------|------------------|\n| `ee.Geometry.Polygon(coords, `*proj* `, `*geodesic* `, `*maxError* `, `*evenOdd*`)` | Geometry.Polygon |\n\n| Argument | Type | Details |\n|------------|------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `coords` | List\\\u003cGeometry\\\u003e\\|List\\\u003cList\\\u003cList\\\u003cNumber\\\u003e\\\u003e\\\u003e\\|List\\\u003cNumber\\\u003e | A list of rings defining the boundaries of the polygon. May be a list of coordinates in the GeoJSON 'Polygon' format, a list of ee.Geometry objects describing a LinearRing, or a list of numbers defining a single polygon boundary. |\n| `proj` | Projection, optional | The projection of this geometry. The default is the projection of the inputs, where Numbers are assumed to be EPSG:4326. |\n| `geodesic` | Boolean, optional | If false, edges are straight in the projection. If true, edges are curved to follow the shortest path on the surface of the Earth. The default is the geodesic state of the inputs, or true if the inputs are numbers. |\n| `maxError` | ErrorMargin, optional | Max error when input geometry must be reprojected to an explicitly requested result projection or geodesic state. |\n| `evenOdd` | Boolean, optional | If true, polygon interiors will be determined by the even/odd rule, where a point is inside if it crosses an odd number of edges to reach a point at infinity. Otherwise polygons use the left- inside rule, where interiors are on the left side of the shell's edges when walking the vertices in the given order. If unspecified, defaults to true. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// Construct a polygon from a list of GeoJSON 'Polygon' formatted coordinates.\nvar polygonGeoJSON = ee.Geometry.Polygon(\n [\n [ // exterior ring\n [100.0, 0.0],\n [103.0, 0.0],\n [103.0, 3.0],\n [100.0, 3.0],\n [100.0, 0.0] // matching the first vertex is optional\n ],\n [ // interior ring\n [101.0, 1.0],\n [102.0, 2.0],\n [102.0, 1.0]\n ]\n ]\n);\nMap.addLayer(polygonGeoJSON, {}, 'polygonGeoJSON');\n\n// Construct a polygon from an ee.Geometry.LinearRing.\nvar polygonLinearRing = ee.Geometry.Polygon(\n [\n ee.Geometry.LinearRing(\n [\n [105.0, 0.0],\n [108.0, 0.0],\n [108.0, 3.0]\n ]\n )\n ]\n);\nMap.addLayer(polygonLinearRing, {}, 'polygonLinearRing');\n\n// Construct a polygon from a list of x,y coordinate pairs defining a boundary.\nvar polygonCoordList = ee.Geometry.Polygon(\n [110.0, 0.0, 113.0, 0.0, 110.0, 3.0]\n);\nMap.addLayer(polygonCoordList, {}, 'polygonCoordList');\n\nMap.centerObject(polygonLinearRing);\n```"]]