ee.Geometry.Polygon
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
יוצרת ee.Geometry שמתארת פוליגון.
לנוחותכם, אפשר להשתמש ב-varargs כשכל הארגומנטים הם מספרים. הפונקציה הזו מאפשרת ליצור מצולעים גאודזיים מסוג 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 Polygon, רשימה של אובייקטים מסוג ee.Geometry שמתארים LinearRing, או רשימה של מספרים שמגדירים גבול של פוליגון יחיד. |
proj | תחזית, אופציונלי | ההטלה של הגיאומטריה הזו. ברירת המחדל היא ההטלה של נתוני הקלט, כאשר המספרים מניחים שהם EPSG:4326. |
geodesic | בוליאני, אופציונלי | אם הערך הוא False, הקצוות ישרים בהטלה. אם הערך הוא True, הקצוות מעוקלים כדי לעקוב אחרי הנתיב הקצר ביותר על פני כדור הארץ. ברירת המחדל היא המצב הגיאודזי של ערכי הקלט, או true אם ערכי הקלט הם מספרים. |
maxError | ErrorMargin, אופציונלי | השגיאה המקסימלית כשצריך להקרין מחדש גיאומטריה של קלט להקרנת תוצאה או למצב גיאודזי שנדרשים באופן מפורש. |
evenOdd | בוליאני, אופציונלי | אם הערך הוא True, פנים הפוליגון ייקבע לפי כלל הזוגי/האי-זוגי, שבו נקודה נמצאת בפנים אם היא חוצה מספר אי-זוגי של קצוות כדי להגיע לנקודה באינסוף. אחרת, במצולעים נעשה שימוש בכלל 'הצד השמאלי', שבו החלק הפנימי נמצא בצד שמאל של קצוות המעטפת כשמסתכלים על הקודקודים בסדר הנתון. אם לא מציינים ערך, ברירת המחדל היא true. |
דוגמאות
עורך הקוד (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 (שעון UTC).
[null,null,["עדכון אחרון: 2025-07-25 (שעון UTC)."],[[["\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```"]]