你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
GeoPolygon 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示由外环和可选内环组成的多边形。
[System.Text.Json.Serialization.JsonConverter(typeof(Azure.Core.GeoJson.GeoJsonConverter))]
public sealed class GeoPolygon : Azure.Core.GeoJson.GeoObject
[<System.Text.Json.Serialization.JsonConverter(typeof(Azure.Core.GeoJson.GeoJsonConverter))>]
type GeoPolygon = class
inherit GeoObject
Public NotInheritable Class GeoPolygon
Inherits GeoObject
- 继承
- 属性
示例
创建多边形:
var polygon = new GeoPolygon(new[]
{
new GeoPosition(-122.108727, 47.649383),
new GeoPosition(-122.081538, 47.640846),
new GeoPosition(-122.078634, 47.576066),
new GeoPosition(-122.112686, 47.578559),
new GeoPosition(-122.108727, 47.649383),
});
创建带孔的多边形:
var polygon = new GeoPolygon(new[]
{
// Outer ring
new GeoLinearRing(new[]
{
new GeoPosition(-122.108727, 47.649383),
new GeoPosition(-122.081538, 47.640846),
new GeoPosition(-122.078634, 47.576066),
new GeoPosition(-122.112686, 47.578559),
// Last position same as first
new GeoPosition(-122.108727, 47.649383),
}),
// Inner ring
new GeoLinearRing(new[]
{
new GeoPosition(-122.102370, 47.607370),
new GeoPosition(-122.083488, 47.608007),
new GeoPosition(-122.085419, 47.597879),
new GeoPosition(-122.107005, 47.596895),
// Last position same as first
new GeoPosition(-122.102370, 47.607370),
})
});
构造函数
属性
BoundingBox |
表示有关 的 GeoObject坐标范围的信息。 (继承自 GeoObject) |
Coordinates |
返回构成此几何图形的坐标数组的视图。 |
OuterRing |
返回多边形的外环。 |
Rings |
获取形成多边形的一组环。 |
Type |
获取此 对象的 GeoJSON 类型。 |
方法
ToString() |
将 的 GeoObject 实例转换为 GeoJSON 表示形式。 (继承自 GeoObject) |
TryGetCustomProperty(String, Object) |
尝试获取与 关联的 GeoObject自定义属性的值。 (继承自 GeoObject) |