I'm starting a project from scratch but am budget constrained. In plain language I've got no money. What I want is to provide an address and return what governments have jurisdiction there. The identity of the governments will be coming from the US Census Bureau, though I am not sure they have borders of these governments.

I'm currently considering converting the address to lat/lon coordinates and defining that as a point and defining all ~90k US governments as polygons and then running a search. The large majority of governments are going to be in a different state so the ~90k number will be cut down by a lot just by filtering by state. Is setting up 50 layers (or 50 database tables) with all governments present in a state and then running the analysis only in that layer realistic? Or am I going to need to make enough layers to do it by counties? I'm trying to get at how much calculation am I avoiding if I restrict the geography of the polygons. How much restriction would likely be optimal?

When the GIS database is set up, people will be able to query for "their" results, more exactly the results of the address they put in. I'm also going to create a background task to process addresses ahead of time. The more efficient the calculations, the more I can precalculate.

  • How deep are you going here? Do you intend to get into regional groups, like water zones or congressional districts or metropolitan governments? Or will you be sticking to state/county/town jurisdictions?
    – L_Holcombe
    Nov 10, 2012 at 4:51
  • 90K polygons sounds achievable (even with a full table scan, although obviously some indexing will help). How are you going to do the address -> lat/lon lookup?
    – BradHards
    Nov 10, 2012 at 6:21
  • L_Holcombe - The answer to your question is not quite precise, though the surface answer is. I am starting with the results of the twice a decade census of governments, which is conducted via well established rules as to what is a government and what is not. The project is big enough without adding in the quasi governments in phase I.
    – TMLutas
    Nov 10, 2012 at 6:42
  • BradHards - I will likely use geocoder.us to start with and eventually reimplement it on my own servers before this ever gets popular enough to strain their generosity.
    – TMLutas
    Nov 10, 2012 at 6:48
  • Apologies, should have given the census of governments URL in that first answer. Here it is: census.gov/econ/overview/go0100.html
    – TMLutas
    Nov 10, 2012 at 6:56

1 Answer 1


This seems like a simple point in polygon query over each of the government levels that you are interested in.

I'd go about it by adding the states, senate, congressional districts etc. from the Census Bureau web site to PostGIS using shp2psql, using one table for each level. Then you simply run a select query against each table to determine which (if any) zone the point of interest falls in.

Make sure that you've created some spatial indexes on the tables after you've finished the import (it's really slow adding them if you create them too early).

The final step is handling how to select the address and report the results but that is UI work left as an exercise to the reader :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.