I have some polygons, say, TIGER counties, or hexagons, or what have you. I also have point data that I would like to aggregate over those polygons.
I will be displaying this data on a web map, so ESPG:3857. However, it makes the most sense to me to aggregate my data in a "geographic" mode, e.g. ESPG:4326, because this keeps the edges of my polygons "straight" in a great-circle sense. This raises an issue, though, where the polygon that I've aggregated over and the one that I display to users will not be the same polygon: the edges in my ESPG:3857 projection are not the same edges from my ESPG:4326 projection. I could aggregate in ESPG:3857, but then the polygons that I've aggregated over aren't necessarily the ones folks expect (e.g. they don't represent the "true" edges of the county boundary).
How can I overcome this disparity between the 3D and the 2D projections, specifically with respect to aggregating data?
To illustrate, here is a map showing every 50th point in the Montana TIGER polygon:
Now, suppose that I have some arbitrary lat longs distributed around this map. I want to aggregate these points (say, just to COUNT them) to see how many of them are within the boundaries of Montana. If I were to perform my aggregation in ESPG:4326, I would actually end up counting some quantity of points that are in Canada, because the northern boundary of Montana (e.g. the implied line between the boundary points) is a straight line in ESPG:3857, but is not a straight line in ESPG:4326. So, at the very least, w.r.t. the northern boundary of Montana, I had probably ought to aggregate in ESPG:3857 rather than ESPG:4326. OTOH, the eastern boundary is a straight line in BOTH ESPG:3857 and ESPG:4326, so the aggregation will give the same results for points near the eastern boundary. I don't even know what to think about points along the crooked southwestern edge, but I suppose that they are dense enough that I wouldn't matter.
How can I overcome this issue between the edges of the 3D and the 2D projections, specifically with respect to aggregating data?