You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// The polygon definitely does not contain the point, the expensive check
32
+
// is not needed.
33
+
returnfalse;
34
+
}
35
+
```
36
+
37
+
* Analytics
38
+
39
+
There is no convenient function to index a polygon into the H3 grid for analytics purposes. Polygons that are small enough or shaped in specific ways will not be converted into cells, requiring workarounds in order to use them.
40
+
41
+
* Spherical geometry consistency
42
+
43
+
Most of the H3 library uses spherical geoemtry. For example, cell boundaries are spherical hexagons
44
+
and pentagons. The `polyfill` function is different that it assumes Cartesian geometry. For
45
+
consistency with the rest of the library, the `polyfill` functions should be able to use the same
46
+
cell boundaries.
47
+
48
+
Maintaining a Cartesian option is useful for cases where polygons have been drawn on a projected map
49
+
and the boundaries should be the same.
50
+
51
+
* Very large polygons
52
+
53
+
Polyfills of very large polygons require allocating large blocks of memory, and spending large
54
+
amounts of time in a library function without progress information being available to the caller.
55
+
(To be determined if this is in scope for this RFC or for another.)
56
+
15
57
## Approaches
16
58
17
59
*What are the various options to address this issue?*
18
60
61
+
On an API level, we will need to expose the containment mode and spherical/Cartesian choice as
62
+
options to the caller.
63
+
64
+
Internally, we would like to reuse the same implementation as much as possible, but change the
65
+
exact inclusion check used for each mode.
66
+
67
+
### Comparisons
68
+
69
+
#### S2
70
+
71
+
Contains separate functions for [intersection and containment](http://s2geometry.io/devguide/basic_types#s2polygon)
72
+
73
+
#### Turf library
74
+
75
+
Contains separate functions for [intersection](http://turfjs.org/docs/#booleanIntersects), [containment](http://turfjs.org/docs/#booleanContains), etc.
76
+
77
+
#### PostGIS
78
+
79
+
Contains separate functions for [intersection](https://postgis.net/docs/ST_Intersects.html), [containment](https://postgis.net/docs/ST_Contains.html), etc.
80
+
81
+
See also [Simple Feature Access - SQL](https://www.ogc.org/standards/sfs).
82
+
83
+
#### JTS
84
+
85
+
Separate predicatess. (Reference: [JTS Developer Guide](https://github.com/locationtech/jts/blob/master/doc/JTS%20Developer%20Guide.pdf))
86
+
87
+
#### GeoPandas
88
+
89
+
Contains separate functions for [intersection](https://geopandas.org/en/stable/docs/reference/api/geopandas.GeoSeries.intersection.html), [containment](https://geopandas.org/en/stable/docs/reference/api/geopandas.GeoSeries.contains.html), etc.
90
+
19
91
## Proposal
20
92
21
-
*What is the recommended approach?*
93
+
*What is the recommended approach?*
94
+
95
+
The signature for `polygonToCells` and `maxPolygonToCellsSize` would be changed as follows:
96
+
97
+
```
98
+
/** @brief maximum number of hexagons that could be in the geoloop */
`flags` would have the following possible bit layout:
108
+
109
+
| Bits | Meaning
110
+
| ---------- | -------
111
+
| 1-2 (LSB) | If 0, containment mode centroid.<br>If 1, containment mode cover.<br>If 2, containment mode intersects.<br>3 is a reserved value.
112
+
| 3 | If 0, spherical containment.<br>If 1, cartesian containment (same as H3 version 3).
113
+
| All others | Reserved and must be set to 0.
114
+
115
+
The same value used for `maxPolygonToCellsSize` must be used for the subsequent call to `polygonToCells`, just as the `GeoPolygon` and `res` must be the same.
116
+
117
+
In bindings, this could be expressed using enums, for example:
0 commit comments