Coasts & borders · 4 min
Which country or state is a point in?
How a map decides which area holds a point, and the odd places where the answer gets tricky.
Coasts & borders
Point in polygon
Every country, state and county is stored as a shape, a polygon. To find which one holds your point, the computer checks which shape the point falls inside. In GIS this is called point in polygon.
Do it with country shapes, then state shapes, then county shapes, and you get the whole ladder: continent, country, region, district.
30.2672, -97.7431 → North America › United States › Texas › Travis County (Austin)
Lesson notes
Everything from the cards above, on one page to come back to.
Point in polygon
Every country, state and county is stored as a shape, a polygon. To find which one holds your point, the computer checks which shape the point falls inside. In GIS this is called point in polygon.
Do it with country shapes, then state shapes, then county shapes, and you get the whole ladder: continent, country, region, district.
30.2672, -97.7431 → North America › United States › Texas › Travis County (Austin)
Islands and pieces
Many countries are made of several pieces, called a multipolygon. Hawaii and Alaska are part of the United States shape, even though they are far from the rest of it.
Some pieces sit inside another country. Llívia is a small Spanish town completely surrounded by France.
When the answer depends on who you ask
Some borders are disputed: Kashmir, Crimea and Western Sahara are well-known examples. Different maps draw them differently, so the answer depends on the boundary data the map uses.
A point exactly on a border line, such as a road down the middle of a frontier, can honestly be in both. Good tools say so rather than picking one.
Questions
How do I find which country a coordinate is in?
Use a point-in-polygon lookup such as MapGO's location hierarchy tool: give it the coordinates and it returns the country, region and district that contain them.
What is a multipolygon?
One area made of several separate shapes, such as a country with islands. The point only has to fall in one of the pieces.