2

Looking for some help with getting the county for a lat/lon. I have PostGIS / TIGER Geocoder installed and can reverse look up a point and get the addresses. I would like to get the county the addresses are in.

I have...

geocoder=# SELECT pprint_addy(r.addy[1]) As st1, pprint_addy(r.addy[2]) As st2, pprint_addy(r.addy[3]) As st3, 
    array_to_string(r.street, ',') As cross_streets 
    FROM reverse_geocode(ST_GeomFromText('POINT(-77.03 38.90)',4269),false) As r;
            st1                 |            st2             | st3 |   cross_streets    
------------------------------------+----------------------------+-----+--------------------
New York Ave, Washington, DC 20005 | H St, Washington, DC 20005 |     | H St NW,13th St NW

(1 row)

And would now like to get the county for that point.

2

Silly me... select * from geocoder.tiger_data.county_all ca where ST_Contains(the_geom, ST_GeomFromText('POINT(-77.03 38.90)',4269))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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