Test: find county and plot location from digital coordinates by GeoDjango with MySQL
How It Works
First the program defines a county within the US territory. If this is a Massachusetts county, it further looks for a custom location. For testing purposes, two locations from Plymouth Co., MA were entered in the database: Myles Standish State Forest (MSSF) and one of the three small parcels comprising Massasoit National Wildlife Refuge, which is adjacent to MSSF. (The border of the MSSF is not perfectly defined in this example. The overlap was allowed as an experiment; as a result, a single location may be attributed to both properties.)
Test It Yourself
Sample predefined locations:
Or enter any coordinates within the US (in digital format)
Attention: validity of coordinates entered manually may not be checked in this version!
For this very first version (9 June 2012), I ported to Python one of common algorithms used for testing whether a dot is inside a polygon. It is not the best decision; however, the idea can be used even outside GeoDjango and without employing any spatial databases.
The most important limitation of this prototype is that it treats the geometrical type as a 'single polygon', though in reality it is a 'multi-polygon.' In some situations this may affect the result of the query.