I am working on a Google Maps application that doee the following (on a low zoom level):
Prints a bunch of polygon overlays onto the map. These polygons are created from KML files that I created with Google Earth. Basically these polygons cover continent sized chunks of the earth. 15 of them cover the entire land of the world.
On top of each polygon overlay, a number is displayed that represents the total number of points that exist within that polygon.
The points I want to display on my map have a field representing country, and a field for latitude/longitude. The way I have been getting the totals is to run a query for each polygon by the country code like so:
east_europe_total = Point.objects.filter( Q(country_code='TR') | Q(country_code='CZ') ... ).count()
Which is not very good if I want to have a boundary go across a country, or if I ever want to re-organize my polygons 'sectors'. A much better solution is to give the KML file to the database (which is PostGIS) and have it all sorted out for me. Is this possible in any way? If not, then what about converting the KML file to a format that can both be easily inserted to Google Maps and be query-able by postGIS?