Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I try to do Reverse Geocode from my shapefile on the database. I'd already try with Spatialite and PostGIS to put shapefile (.shp) into it. But I'm still can't delivered my objection about reverse geocode from my shapefile on the database. My shapefile (.shp) is content with district polygon, all I want is simple: Pass some coordinate, and check that coordinate is in what district polygon from shapefile, then return the district name. That's all. Does anybody know the SQL Query to do that reverse geocode in PostGIS or Spatialite?

Thanks before. :(

share|improve this question
up vote 8 down vote accepted

Suppose your district table looks like this

districts(name text, the_geom geometry)

Then you would select the district a point falls into using

SELECT name 
FROM districts
WHERE ST_Within(ST_SetSRID(ST_MakePoint(lon,lat),4326),

Replace lon and lat with your values.

If your districts are in a different projection than WGS84, use ST_Transform.

share|improve this answer
SUPER THANKS>>>> :D – AdityaSetyadi Apr 17 '12 at 7:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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