-
Notifications
You must be signed in to change notification settings - Fork 362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fractional-Pixel Polygon Rasterizer #1873
Fractional-Pixel Polygon Rasterizer #1873
Conversation
92d3842
to
94aed1d
Compare
val option = Rasterizer.Options(includePartial = false, sampleType = PixelIsArea) | ||
|
||
polygonToEdges(poly, re) | ||
.par |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We keep parallelization out of core geotrellis, since we promote parallelization via other means (e.g. spark). It's unclear if that's definitely the right choice, but that's the choice the rest of the library has made.
Perhaps there should be an option that defaulted to false for parallelization?
def foreachCellByPolygon( | ||
poly: Polygon, | ||
re: RasterExtent | ||
)(fn: FractionCallback): Unit = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use a trait instead of Function3, because Function3 isn't specialized. The way we get around this for tile methods is via macros. We would eventually want to macroize this as well, but that can be a TODO.
): Unit = { | ||
// Screen coordinates | ||
val (x0, y0, x1, y1) = edge | ||
val xmin = min(x0, x1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why call these screen coordinates? The convention in the library is that these are "grid coordinates", and we represent them with col
, row
, rowMin
, etc. This differentiates them from x
, y
, xmin
etc which represent map coordinates.
94aed1d
to
e54601e
Compare
e54601e
to
30af5a3
Compare
In this changeset, a polygon rasterizer which reports partial pixels and the respective fractions of those pixels that are covered by the polygon is presented. The approach used seems to be the most efficient that is practical if sub-pixel geometries are to be supported.
This resource recommends the same method for volumetric calculation as we are envisioning. I have not found any contradictory resources.