AiTeky Original Interactive Learning & Practice Advanced
Geospatial data science: distances, neighbours, grids, hotspots and validating a map model
Work with places in Python: measure distances from latitude and longitude, find the nearest things with a spatial index, assign points to districts and grids, find hotspots with density clustering, validate a map model with held-out blocks, and plan where to put new clinics.
Almost every business keeps a location somewhere: a customer's address, a delivery stop, a sensor, a branch, an accident. Location data look like two ordinary numbers, and that is the trap. Latitude and longitude are angles on a round earth, near places resemble each other, and the way you cut a map into areas changes what the numbers say.
This course teaches the core of spatial analysis with numpy, pandas, scipy and scikit-learn only, so everything runs in the browser. You compute real distances with the haversine formula and see how a flat shortcut goes wrong; find the nearest tower for 30,000 customers with a spatial index and test what happens when it is built on raw degrees; assign points to districts with a polygon test and bin them into grids, and watch the same data give different correlations at different grid sizes; find hotspots with DBSCAN and compare with k-means; measure spatial autocorrelation with Moran's I and show why random cross-validation flatters a model of a map; and finish by choosing four clinic sites to bring the most people within 5 km of care.
All the data are simulated with a fixed random seed, so every method can be checked against the truth. Real data bring messier coordinates (swapped columns, missing values, GPS error), and the lessons name those risks. We do not use mapping libraries or map tiles; the ideas carry over to them.
You need the Python and pandas courses; the machine learning course helps for the validation lesson.
- Learn lessons explain one idea at a time and let you compute it.
- Industry ready lessons decide and plan. Each ends with the interview questions that go with it.
- βΆ Run code in your browser. Nothing to install
- β Exercises that check themselves
- π Tap a word to see what it means
Locked. Sign up free
Learn
Understand each idea with everyday examples. No coding background needed.
- 01 45 min π AiTeky Pass Latitude and longitude are not x and y: distances on a round earth Measure the distance between places from their latitude and longitude with the haversine formula, see how badly treating degrees as flat x and y goes wrong (it depends on where you are), and learn when a quick flat approximation is good enough.
- 02 50 min π AiTeky Pass Nearest things, fast: tree search, radius counts and a projection that keeps distances honest Find the nearest of 60 hubs for each of 30,000 customers and count the shops within 2 km, first by checking every pair and then with a KD-tree on projected metres, and measure how often a tree built on raw degrees picks the wrong neighbour.
- 03 50 min π AiTeky Pass Which district is this point in? Polygons, grids and the problem of choosing the unit Assign 20,000 accident locations to four districts by testing points against polygons (ray casting by hand), compute areas with the shoelace formula, bin the same points into grids of 1, 2, 5 and 10 km, and see how the correlation between two maps changes with the size of the unit.
- 04 50 min π AiTeky Pass Finding hotspots: density clustering with real distances Find the dense pockets in 5,000 simulated incident locations with DBSCAN using the haversine metric, choose the radius from the distance to the 10th neighbour, compare with k-means, and see how the number of hotspots changes with the radius.
- 05 55 min π AiTeky Pass Near things are alike: spatial autocorrelation and why random cross-validation flatters a map model Measure how much neighbouring places resemble each other with Moran's I (computed by hand, with a permutation test), then show that a model of 1,500 sensor readings looks excellent under random cross-validation and much worse when whole 5 km blocks are held out.
Industry ready
Real problems from real jobs, and the questions interviewers ask about them.

