Polygon
Bases: Spatial
Represents a polygon with a boundary and optional holes.
Follows the GeoJSON specification (RFC 7946).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
List[List[Tuple[float, float]]]
|
A polygon. |
required |
Attributes:
Name | Type | Description |
---|---|---|
area |
Float
|
|
boundary |
List[Tuple[float, float]]
|
|
holes |
List[List[Tuple[float, float]]]
|
|
xmin |
float
|
|
xmax |
float
|
|
ymin |
float
|
|
ymax |
float
|
|
Examples:
Create a polygon without any holes.
Create a polygon with 2 holes.
>>> Polygon(
... [
... [(0,0), (0,1), (1,1), (0,0)],
... [(0.1, 0.1), (0.1, 0.2), (0.2, 0.2), (0.1, 0.1)],
... [(0.6, 0.6), (0.6, 0.7), (0.7, 0.7), (0.6, 0.6)],
... ]
... )
Source code in valor/schemas/symbolic/types.py
964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 |
|
Attributes
valor.schemas.Polygon.area: Float
property
Symbolic representation of area.
valor.schemas.Polygon.boundary: typing.List[typing.Tuple[float, float]]
property
The boundary of the polygon.
Returns:
Type | Description |
---|---|
List[Tuple(float, float)]
|
A list of points. |
valor.schemas.Polygon.holes: typing.List[typing.List[typing.Tuple[float, float]]]
property
typing.Any holes in the polygon.
Returns:
Type | Description |
---|---|
List[List[Tuple(float, float)]]
|
A list of holes. |
valor.schemas.Polygon.xmax: float
property
Maximum x-value.
Returns:
Type | Description |
---|---|
float
|
|
valor.schemas.Polygon.xmin: float
property
Minimum x-value.
Returns:
Type | Description |
---|---|
float
|
|
valor.schemas.Polygon.ymax: float
property
Maximum y-value.
Returns:
Type | Description |
---|---|
float
|
|
valor.schemas.Polygon.ymin: float
property
Minimum y-value.
Returns:
Type | Description |
---|---|
float
|
|
Functions
valor.schemas.Polygon.decode_value(value)
classmethod
Decode object from JSON compatible dictionary.