I built a grid that includes the US map. The grid consists of latitudes and longitudes that represent small rectangles inside the US map. A small rectangle consists of many latitudes and longitudes.
From a data set that contains the population, I could reside each part of data in its place on the US grid based on their latitude and longitude.
My goal is to let the user to enter a queryBorders
(inside the gird) to get the accurate population.
The problem is some points' (or population)latitudes and longitudes live in the border of two neighbors, which cause these points to get counted more than one time. This gives inaccurate results.
In the illustration above, how do I get the accurate result (excluding the repeated points) for the queryBorders
(a,b,c,d)?
(getting help from "How to scale down a range of numbers with a known min and max value" to get space for each block!)
Thanks in advance.